File diff r18260:9616113792ef → r18261:0aa61ca7490f
src/water_cmd.cpp
Show inline comments
 
@@ -773,49 +773,49 @@ static void DrawTile_Water(TileInfo *ti)
 
			DrawShoreTile(ti->tileh);
 
			DrawBridgeMiddle(ti);
 
			break;
 
		}
 

	
 
		case WATER_TILE_LOCK:
 
			DrawWaterLock(ti);
 
			break;
 

	
 
		case WATER_TILE_DEPOT:
 
			DrawWaterDepot(ti);
 
			break;
 
	}
 
}
 

	
 
void DrawShipDepotSprite(int x, int y, Axis axis, DepotPart part)
 
{
 
	const DrawTileSprites &dts = _shipdepot_display_data[axis][part];
 

	
 
	DrawSprite(dts.ground.sprite, dts.ground.pal, x, y);
 
	DrawOrigTileSeqInGUI(x, y, &dts, COMPANY_SPRITE_COLOUR(_local_company));
 
}
 

	
 

	
 
static uint GetSlopePixelZ_Water(TileIndex tile, uint x, uint y)
 
static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y)
 
{
 
	int z;
 
	Slope tileh = GetTilePixelSlope(tile, &z);
 

	
 
	return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
 
}
 

	
 
static Foundation GetFoundation_Water(TileIndex tile, Slope tileh)
 
{
 
	return FOUNDATION_NONE;
 
}
 

	
 
static void GetTileDesc_Water(TileIndex tile, TileDesc *td)
 
{
 
	switch (GetWaterTileType(tile)) {
 
		case WATER_TILE_CLEAR:
 
			switch (GetWaterClass(tile)) {
 
				case WATER_CLASS_SEA:   td->str = STR_LAI_WATER_DESCRIPTION_WATER; break;
 
				case WATER_CLASS_CANAL: td->str = STR_LAI_WATER_DESCRIPTION_CANAL; break;
 
				case WATER_CLASS_RIVER: td->str = STR_LAI_WATER_DESCRIPTION_RIVER; break;
 
				default: NOT_REACHED(); break;
 
			}
 
			break;
 
		case WATER_TILE_COAST: td->str = STR_LAI_WATER_DESCRIPTION_COAST_OR_RIVERBANK; break;
 
@@ -1181,49 +1181,49 @@ static bool ClickTile_Water(TileIndex ti
 
}
 

	
 
static void ChangeTileOwner_Water(TileIndex tile, Owner old_owner, Owner new_owner)
 
{
 
	if (!IsTileOwner(tile, old_owner)) return;
 

	
 
	if (new_owner != INVALID_OWNER) {
 
		SetTileOwner(tile, new_owner);
 
		return;
 
	}
 

	
 
	/* Remove depot */
 
	if (IsShipDepot(tile)) DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
 

	
 
	/* Set owner of canals and locks ... and also canal under dock there was before.
 
	 * Check if the new owner after removing depot isn't OWNER_WATER. */
 
	if (IsTileOwner(tile, old_owner)) SetTileOwner(tile, OWNER_NONE);
 
}
 

	
 
static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *v, TileIndex tile, int x, int y)
 
{
 
	return VETSB_CONTINUE;
 
}
 

	
 
static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
 
static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
 
{
 
	/* Canals can't be terraformed */
 
	if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
 

	
 
	return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
}
 

	
 

	
 
extern const TileTypeProcs _tile_type_water_procs = {
 
	DrawTile_Water,           // draw_tile_proc
 
	GetSlopePixelZ_Water,     // get_slope_z_proc
 
	ClearTile_Water,          // clear_tile_proc
 
	NULL,                     // add_accepted_cargo_proc
 
	GetTileDesc_Water,        // get_tile_desc_proc
 
	GetTileTrackStatus_Water, // get_tile_track_status_proc
 
	ClickTile_Water,          // click_tile_proc
 
	NULL,                     // animate_tile_proc
 
	TileLoop_Water,           // tile_loop_clear
 
	ChangeTileOwner_Water,    // change_tile_owner_clear
 
	NULL,                     // add_produced_cargo_proc
 
	VehicleEnter_Water,       // vehicle_enter_tile_proc
 
	GetFoundation_Water,      // get_foundation_proc
 
	TerraformTile_Water,      // terraform_tile_proc
 
};