summaryrefslogtreecommitdiff
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
commit31ce3269a754cc0eacca8d66c1c046c1890a6373 (patch)
tree8ea6a0086d5fffc2571f5cb0bdd481134a2f635f
parent434fb4e08c9e2edf973669a55b86e9520dec6952 (diff)
downloadopenttd-31ce3269a754cc0eacca8d66c1c046c1890a6373.tar.xz
(svn r4811) - NewGRF: only check a sprite set's feature when assigning a sprite result sprite group.
-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);
}