Use pos TileVirtXY for aircraft crash tile

See: #549
This commit is contained in:
Jonathan G Rennison
2023-06-14 22:43:41 +01:00
parent d6787c4731
commit c46afa04f7

View File

@@ -1425,14 +1425,12 @@ static void CrashAirplane(Aircraft *v)
v->Next()->cargo.Truncate(); v->Next()->cargo.Truncate();
const Station *st = GetTargetAirportIfValid(v); const Station *st = GetTargetAirportIfValid(v);
StringID newsitem; StringID newsitem;
TileIndex vt; TileIndex vt = TileVirtXY(v->x_pos, v->y_pos);
if (st == nullptr) { if (st == nullptr) {
newsitem = STR_NEWS_PLANE_CRASH_OUT_OF_FUEL; newsitem = STR_NEWS_PLANE_CRASH_OUT_OF_FUEL;
vt = TileVirtXY(v->x_pos, v->y_pos);
} else { } else {
SetDParam(1, st->index); SetDParam(1, st->index);
newsitem = STR_NEWS_AIRCRAFT_CRASH; newsitem = STR_NEWS_AIRCRAFT_CRASH;
vt = v->tile;
} }
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, vt, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING)); AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, vt, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));