mirror of https://github.com/OpenTTD/OpenTTD
(svn r8964) -Codechange: use grf_load_string to read action 8 strings instead of trying to do the same manually.
parent
c53f174005
commit
cd8090f3bd
|
@ -2628,8 +2628,6 @@ static void ScanInfo(byte *buf, int len)
|
||||||
uint32 grfid;
|
uint32 grfid;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *info;
|
const char *info;
|
||||||
int name_len;
|
|
||||||
int info_len;
|
|
||||||
|
|
||||||
if (!check_length(len, 8, "Info")) return; buf++;
|
if (!check_length(len, 8, "Info")) return; buf++;
|
||||||
version = grf_load_byte(&buf);
|
version = grf_load_byte(&buf);
|
||||||
|
@ -2641,17 +2639,13 @@ static void ScanInfo(byte *buf, int len)
|
||||||
if (GB(grfid, 24, 8) == 0xFF) SETBIT(_cur_grfconfig->flags, GCF_SYSTEM);
|
if (GB(grfid, 24, 8) == 0xFF) SETBIT(_cur_grfconfig->flags, GCF_SYSTEM);
|
||||||
|
|
||||||
len -= 6;
|
len -= 6;
|
||||||
name = (const char*)buf;
|
name = grf_load_string(&buf, len);
|
||||||
name_len = ttd_strnlen(name, len);
|
_cur_grfconfig->name = TranslateTTDPatchCodes(name);
|
||||||
|
|
||||||
if (name_len < len) {
|
len -= strlen(name) + 1;
|
||||||
_cur_grfconfig->name = TranslateTTDPatchCodes(name);
|
if (len > 0) {
|
||||||
|
info = grf_load_string(&buf, len);
|
||||||
len -= name_len + 1;
|
_cur_grfconfig->info = TranslateTTDPatchCodes(info);
|
||||||
info = name + name_len + 1;
|
|
||||||
info_len = ttd_strnlen(info, len);
|
|
||||||
|
|
||||||
if (info_len < len) _cur_grfconfig->info = TranslateTTDPatchCodes(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */
|
/* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */
|
||||||
|
|
Loading…
Reference in New Issue