diff --git a/src/openttd.cpp b/src/openttd.cpp index e76ca6c6e3..80773343ee 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1813,5 +1813,6 @@ char *DumpGameEventFlags(GameEventFlags events, char *b, const char *last) dump('n', GEF_RELOAD_NEWGRF); dump('t', GEF_TBTR_REPLACEMENT); dump('D', GEF_DISASTER_VEH); + dump('c', GEF_TRAIN_CRASH); return b; } diff --git a/src/openttd.h b/src/openttd.h index d1d9f7c75c..07434a9460 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -93,6 +93,7 @@ enum GameEventFlags : uint32 { GEF_RELOAD_NEWGRF = 1 << 2, ///< (n) ReloadNewGRFData() has been called GEF_TBTR_REPLACEMENT = 1 << 3, ///< (t) CMD_TEMPLATE_REPLACE_VEHICLE has been called GEF_DISASTER_VEH = 1 << 4, ///< (D) A disaster vehicle exists or has been created + GEF_TRAIN_CRASH = 1 << 5, ///< (c) A train crash has occurred }; DECLARE_ENUM_AS_BIT_SET(GameEventFlags) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 5502488f94..bb088f8937 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3540,6 +3540,8 @@ uint Train::Crash(bool flooded) HideFillingPercent(&this->fill_percent_te_id); } + RegisterGameEvents(GEF_TRAIN_CRASH); + pass += this->GroundVehicleBase::Crash(flooded); this->crash_anim_pos = flooded ? 4000 : 1; // max 4440, disappear pretty fast when flooded