src/newgrf.cpp
changeset 9252 92e05c28a994
parent 9250 9011a285f2dd
child 9254 7190535588ee
equal deleted inserted replaced
9251:f41952647dd4 9252:92e05c28a994
  2582 		}
  2582 		}
  2583 
  2583 
  2584 		/* Randomized Sprite Group */
  2584 		/* Randomized Sprite Group */
  2585 		case 0x80: // Self scope
  2585 		case 0x80: // Self scope
  2586 		case 0x83: // Parent scope
  2586 		case 0x83: // Parent scope
       
  2587 		case 0x84: // Relative scope
  2587 		{
  2588 		{
  2588 			if (!check_length(bufend - buf, 7, "NewSpriteGroup (Randomized) (1)")) return;
  2589 			if (!check_length(bufend - buf, HasBit(type, 2) ? 8 : 7, "NewSpriteGroup (Randomized) (1)")) return;
  2589 
  2590 
  2590 			group = AllocateSpriteGroup();
  2591 			group = AllocateSpriteGroup();
  2591 			group->type = SGT_RANDOMIZED;
  2592 			group->type = SGT_RANDOMIZED;
  2592 			group->g.random.var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
  2593 			group->g.random.var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
       
  2594 
       
  2595 			if (HasBit(type, 2) && feature <= GSF_AIRCRAFT) {
       
  2596 				group->g.random.var_scope = VSG_SCOPE_RELATIVE;
       
  2597 				group->g.random.count = grf_load_byte(&buf);
       
  2598 			}
  2593 
  2599 
  2594 			uint8 triggers = grf_load_byte(&buf);
  2600 			uint8 triggers = grf_load_byte(&buf);
  2595 			group->g.random.triggers       = GB(triggers, 0, 7);
  2601 			group->g.random.triggers       = GB(triggers, 0, 7);
  2596 			group->g.random.cmp_mode       = HasBit(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
  2602 			group->g.random.cmp_mode       = HasBit(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
  2597 			group->g.random.lowest_randbit = grf_load_byte(&buf);
  2603 			group->g.random.lowest_randbit = grf_load_byte(&buf);