Changeset - r6876:3e4bfdccc7e1
[Not reviewed]
master
0 1 0
maedhros - 17 years ago 2007-06-12 17:10:52
maedhros@openttd.org
(svn r10117) -Fix [FS#863]: When deleting the vehicles of bankrupt players, delete trains as
a whole rather than each part individually, as that leads to invalid tests on
parts that have already been deleted.
1 file changed with 24 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -355,7 +355,30 @@ void ChangeOwnershipOfPlayerItems(Player
 
					DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 
					DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
 
					DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
 
					DeleteVehicle(v);
 

	
 
					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);
 
									DeleteVehicle(u);
 
									u = next;
 
								} while (u != NULL);
 
							} break;
 

	
 
							case VEH_ROAD:
 
							case VEH_SHIP:
 
								DeleteVehicle(v);
 
								break;
 

	
 
							case VEH_AIRCRAFT:
 
								DeleteVehicleChain(v);
 
								break;
 
						}
 
					}
 
				} else {
 
					v->owner = new_player;
 
					v->group_id = DEFAULT_GROUP;
0 comments (0 inline, 0 general)