diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 5b9646170f..96231cf15c 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -186,6 +186,8 @@ Industry::~Industry() for (Station *st : this->stations_near) { st->industries_near.erase(this); } + + if (_game_mode == GM_NORMAL) RegisterGameEvents(GEF_INDUSTRY_DELETE); } /** @@ -1865,6 +1867,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0); if (!_generating_world) PopulateStationsNearby(i); + if (_game_mode == GM_NORMAL) RegisterGameEvents(GEF_INDUSTRY_CREATE); } /** diff --git a/src/openttd.cpp b/src/openttd.cpp index a407cbd555..a106cec7b6 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1837,5 +1837,7 @@ char *DumpGameEventFlags(GameEventFlags events, char *b, const char *last) dump('t', GEF_TBTR_REPLACEMENT); dump('D', GEF_DISASTER_VEH); dump('c', GEF_TRAIN_CRASH); + dump('i', GEF_INDUSTRY_CREATE); + dump('j', GEF_INDUSTRY_DELETE); return b; } diff --git a/src/openttd.h b/src/openttd.h index e4523bbe69..39a5bf2825 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -93,6 +93,8 @@ enum GameEventFlags : uint32 { 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 + GEF_INDUSTRY_CREATE = 1 << 6, ///< (i) An industry has been created (in game) + GEF_INDUSTRY_DELETE = 1 << 7, ///< (j) An industry has been deleted (in game) }; DECLARE_ENUM_AS_BIT_SET(GameEventFlags)