File diff r12233:9d0861714103 → r12234:fd1a494e7620
src/water_cmd.cpp
Show inline comments
 
@@ -661,53 +661,48 @@ void DrawShipDepotSprite(int x, int y, i
 
	const WaterDrawTileStruct *wdts = _shipdepot_display_seq[image];
 

	
 
	DrawSprite(wdts++->image, PAL_NONE, x, y);
 

	
 
	for (; wdts->delta_x != 0x80; wdts++) {
 
		Point pt = RemapCoords(wdts->delta_x, wdts->delta_y, wdts->delta_z);
 
		DrawSprite(wdts->image, COMPANY_SPRITE_COLOUR(_local_company), x + pt.x, y + pt.y);
 
	}
 
}
 

	
 

	
 
static uint GetSlopeZ_Water(TileIndex tile, uint x, uint y)
 
{
 
	uint z;
 
	Slope tileh = GetTileSlope(tile, &z);
 

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

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

	
 
static void GetAcceptedCargo_Water(TileIndex tile, AcceptedCargo ac)
 
{
 
	/* not used */
 
}
 

	
 
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_WATER_DESCRIPTION_WATER;     break;
 
				case WATER_CLASS_CANAL: td->str = STR_LANDINFO_CANAL; break;
 
				case WATER_CLASS_RIVER: td->str = STR_LANDINFO_RIVER; break;
 
				default: assert(0); break;
 
			}
 
			break;
 
		case WATER_TILE_COAST: td->str = STR_WATER_DESCRIPTION_COAST_OR_RIVERBANK; break;
 
		case WATER_TILE_LOCK : td->str = STR_LANDINFO_LOCK;           break;
 
		case WATER_TILE_DEPOT: td->str = STR_WATER_DESCRIPTION_SHIP_DEPOT;         break;
 
		default: assert(0); break;
 
	}
 

	
 
	td->owner[0] = GetTileOwner(tile);
 
}
 

	
 
static void AnimateTile_Water(TileIndex tile)
 
{
 
	/* not used */
 
}
 
@@ -1139,36 +1134,36 @@ static void ChangeTileOwner_Water(TileIn
 

	
 
	/* 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)
 
{
 
	/* Canals can't be terraformed */
 
	if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_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
 
	GetSlopeZ_Water,          // get_slope_z_proc
 
	ClearTile_Water,          // clear_tile_proc
 
	GetAcceptedCargo_Water,   // get_accepted_cargo_proc
 
	NULL,                     // get_accepted_cargo_proc
 
	GetTileDesc_Water,        // get_tile_desc_proc
 
	GetTileTrackStatus_Water, // get_tile_track_status_proc
 
	ClickTile_Water,          // click_tile_proc
 
	AnimateTile_Water,        // animate_tile_proc
 
	TileLoop_Water,           // tile_loop_clear
 
	ChangeTileOwner_Water,    // change_tile_owner_clear
 
	NULL,                     // get_produced_cargo_proc
 
	VehicleEnter_Water,       // vehicle_enter_tile_proc
 
	GetFoundation_Water,      // get_foundation_proc
 
	TerraformTile_Water,      // terraform_tile_proc
 
};