diff options
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index f1b5c9666..39cb8ddaa 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -45,6 +45,7 @@ #include "water.h" #include "game/game.hpp" #include "cargomonitor.h" +#include "goal_base.h" #include "table/strings.h" #include "table/pricebase.h" @@ -508,6 +509,15 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner) if (si->owner == old_owner) si->owner = new_owner == INVALID_OWNER ? OWNER_NONE : new_owner; } + /* Remove Game Script created Goals and CargoMonitors. */ + Goal *g; + FOR_ALL_GOALS(g) { + if (g->company == old_owner) delete g; + } + + ClearCargoPickupMonitoring(old_owner); + ClearCargoDeliveryMonitoring(old_owner); + /* Change colour of existing windows */ if (new_owner != INVALID_OWNER) ChangeWindowOwner(old_owner, new_owner); |