summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-11-17 17:15:36 +0000
committertron <tron@openttd.org>2004-11-17 17:15:36 +0000
commitc4e989685179fbe463d138834f71375e94e0fbad (patch)
tree83c8ab527dfe114dbc91749eca02b76408c4eb35
parent155f20329b200a37455f94c9000fd146f41ee0d4 (diff)
downloadopenttd-c4e989685179fbe463d138834f71375e94e0fbad.tar.xz
(svn r658) Ignore callbackish randomized spritegroups - they would just crash us (pasky)
-rw-r--r--grfspecial.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/grfspecial.c b/grfspecial.c
index 4809af5d1..7141a6781 100644
--- a/grfspecial.c
+++ b/grfspecial.c
@@ -1212,6 +1212,13 @@ static void NewSpriteGroup(byte *buf, int len)
rg->groups = calloc(rg->num_groups, sizeof(*rg->groups));
for (i = 0; i < rg->num_groups; i++) {
uint16 groupid = grf_load_word(&buf);
+
+ if (groupid & 0x8000 || groupid >= _cur_grffile->spritegroups_count) {
+ /* This doesn't exist for us. */
+ i--;
+ rg->num_groups--;
+ continue;
+ }
/* XXX: If multiple surreal sets attach a surreal
* set this way, we are in trouble. */
rg->groups[i] = _cur_grffile->spritegroups[groupid];