Clean up signs when reading
This commit is contained in:
parent
3ea25c83b7
commit
09a3670d64
@ -44,6 +44,8 @@ void strlist_free(struct strlist **list);
|
||||
|
||||
void save_presets(int do_update);
|
||||
|
||||
void clean_text(char *text, int vwidth);
|
||||
|
||||
void load_presets(void);
|
||||
|
||||
void save_string(FILE *f, char *str);
|
||||
|
@ -1036,6 +1036,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
|
||||
{
|
||||
memcpy(signs[k].text, d+p, x);
|
||||
signs[k].text[x] = 0;
|
||||
clean_text(signs[k].text, 158-14 /* Current max sign length */);
|
||||
}
|
||||
p += x;
|
||||
}
|
||||
|
13
src/misc.c
13
src/misc.c
@ -99,6 +99,19 @@ void strlist_free(struct strlist **list)
|
||||
}
|
||||
}
|
||||
|
||||
void clean_text(char *text, int vwidth)
|
||||
{
|
||||
int i = 0;
|
||||
if(textwidth(text) > vwidth){
|
||||
text[textwidthx(text, vwidth)] = 0;
|
||||
}
|
||||
for(i = 0; i < strlen(text); i++){
|
||||
if(! (text[i]>=' ' && text[i]<127)){
|
||||
text[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void save_presets(int do_update)
|
||||
{
|
||||
FILE *f=fopen("powder.def", "wb");
|
||||
|
Loading…
Reference in New Issue
Block a user