From 324e92f879980085c773b192ff71e07bd99fd4b0 Mon Sep 17 00:00:00 2001 From: frosch Date: Thu, 5 Feb 2009 17:48:08 +0000 Subject: (svn r15360) -Fix: Flooding vehicles did not trigger an AI event. --- src/ai/api/ai_event_types.hpp | 1 + src/ai/api/ai_event_types.hpp.sq | 1 + src/water_cmd.cpp | 2 ++ 3 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/ai/api/ai_event_types.hpp b/src/ai/api/ai_event_types.hpp index c828410ad..18cae119f 100644 --- a/src/ai/api/ai_event_types.hpp +++ b/src/ai/api/ai_event_types.hpp @@ -32,6 +32,7 @@ public: CRASH_RV_UFO, ///< Road vehicle got under a landing ufo CRASH_PLANE_LANDING, ///< Plane crashed on landing CRASH_AIRCRAFT_NO_AIRPORT, ///< Aircraft crashed after it found not a single airport for landing + CRASH_FLOODED, ///< Vehicle was flooded }; /** diff --git a/src/ai/api/ai_event_types.hpp.sq b/src/ai/api/ai_event_types.hpp.sq index 3645fb6d2..a3a930860 100644 --- a/src/ai/api/ai_event_types.hpp.sq +++ b/src/ai/api/ai_event_types.hpp.sq @@ -25,6 +25,7 @@ void SQAIEventVehicleCrashed_Register(Squirrel *engine) { SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_RV_UFO, "CRASH_RV_UFO"); SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_PLANE_LANDING, "CRASH_PLANE_LANDING"); SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT, "CRASH_AIRCRAFT_NO_AIRPORT"); + SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_FLOODED, "CRASH_FLOODED"); SQAIEventVehicleCrashed.DefSQStaticMethod(engine, &AIEventVehicleCrashed::GetClassName, "GetClassName", 1, "x"); SQAIEventVehicleCrashed.DefSQStaticMethod(engine, &AIEventVehicleCrashed::Convert, "Convert", 2, "xx"); diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 9d6921c10..87f22a5ee 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -32,6 +32,7 @@ #include "newgrf_cargo.h" #include "effectvehicle_func.h" #include "tunnelbridge_map.h" +#include "ai/ai.hpp" #include "table/sprites.h" #include "table/strings.h" @@ -838,6 +839,7 @@ static void FloodVehicle(Vehicle *v) InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); + AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_FLOODED)); SetDParam(0, pass); AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED, NS_ACCIDENT_VEHICLE, -- cgit v1.2.3-70-g09d2