|
|
|
@ -50,6 +50,7 @@
|
|
|
|
|
#include "goal_base.h"
|
|
|
|
|
#include "story_base.h"
|
|
|
|
|
#include "linkgraph/refresh.h"
|
|
|
|
|
#include "tbtr_template_vehicle.h"
|
|
|
|
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
|
|
#include "table/pricebase.h"
|
|
|
|
@ -485,6 +486,27 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
|
|
|
|
|
if (new_owner != INVALID_OWNER) GroupStatistics::UpdateAutoreplace(new_owner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Change ownership of template vehicles */
|
|
|
|
|
if (new_owner == INVALID_OWNER) {
|
|
|
|
|
TemplateVehicle *tv;
|
|
|
|
|
FOR_ALL_TEMPLATES(tv) {
|
|
|
|
|
if (tv->owner == old_owner) {
|
|
|
|
|
TemplateReplacement *tr;
|
|
|
|
|
FOR_ALL_TEMPLATE_REPLACEMENTS(tr) {
|
|
|
|
|
if (tr->Template() == tv->index) {
|
|
|
|
|
delete tr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete tv;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
TemplateVehicle *tv;
|
|
|
|
|
FOR_ALL_TEMPLATES(tv) {
|
|
|
|
|
if (tv->owner == old_owner) tv->owner = new_owner;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Change ownership of tiles */
|
|
|
|
|
{
|
|
|
|
|
TileIndex tile = 0;
|
|
|
|
|