summaryrefslogtreecommitdiff
path: root/src/script/api/script_event_types.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/api/script_event_types.hpp')
-rw-r--r--src/script/api/script_event_types.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/script/api/script_event_types.hpp b/src/script/api/script_event_types.hpp
index f9b2fb87f..aeb5ebe2d 100644
--- a/src/script/api/script_event_types.hpp
+++ b/src/script/api/script_event_types.hpp
@@ -1060,4 +1060,44 @@ public:
static ScriptEventRoadReconstruction *Convert(ScriptEventCompanyTown *instance) { return (ScriptEventRoadReconstruction *)instance; }
};
+/**
+ * Event VehicleAutoReplaced, indicating a vehicle has been auto replaced.
+ * @api ai
+ */
+class ScriptEventVehicleAutoReplaced : public ScriptEvent {
+public:
+ /**
+ * @param old_id The vehicle that has been replaced.
+ * @param new_id The vehicle that has been created in replacement.
+ */
+ ScriptEventVehicleAutoReplaced(VehicleID old_id, VehicleID new_id) :
+ ScriptEvent(ET_VEHICLE_AUTOREPLACED),
+ old_id(old_id),
+ new_id(new_id)
+ {}
+
+ /**
+ * Convert an ScriptEvent to the real instance.
+ * @param instance The instance to convert.
+ * @return The converted instance.
+ */
+ static ScriptEventVehicleAutoReplaced *Convert(ScriptEvent *instance) { return (ScriptEventVehicleAutoReplaced *)instance; }
+
+ /**
+ * Get the VehicleID of the vehicle that has been replaced.
+ * @return The VehicleID of the vehicle that has been replaced. This ID is no longer valid for referencing the vehicle.
+ */
+ VehicleID GetOldVehicleID() { return this->old_id; }
+
+ /**
+ * Get the VehicleID of the vehicle that has been created in replacement.
+ * @return The VehicleID of the vehicle that has been created in replacement.
+ */
+ VehicleID GetNewVehicleID() { return this->new_id; }
+
+private:
+ VehicleID old_id; ///< The vehicle that has been replaced.
+ VehicleID new_id; ///< The vehicle that has been created in replacement.
+};
+
#endif /* SCRIPT_EVENT_TYPES_HPP */