src/newgrf.cpp
changeset 9252 92e05c28a994
parent 9250 9011a285f2dd
child 9254 7190535588ee
--- a/src/newgrf.cpp	Thu Mar 27 19:02:18 2008 +0000
+++ b/src/newgrf.cpp	Thu Mar 27 21:36:16 2008 +0000
@@ -2584,13 +2584,19 @@
 		/* 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;