Add game event for train crash

This commit is contained in:
Jonathan G Rennison
2019-06-08 16:10:31 +01:00
parent 49dee941fb
commit c7a9950269
3 changed files with 4 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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