File diff r21719:0f172a6b8939 → r21720:231348c28655
src/aircraft_cmd.cpp
Show inline comments
 
@@ -334,14 +334,14 @@ CommandCost CmdBuildAircraft(TileIndex t
 
		v->cargo_cap = e->DetermineCapacity(v, &u->cargo_cap);
 

	
 
		v->InvalidateNewGRFCacheOfChain();
 

	
 
		UpdateAircraftCache(v, true);
 

	
 
		VehicleUpdatePosition(v);
 
		VehicleUpdatePosition(u);
 
		v->UpdatePosition();
 
		u->UpdatePosition();
 

	
 
		/* Aircraft with 3 vehicles (chopper)? */
 
		if (v->subtype == AIR_HELICOPTER) {
 
			Aircraft *w = new Aircraft();
 
			w->engine_type = e->index;
 
			w->direction = DIR_N;
 
@@ -356,13 +356,13 @@ CommandCost CmdBuildAircraft(TileIndex t
 
			w->random_bits = VehicleRandomBits();
 
			/* Use rotor's air.state to store the rotor animation frame */
 
			w->state = HRS_ROTOR_STOPPED;
 
			w->UpdateDeltaXY(INVALID_DIR);
 

	
 
			u->SetNext(w);
 
			VehicleUpdatePosition(w);
 
			w->UpdatePosition();
 
		}
 
	}
 

	
 
	return CommandCost();
 
}
 

	
 
@@ -484,13 +484,13 @@ static void HelicopterTickHandler(Aircra
 
	} else {
 
		return;
 
	}
 

	
 
	u->cur_image = img;
 

	
 
	VehicleUpdatePositionAndViewport(u);
 
	u->UpdatePositionAndViewport();
 
}
 

	
 
/**
 
 * Set aircraft position.
 
 * @param v Aircraft to position.
 
 * @param x New X position.
 
@@ -500,13 +500,13 @@ static void HelicopterTickHandler(Aircra
 
void SetAircraftPosition(Aircraft *v, int x, int y, int z)
 
{
 
	v->x_pos = x;
 
	v->y_pos = y;
 
	v->z_pos = z;
 

	
 
	VehicleUpdatePosition(v);
 
	v->UpdatePosition();
 
	v->UpdateViewport(true, false);
 
	if (v->subtype == AIR_HELICOPTER) v->Next()->Next()->cur_image = GetRotorImage(v, EIT_ON_MAP);
 

	
 
	Aircraft *u = v->Next();
 

	
 
	int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE);
 
@@ -515,21 +515,21 @@ void SetAircraftPosition(Aircraft *v, in
 
	u->y_pos = y - ((v->z_pos - GetSlopePixelZ(safe_x, safe_y)) >> 3);
 

	
 
	safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
 
	u->z_pos = GetSlopePixelZ(safe_x, safe_y);
 
	u->cur_image = v->cur_image;
 

	
 
	VehicleUpdatePositionAndViewport(u);
 
	u->UpdatePositionAndViewport();
 

	
 
	u = u->Next();
 
	if (u != NULL) {
 
		u->x_pos = x;
 
		u->y_pos = y;
 
		u->z_pos = z + ROTOR_Z_OFFSET;
 

	
 
		VehicleUpdatePositionAndViewport(u);
 
		u->UpdatePositionAndViewport();
 
	}
 
}
 

	
 
/**
 
 * Handle Aircraft specific tasks when an Aircraft enters a hangar
 
 * @param *v Vehicle that enters the hangar