diff --git a/src/citymania/cm_event.hpp b/src/citymania/cm_event.hpp index e615726b13..98558760fc 100644 --- a/src/citymania/cm_event.hpp +++ b/src/citymania/cm_event.hpp @@ -19,6 +19,9 @@ struct Town; namespace citymania { +template +void Emit(const T &event); + namespace event { struct NewMonth {}; diff --git a/src/citymania/cm_main.cpp b/src/citymania/cm_main.cpp index 39d6604c4a..9a71fa3920 100644 --- a/src/citymania/cm_main.cpp +++ b/src/citymania/cm_main.cpp @@ -16,5 +16,28 @@ void SwitchToMode(SwitchMode new_mode) { if (new_mode != SM_SAVE_GAME) ResetGame(); } +template +void Emit(const T &event) { + _game->events.emit(event); +} + +template void Emit(const event::NewMonth &); +template void Emit(const event::TownBuilt &); +template void Emit(const event::TownGrowthSucceeded &); +template void Emit(const event::TownGrowthFailed &); +template void Emit(const event::TownCachesRebuilt &); +template void Emit(const event::HouseRebuilt &); +template void Emit(const event::HouseBuilt &); +template void Emit(const event::HouseCleared &); +template void Emit(const event::HouseDestroyed &); +template void Emit(const event::HouseCompleted &); +template void Emit(const event::CompanyEvent &); +template void Emit(const event::CargoDeliveredToIndustry &); +template void Emit(const event::CargoDeliveredToUnknown &); +template void Emit(const event::CargoAccepted &); +template void Emit(const event::CompanyMoneyChanged &); +template void Emit(const event::CompanyLoanChanged &); +template void Emit(const event::CompanyBalanceChanged &); +// template void Emit(const event:: &); } // namespace citymania \ No newline at end of file diff --git a/src/citymania/cm_main.hpp b/src/citymania/cm_main.hpp index d32a676fbc..142e6f960f 100644 --- a/src/citymania/cm_main.hpp +++ b/src/citymania/cm_main.hpp @@ -11,11 +11,6 @@ extern up _game; void ResetGame(); void SwitchToMode(SwitchMode new_mode); -template -void Emit(const T &event) { - _game->events.emit(event); -} - } // namespace citymania #endif diff --git a/src/economy.cpp b/src/economy.cpp index 56cb986b95..bbfb611203 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -60,7 +60,7 @@ #include "table/strings.h" #include "table/pricebase.h" -#include "citymania/cm_main.hpp" +#include "citymania/cm_event.hpp" #include "safeguards.h" diff --git a/src/saveload/town_sl.cpp b/src/saveload/town_sl.cpp index 2b0091cd54..cc567ecb67 100644 --- a/src/saveload/town_sl.cpp +++ b/src/saveload/town_sl.cpp @@ -20,6 +20,7 @@ #include "../strings_func.h" #include "../misc/history_func.hpp" +#include "../citymania/cm_event.hpp" #include "../citymania/cm_main.hpp" #include "../citymania/cm_saveload.hpp" diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index f4adf8bb3a..19f9b7e698 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -63,7 +63,7 @@ #include "table/strings.h" #include "table/town_land.h" -#include "citymania/cm_main.hpp" +#include "citymania/cm_event.hpp" #include "safeguards.h"