File diff r27420:b37b70eb3169 → r27421:e8c2cdc1e8e6
src/newgrf_station.cpp
Show inline comments
 
@@ -409,13 +409,13 @@ uint32 Station::GetNewGRFVariable(const 
 
	}
 

	
 
	/* Handle cargo variables with parameter, 0x60 to 0x65 and 0x69 */
 
	if ((variable >= 0x60 && variable <= 0x65) || variable == 0x69) {
 
		CargoID c = GetCargoTranslation(parameter, object.grffile);
 

	
 
		if (c == CT_INVALID) {
 
		if (!IsValidCargoID(c)) {
 
			switch (variable) {
 
				case 0x62: return 0xFFFFFFFF;
 
				case 0x64: return 0xFF00;
 
				default:   return 0;
 
			}
 
		}
 
@@ -928,13 +928,13 @@ void TriggerStationAnimation(BaseStation
 
	/* Check all tiles over the station to check if the specindex is still in use */
 
	for (TileIndex tile : area) {
 
		if (st->TileBelongsToRailStation(tile)) {
 
			const StationSpec *ss = GetStationSpec(tile);
 
			if (ss != nullptr && HasBit(ss->animation.triggers, trigger)) {
 
				CargoID cargo;
 
				if (cargo_type == CT_INVALID) {
 
				if (!IsValidCargoID(cargo_type)) {
 
					cargo = CT_INVALID;
 
				} else {
 
					cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
 
				}
 
				StationAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIM_START_STOP, ss, st, tile, (random_bits << 16) | GB(Random(), 0, 16), (uint8)trigger | (cargo << 8));
 
			}
 
@@ -959,13 +959,13 @@ void TriggerStationRandomisation(Station
 
	/* Get Station if it wasn't supplied */
 
	if (st == nullptr) st = Station::GetByTile(trigger_tile);
 

	
 
	/* Check the cached cargo trigger bitmask to see if we need
 
	 * to bother with any further processing. */
 
	if (st->cached_cargo_triggers == 0) return;
 
	if (cargo_type != CT_INVALID && !HasBit(st->cached_cargo_triggers, cargo_type)) return;
 
	if (IsValidCargoID(cargo_type) && !HasBit(st->cached_cargo_triggers, cargo_type)) return;
 

	
 
	uint32 whole_reseed = 0;
 
	ETileArea area = ETileArea(st, trigger_tile, tas[trigger]);
 

	
 
	CargoTypes empty_mask = 0;
 
	if (trigger == SRT_CARGO_TAKEN) {
 
@@ -990,13 +990,13 @@ void TriggerStationRandomisation(Station
 
			/* Cargo taken "will only be triggered if all of those
 
			 * cargo types have no more cargo waiting." */
 
			if (trigger == SRT_CARGO_TAKEN) {
 
				if ((ss->cargo_triggers & ~empty_mask) != 0) continue;
 
			}
 

	
 
			if (cargo_type == CT_INVALID || HasBit(ss->cargo_triggers, cargo_type)) {
 
			if (!IsValidCargoID(cargo_type) || HasBit(ss->cargo_triggers, cargo_type)) {
 
				StationResolverObject object(ss, st, tile, CBID_RANDOM_TRIGGER, 0);
 
				object.waiting_triggers = st->waiting_triggers;
 

	
 
				const SpriteGroup *group = object.Resolve();
 
				if (group == nullptr) continue;