(svn r15358) -Add [NoAI]: AIEventVehicleCrashed::GetCrashReason()

This commit is contained in:
frosch
2009-02-05 17:28:37 +00:00
parent 6dff31d34b
commit 7f198507f7
6 changed files with 37 additions and 5 deletions

View File

@@ -1323,14 +1323,17 @@ static void CrashAirplane(Vehicle *v)
v->Next()->cargo.Truncate(0);
const Station *st = GetTargetAirportIfValid(v);
StringID newsitem;
AIEventVehicleCrashed::CrashReason crash_reason;
if (st == NULL) {
newsitem = STR_PLANE_CRASH_OUT_OF_FUEL;
crash_reason = AIEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT;
} else {
SetDParam(1, st->index);
newsitem = STR_A034_PLANE_CRASH_DIE_IN_FIREBALL;
crash_reason = AIEventVehicleCrashed::CRASH_PLANE_LANDING;
}
AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile));
AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, crash_reason));
AddNewsItem(newsitem,
NS_ACCIDENT_VEHICLE,