diff options
author | rubidium <rubidium@openttd.org> | 2008-12-26 20:45:02 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-26 20:45:02 +0000 |
commit | f18043ee21218dc9ea26ce41b1294c5212ac363c (patch) | |
tree | 8f057180fb9ab731f9c1950f45a7d957bf7d4ae0 /src/economy.cpp | |
parent | 73ca72922c64db43f16b4283548ccf30aca3e59a (diff) | |
download | openttd-f18043ee21218dc9ea26ce41b1294c5212ac363c.tar.xz |
(svn r14747) -Codechange: remove DeleteVehicleChain in favour of the vehicle destructor as that was already doing the same for a few vehicle types.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index cccbf0b93..ccd0cc2b6 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -383,35 +383,13 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner) } FOR_ALL_VEHICLES(v) { - if (v->owner == old_owner && IsInsideMM(v->type, VEH_TRAIN, VEH_AIRCRAFT + 1)) { + if (v->owner == old_owner && IsCompanyBuildableVehicleType(v->type)) { if (new_owner == INVALID_OWNER) { DeleteWindowById(WC_VEHICLE_VIEW, v->index); DeleteWindowById(WC_VEHICLE_DETAILS, v->index); DeleteWindowById(WC_VEHICLE_ORDERS, v->index); - if (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && IsFreeWagon(v))) { - switch (v->type) { - default: NOT_REACHED(); - - case VEH_TRAIN: { - Vehicle *u = v; - do { - Vehicle *next = GetNextVehicle(u); - delete u; - u = next; - } while (u != NULL); - } break; - - case VEH_ROAD: - case VEH_SHIP: - delete v; - break; - - case VEH_AIRCRAFT: - DeleteVehicleChain(v); - break; - } - } + if (v->Previous() == NULL) delete v; } else { v->owner = new_owner; v->colormap = PAL_NONE; |