File diff r1900:0f789eafac2b → r1901:e806afa50723
ship_cmd.c
Show inline comments
 
@@ -855,49 +855,49 @@ void ShipsYearlyLoop(void)
 

	
 
/** Build a ship.
 
 * @param x,y tile coordinates of depot where ship is built
 
 * @param p1 ship type being built (engine)
 
 * @param p2 unused
 
 */
 
int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	int32 value;
 
	Vehicle *v;
 
	UnitID unit_num;
 
	TileIndex tile = TILE_FROM_XY(x,y);
 
	Engine *e;
 

	
 
	if (!IsEngineBuildable(p1, VEH_Ship)) return CMD_ERROR;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 

	
 
	value = EstimateShipCost(p1);
 
	if (flags & DC_QUERY_COST) return value;
 

	
 
	/* The ai_new queries the vehicle cost before building the route,
 
	 * so we must check against cheaters no sooner than now. --pasky */
 
	if (!IsTileDepotType(tile, TRANSPORT_WATER)) return CMD_ERROR;
 
	if (_map_owner[tile] != _current_player) return CMD_ERROR;
 
	if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
 

	
 
	v = AllocateVehicle();
 
	if (v == NULL || IsOrderPoolFull() ||
 
			(unit_num = GetFreeUnitNumber(VEH_Ship)) > _patches.max_ships)
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 

	
 
	if (flags & DC_EXEC) {
 
		const ShipVehicleInfo *svi = ShipVehInfo(p1);
 

	
 
		v->unitnumber = unit_num;
 

	
 
		v->owner = _current_player;
 
		v->tile = tile;
 
		x = TileX(tile) * 16 + 8;
 
		y = TileY(tile) * 16 + 8;
 
		v->x_pos = x;
 
		v->y_pos = y;
 
		v->z_pos = GetSlopeZ(x,y);
 

	
 
		v->z_height = 6;
 
		v->sprite_width = 6;
 
		v->sprite_height = 6;
 
		v->x_offs = -3;
 
		v->y_offs = -3;