diff options
author | rubidium <rubidium@openttd.org> | 2007-03-01 23:37:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-03-01 23:37:05 +0000 |
commit | cd8090f3bdf219e00beeae1c3389a2fff0aa3289 (patch) | |
tree | 0f5a7484b79a68abfa0f6be06ae541562509dbfb /src | |
parent | c53f17400540e5d7c4802b662b355a52812e628e (diff) | |
download | openttd-cd8090f3bdf219e00beeae1c3389a2fff0aa3289.tar.xz |
(svn r8964) -Codechange: use grf_load_string to read action 8 strings instead of trying to do the same manually.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 14755d219..b3998dfd1 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2628,8 +2628,6 @@ static void ScanInfo(byte *buf, int len) uint32 grfid; const char *name; const char *info; - int name_len; - int info_len; if (!check_length(len, 8, "Info")) return; 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); len -= 6; - name = (const char*)buf; - name_len = ttd_strnlen(name, len); + name = grf_load_string(&buf, len); + _cur_grfconfig->name = TranslateTTDPatchCodes(name); - if (name_len < len) { - _cur_grfconfig->name = TranslateTTDPatchCodes(name); - - len -= name_len + 1; - info = name + name_len + 1; - info_len = ttd_strnlen(info, len); - - if (info_len < len) _cur_grfconfig->info = TranslateTTDPatchCodes(info); + len -= strlen(name) + 1; + if (len > 0) { + info = grf_load_string(&buf, len); + _cur_grfconfig->info = TranslateTTDPatchCodes(info); } /* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */ |