summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-10-15 07:40:22 +0000
committerpeter1138 <peter1138@openttd.org>2005-10-15 07:40:22 +0000
commitab41ccb23c92b30fdbdfe793e31ccc4bd5df6661 (patch)
tree793dc0ec30e0024d87da1de2b6172bd53240977b
parent5c3625b88fba7d83173851f177c14309e3d54989 (diff)
downloadopenttd-ab41ccb23c92b30fdbdfe793e31ccc4bd5df6661.tar.xz
(svn r3045) -NewGRF, Codechange: Don't attempt to map and empty sprite group to a vehicle.
-rw-r--r--newgrf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/newgrf.c b/newgrf.c
index 9ee9817ca..d534181df 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1608,8 +1608,8 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
uint8 ctype = grf_load_byte(&bp);
uint16 groupid = grf_load_word(&bp);
- if (groupid >= _cur_grffile->spritegroups_count) {
- grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x, skipping.",
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.",
groupid, _cur_grffile->spritegroups_count);
return;
}
@@ -1628,8 +1628,8 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
byte *bp = buf + 4 + idcount + cidcount * 3;
uint16 groupid = grf_load_word(&bp);
- if (groupid >= _cur_grffile->spritegroups_count) {
- grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x, skipping.",
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.",
groupid, _cur_grffile->spritegroups_count);
return;
}
@@ -1700,8 +1700,8 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
DEBUG(grf, 8) ("VehicleMapSpriteGroup: * [%d] Cargo type %x, group id %x", c, ctype, groupid);
- if (groupid >= _cur_grffile->spritegroups_count) {
- grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x, skipping.", groupid, _cur_grffile->spritegroups_count);
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.", groupid, _cur_grffile->spritegroups_count);
return;
}
@@ -1727,8 +1727,8 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
uint8 engine = buf[3 + i] + _vehshifts[feature];
// Don't tell me you don't love duplicated code!
- if (groupid >= _cur_grffile->spritegroups_count) {
- grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x, skipping.", groupid, _cur_grffile->spritegroups_count);
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.", groupid, _cur_grffile->spritegroups_count);
return;
}