diff options
author | peter1138 <peter1138@openttd.org> | 2006-05-10 06:23:43 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-05-10 06:23:43 +0000 |
commit | 31ce3269a754cc0eacca8d66c1c046c1890a6373 (patch) | |
tree | 8ea6a0086d5fffc2571f5cb0bdd481134a2f635f | |
parent | 434fb4e08c9e2edf973669a55b86e9520dec6952 (diff) | |
download | openttd-31ce3269a754cc0eacca8d66c1c046c1890a6373.tar.xz |
(svn r4811) - NewGRF: only check a sprite set's feature when assigning a sprite result sprite group.
-rw-r--r-- | newgrf.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -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); } |