summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-06 22:25:27 +0000
committertron <tron@openttd.org>2005-02-06 22:25:27 +0000
commiteed181245dffbc04a2e527e8e7cccf44ce4fda86 (patch)
treef2cd6e89c719cd0e1e1f5f36d8b3e1bcb804079f /newgrf.c
parent27dc506a0313993c8e7dc4acf77da9649d362a58 (diff)
downloadopenttd-eed181245dffbc04a2e527e8e7cccf44ce4fda86.tar.xz
(svn r1833) byte -> char transition: the rest
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/newgrf.c b/newgrf.c
index 03f622a2e..f96459734 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1509,6 +1509,7 @@ static void VehicleNewName(byte *buf, int len)
uint8 lang;
uint8 id;
uint8 endid;
+ const char* name;
check_length(len, 6, "VehicleNewName");
feature = buf[1];
@@ -1530,17 +1531,19 @@ static void VehicleNewName(byte *buf, int len)
return;
}
- buf += 5, len -= 5;
+ name = (const char*)(buf + 5);
+ len -= 5;
for (; id < endid && len > 0; id++) {
- int ofs = strlen(buf) + 1;
+ int ofs = strlen(name) + 1;
if (ofs < 128) {
- DEBUG(grf, 8) ("VehicleNewName: %d <- %s", id, buf);
- SetCustomEngineName(id, buf);
+ DEBUG(grf, 8) ("VehicleNewName: %d <- %s", id, name);
+ SetCustomEngineName(id, name);
} else {
DEBUG(grf, 7) ("VehicleNewName: Too long a name (%d)", ofs);
}
- buf += ofs, len -= ofs;
+ name += ofs;
+ len -= ofs;
}
}
@@ -1712,14 +1715,14 @@ static void GRFInfo(byte *buf, int len)
/* TODO: Check version. (We should have own versioning done somehow.) */
uint8 version;
uint32 grfid;
- char *name;
- char *info;
+ const char *name;
+ const char *info;
check_length(len, 9, "GRFInfo");
version = buf[1];
/* this is de facto big endian - grf_load_dword() unsuitable */
grfid = buf[2] << 24 | buf[3] << 16 | buf[4] << 8 | buf[5];
- name = buf + 6;
+ name = (const char*)(buf + 6);
info = name + strlen(name) + 1;
_cur_grffile->grfid = grfid;