summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-02 09:18:51 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-02 09:18:51 +0000
commitb1e928e889127e92cdb35a630b03f4de4a7722ea (patch)
tree3bb8aa36ad93dc0129680954e644df116b655cb3 /newgrf.c
parent9d8a0366b3f5a4b4f8fda3a0b12d6c62fa3b2703 (diff)
downloadopenttd-b1e928e889127e92cdb35a630b03f4de4a7722ea.tar.xz
(svn r4657) - NewGRF: use grf_load_byte() in favour of array accesses
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/newgrf.c b/newgrf.c
index 065c5462a..fa87daae2 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1128,10 +1128,11 @@ static void VehicleChangeInfo(byte *buf, int len)
}
check_length(len, 6, "VehicleChangeInfo");
- feature = buf[1];
- numprops = buf[2];
- numinfo = buf[3];
- engine = buf[4];
+ buf++;
+ feature = grf_load_byte(&buf);
+ numprops = grf_load_byte(&buf);
+ numinfo = grf_load_byte(&buf);
+ engine = grf_load_byte(&buf);
DEBUG(grf, 6) ("VehicleChangeInfo: Feature %d, %d properties, to apply to %d+%d",
feature, numprops, engine, numinfo);
@@ -1149,8 +1150,6 @@ static void VehicleChangeInfo(byte *buf, int len)
ei = &_engine_info[engine + _vehshifts[feature]];
}
- buf += 5;
-
while (numprops-- && buf < bufend) {
uint8 prop = grf_load_byte(&buf);
bool ignoring = false;
@@ -1973,16 +1972,16 @@ static void SkipIf(byte *buf, int len)
GRFLabel *choice = NULL;
check_length(len, 6, "SkipIf");
- param = buf[1];
- paramsize = buf[2];
- condtype = buf[3];
+ buf++;
+ param = grf_load_byte(&buf);
+ paramsize = grf_load_byte(&buf);
+ condtype = grf_load_byte(&buf);
if (condtype < 2) {
/* Always 1 for bit tests, the given value should be ignored. */
paramsize = 1;
}
- buf += 4;
switch (paramsize) {
case 4: cond_val = grf_load_dword(&buf); break;
case 2: cond_val = grf_load_word(&buf); break;