File diff r23953:ba75d2f3b530 → r23954:8e43140b9a66
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -144,50 +144,49 @@ void ConvertOldMultiheadToNew()
 
							u->SetMultiheaded();
 
							break;
 
						}
 
						if (rvi->railveh_type == RAILVEH_MULTIHEAD) u->SetMultiheaded();
 
						u->SetEngine();
 
						break;
 

	
 
					case 4: // TS_Free_Car
 
						u->subtype = 0;
 
						u->SetWagon();
 
						u->SetFreeWagon();
 
						break;
 
					default: SlErrorCorrupt("Invalid train subtype");
 
				}
 
			}
 
		}
 
	}
 
}
 

	
 

	
 
/** need to be called to load aircraft from old version */
 
void UpdateOldAircraft()
 
{
 
	/* set airport_flags to 0 for all airports just to be sure */
 
	Station *st;
 
	FOR_ALL_STATIONS(st) {
 
	for (Station *st : Station::Iterate()) {
 
		st->airport.flags = 0; // reset airport
 
	}
 

	
 
	Aircraft *a;
 
	FOR_ALL_AIRCRAFT(a) {
 
		/* airplane has another vehicle with subtype 4 (shadow), helicopter also has 3 (rotor)
 
		 * skip those */
 
		if (a->IsNormalAircraft()) {
 
			/* airplane in terminal stopped doesn't hurt anyone, so goto next */
 
			if ((a->vehstatus & VS_STOPPED) && a->state == 0) {
 
				a->state = HANGAR;
 
				continue;
 
			}
 

	
 
			AircraftLeaveHangar(a, a->direction); // make airplane visible if it was in a depot for example
 
			a->vehstatus &= ~VS_STOPPED; // make airplane moving
 
			UpdateAircraftCache(a);
 
			a->cur_speed = a->vcache.cached_max_speed; // so aircraft don't have zero speed while in air
 
			if (!a->current_order.IsType(OT_GOTO_STATION) && !a->current_order.IsType(OT_GOTO_DEPOT)) {
 
				/* reset current order so aircraft doesn't have invalid "station-only" order */
 
				a->current_order.MakeDummy();
 
			}
 
			a->state = FLYING;
 
			AircraftNextAirportPos_and_Order(a); // move it to the entry point of the airport