File diff r21719:0f172a6b8939 → r21720:231348c28655
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -438,50 +438,50 @@ void AfterLoadVehicles(bool part_of_load
 
				break;
 

	
 
			case VEH_AIRCRAFT:
 
				if (Aircraft::From(v)->IsNormalAircraft()) {
 
					v->cur_image = v->GetImage(v->direction, EIT_ON_MAP);
 

	
 
					/* The plane's shadow will have the same image as the plane */
 
					Vehicle *shadow = v->Next();
 
					shadow->cur_image = v->cur_image;
 

	
 
					/* In the case of a helicopter we will update the rotor sprites */
 
					if (v->subtype == AIR_HELICOPTER) {
 
						Vehicle *rotor = shadow->Next();
 
						rotor->cur_image = GetRotorImage(Aircraft::From(v), EIT_ON_MAP);
 
					}
 

	
 
					UpdateAircraftCache(Aircraft::From(v), true);
 
				}
 
				break;
 
			default: break;
 
		}
 

	
 
		v->UpdateDeltaXY(v->direction);
 
		v->coord.left = INVALID_COORD;
 
		VehicleUpdatePosition(v);
 
		VehicleUpdateViewport(v, false);
 
		v->UpdatePosition();
 
		v->UpdateViewport(false);
 
	}
 
}
 

	
 
bool TrainController(Train *v, Vehicle *nomove, bool reverse = true); // From train_cmd.cpp
 
void ReverseTrainDirection(Train *v);
 
void ReverseTrainSwapVeh(Train *v, int l, int r);
 

	
 
/** Fixup old train spacing. */
 
void FixupTrainLengths()
 
{
 
	/* Vehicle center was moved from 4 units behind the front to half the length
 
	 * behind the front. Move vehicles so they end up on the same spot. */
 
	Vehicle *v;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_TRAIN && v->IsPrimaryVehicle()) {
 
			/* The vehicle center is now more to the front depending on vehicle length,
 
			 * so we need to move all vehicles forward to cover the difference to the
 
			 * old center, otherwise wagon spacing in trains would be broken upon load. */
 
			for (Train *u = Train::From(v); u != NULL; u = u->Next()) {
 
				if (u->track == TRACK_BIT_DEPOT || (u->vehstatus & VS_CRASHED)) continue;
 

	
 
				Train *next = u->Next();
 

	
 
				/* Try to pull the vehicle half its length forward. */