summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-10 06:23:43 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-10 06:23:43 +0000
commitd2fc3431a1baef1d7bbdfc02e80a02b5238f2741 (patch)
tree8ea6a0086d5fffc2571f5cb0bdd481134a2f635f /newgrf.c
parent11f4f6276f02ed1a323f4f49b99982ac2c120e2c (diff)
downloadopenttd-d2fc3431a1baef1d7bbdfc02e80a02b5238f2741.tar.xz
(svn r4811) - NewGRF: only check a sprite set's feature when assigning a sprite result sprite group.
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/newgrf.c b/newgrf.c
index 023508e45..83493adbe 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1299,7 +1299,7 @@ static SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 groupid)
}
/* Helper function to either create a callback or a result sprite group. */
-static SpriteGroup* CreateGroupFromGroupID(byte setid, byte type, uint16 spriteid, uint16 num_sprites)
+static SpriteGroup* CreateGroupFromGroupID(byte feature, byte setid, byte type, uint16 spriteid, uint16 num_sprites)
{
if (HASBIT(spriteid, 15)) return NewCallBackResultSpriteGroup(spriteid);
@@ -1319,6 +1319,12 @@ static SpriteGroup* CreateGroupFromGroupID(byte setid, byte type, uint16 spritei
return NULL;
}
+ if (feature != _cur_grffile->spriteset_feature) {
+ grfmsg(GMS_WARN, "NewSpriteGroup(0x%02X:0x%02X): Sprite set feature 0x%02X does not match action feature 0x%02X, skipping.",
+ _cur_grffile->spriteset_feature, feature);
+ return NULL;
+ }
+
return NewResultSpriteGroup(_cur_grffile->spriteset_start + spriteid * num_sprites, num_sprites);
}
@@ -1356,14 +1362,6 @@ static void NewSpriteGroup(byte *buf, int len)
_cur_grffile->spritegroups[_cur_grffile->spritegroups_count] = NULL;
}
- if (feature != _cur_grffile->spriteset_feature) {
- grfmsg(GMS_WARN, "NewSpriteGroup: sprite set feature 0x%02X does not match action feature 0x%02X, skipping.",
- _cur_grffile->spriteset_feature, feature);
- /* Clear this group's reference */
- _cur_grffile->spritegroups[setid] = NULL;
- return;
- }
-
switch (type) {
/* Deterministic Sprite Group */
case 0x81: // Self scope, byte
@@ -1475,6 +1473,8 @@ static void NewSpriteGroup(byte *buf, int len)
/* Neither a variable or randomized sprite group... must be a real group */
default:
{
+
+
switch (feature) {
case GSF_TRAIN:
case GSF_ROAD:
@@ -1507,13 +1507,13 @@ static void NewSpriteGroup(byte *buf, int len)
for (i = 0; i < num_loaded; i++) {
uint16 spriteid = grf_load_word(&buf);
- group->g.real.loaded[i] = CreateGroupFromGroupID(setid, type, spriteid, sprites);
+ group->g.real.loaded[i] = CreateGroupFromGroupID(feature, setid, type, spriteid, sprites);
DEBUG(grf, 8) ("NewSpriteGroup: + rg->loaded[%i] = subset %u", i, spriteid);
}
for (i = 0; i < num_loading; i++) {
uint16 spriteid = grf_load_word(&buf);
- group->g.real.loading[i] = CreateGroupFromGroupID(setid, type, spriteid, sprites);
+ group->g.real.loading[i] = CreateGroupFromGroupID(feature, setid, type, spriteid, sprites);
DEBUG(grf, 8) ("NewSpriteGroup: + rg->loading[%i] = subset %u", i, spriteid);
}