mirror of https://github.com/OpenTTD/OpenTTD
Fix: [NewGRF] For animation-triggers which do not supply a cargo-type in var18, the var18 bits should remain empty. (#14091)
parent
0d9074769d
commit
d3ae6bc9a8
|
@ -309,9 +309,9 @@ static bool DoTriggerAirportTileAnimation(Station *st, TileIndex tile, AirportAn
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TriggerAirportTileAnimation(Station *st, TileIndex tile, AirportAnimationTrigger trigger, CargoType cargo_type)
|
bool TriggerAirportTileAnimation(Station *st, TileIndex tile, AirportAnimationTrigger trigger)
|
||||||
{
|
{
|
||||||
return DoTriggerAirportTileAnimation(st, tile, trigger, Random(), cargo_type << 8);
|
return DoTriggerAirportTileAnimation(st, tile, trigger, Random());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TriggerAirportAnimation(Station *st, AirportAnimationTrigger trigger, CargoType cargo_type)
|
bool TriggerAirportAnimation(Station *st, AirportAnimationTrigger trigger, CargoType cargo_type)
|
||||||
|
@ -323,7 +323,12 @@ bool TriggerAirportAnimation(Station *st, AirportAnimationTrigger trigger, Cargo
|
||||||
for (TileIndex tile : st->airport) {
|
for (TileIndex tile : st->airport) {
|
||||||
if (!st->TileBelongsToAirport(tile)) continue;
|
if (!st->TileBelongsToAirport(tile)) continue;
|
||||||
|
|
||||||
if (DoTriggerAirportTileAnimation(st, tile, trigger, random, cargo_type << 8)) {
|
uint8_t var18_extra = 0;
|
||||||
|
if (IsValidCargoType(cargo_type)) {
|
||||||
|
var18_extra |= cargo_type << 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DoTriggerAirportTileAnimation(st, tile, trigger, random, var18_extra)) {
|
||||||
SB(random, 0, 16, Random());
|
SB(random, 0, 16, Random());
|
||||||
} else {
|
} else {
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
|
@ -88,7 +88,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void AnimateAirportTile(TileIndex tile);
|
void AnimateAirportTile(TileIndex tile);
|
||||||
bool TriggerAirportTileAnimation(Station *st, TileIndex tile, AirportAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
bool TriggerAirportTileAnimation(Station *st, TileIndex tile, AirportAnimationTrigger trigger);
|
||||||
bool TriggerAirportAnimation(Station *st, AirportAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
bool TriggerAirportAnimation(Station *st, AirportAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
||||||
bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts);
|
bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts);
|
||||||
|
|
||||||
|
|
|
@ -389,13 +389,11 @@ void TriggerRoadStopAnimation(BaseStation *st, TileIndex trigger_tile, StationAn
|
||||||
auto process_tile = [&](TileIndex cur_tile) {
|
auto process_tile = [&](TileIndex cur_tile) {
|
||||||
const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
|
const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
|
||||||
if (ss != nullptr && ss->animation.triggers.Test(trigger)) {
|
if (ss != nullptr && ss->animation.triggers.Test(trigger)) {
|
||||||
uint8_t local_cargo;
|
uint8_t var18_extra = 0;
|
||||||
if (!IsValidCargoType(cargo_type)) {
|
if (IsValidCargoType(cargo_type)) {
|
||||||
local_cargo = UINT8_MAX;
|
var18_extra |= ss->grf_prop.grffile->cargo_map[cargo_type] << 8;
|
||||||
} else {
|
|
||||||
local_cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
|
|
||||||
}
|
}
|
||||||
RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIMATION_TRIGGER, ss, st, cur_tile, (random_bits << 16) | GB(Random(), 0, 16), to_underlying(trigger) | (local_cargo << 8));
|
RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIMATION_TRIGGER, ss, st, cur_tile, (random_bits << 16) | GB(Random(), 0, 16), to_underlying(trigger) | var18_extra);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -923,13 +923,11 @@ void TriggerStationAnimation(BaseStation *st, TileIndex trigger_tile, StationAni
|
||||||
if (st->TileBelongsToRailStation(tile)) {
|
if (st->TileBelongsToRailStation(tile)) {
|
||||||
const StationSpec *ss = GetStationSpec(tile);
|
const StationSpec *ss = GetStationSpec(tile);
|
||||||
if (ss != nullptr && ss->animation.triggers.Test(trigger)) {
|
if (ss != nullptr && ss->animation.triggers.Test(trigger)) {
|
||||||
uint8_t local_cargo;
|
uint8_t var18_extra = 0;
|
||||||
if (!IsValidCargoType(cargo_type)) {
|
if (IsValidCargoType(cargo_type)) {
|
||||||
local_cargo = UINT8_MAX;
|
var18_extra |= ss->grf_prop.grffile->cargo_map[cargo_type] << 8;
|
||||||
} else {
|
|
||||||
local_cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
|
|
||||||
}
|
}
|
||||||
StationAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIMATION_TRIGGER, ss, st, tile, (random_bits << 16) | GB(Random(), 0, 16), to_underlying(trigger) | (local_cargo << 8));
|
StationAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIMATION_TRIGGER, ss, st, tile, (random_bits << 16) | GB(Random(), 0, 16), to_underlying(trigger) | var18_extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue