summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 5d405b483..23cf67c14 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2584,13 +2584,19 @@ static void NewSpriteGroup(byte *buf, int len)
/* Randomized Sprite Group */
case 0x80: // Self scope
case 0x83: // Parent scope
+ case 0x84: // Relative scope
{
- if (!check_length(bufend - buf, 7, "NewSpriteGroup (Randomized) (1)")) return;
+ if (!check_length(bufend - buf, HasBit(type, 2) ? 8 : 7, "NewSpriteGroup (Randomized) (1)")) return;
group = AllocateSpriteGroup();
group->type = SGT_RANDOMIZED;
group->g.random.var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
+ if (HasBit(type, 2) && feature <= GSF_AIRCRAFT) {
+ group->g.random.var_scope = VSG_SCOPE_RELATIVE;
+ group->g.random.count = grf_load_byte(&buf);
+ }
+
uint8 triggers = grf_load_byte(&buf);
group->g.random.triggers = GB(triggers, 0, 7);
group->g.random.cmp_mode = HasBit(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;