1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-27 06:04:25 +01:00

Add: [Script] Include number of victims in ScriptEventVehicleCrashed (#12861)

This commit is contained in:
Loïc Guilloux
2024-07-16 21:28:29 +02:00
committed by GitHub
parent eeed824329
commit d67963e616
8 changed files with 47 additions and 32 deletions

View File

@@ -17,6 +17,9 @@
*
* This version is not yet released. The following changes are not set in stone yet.
*
* API additions:
* \li AIEventVehicleCrashed::GetVictims
*
* \b 14.0
*
* API additions:

View File

@@ -17,6 +17,9 @@
*
* This version is not yet released. The following changes are not set in stone yet.
*
* API additions:
* \li GSEventVehicleCrashed::GetVictims
*
* \b 14.0
*
* API additions:

View File

@@ -38,12 +38,14 @@ public:
* @param vehicle The vehicle that crashed.
* @param crash_site Where the vehicle crashed.
* @param crash_reason The reason why the vehicle crashed.
* @param victims The number of victims caused by the crash.
*/
ScriptEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
ScriptEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason, uint victims) :
ScriptEvent(ET_VEHICLE_CRASHED),
crash_site(crash_site),
vehicle(vehicle),
crash_reason(crash_reason)
crash_reason(crash_reason),
victims(victims)
{}
#endif /* DOXYGEN_API */
@@ -72,10 +74,17 @@ public:
*/
CrashReason GetCrashReason() { return this->crash_reason; }
/**
* Get the number of victims
* @return The number of victims
*/
SQInteger GetVictims() { return this->victims; }
private:
TileIndex crash_site; ///< The location of the crash.
VehicleID vehicle; ///< The crashed vehicle.
CrashReason crash_reason; ///< The reason for crashing.
uint victims; ///< The number of victims.
};
/**