(svn r24986) -Change: Cleanup goals and cargo monitors of companies when they go bankrupt or are taken over.

This commit is contained in:
zuu
2013-02-10 19:49:04 +00:00
parent e27582d104
commit b1016f66ba
6 changed files with 60 additions and 9 deletions

View File

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