(svn r12452) -Feature: [NewGRF] Add random action 2 type 84. For vehicles only.

This commit is contained in:
glx
2008-03-27 21:36:16 +00:00
parent 5ddb78af9f
commit bbdb831301
11 changed files with 46 additions and 2 deletions

View File

@@ -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;