Codefix: Documentation comment in IndustryDirectoryWindow (#13059)
[openttd-github.git] / src / void_cmd.cpp
blob5e35a1f883750b663626459a84e9e8003176f993
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file void_cmd.cpp Handling of void tiles. */
10 #include "stdafx.h"
11 #include "landscape.h"
12 #include "command_func.h"
13 #include "viewport_func.h"
14 #include "slope_func.h"
15 #include "water.h"
17 #include "table/strings.h"
18 #include "table/sprites.h"
20 #include "safeguards.h"
22 static void DrawTile_Void(TileInfo *ti)
24 DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh), PALETTE_ALL_BLACK);
28 static int GetSlopePixelZ_Void(TileIndex, uint x, uint y, bool)
30 /* This function may be called on tiles outside the map, don't assume
31 * that 'tile' is a valid tile index. See GetSlopePixelZOutsideMap. */
32 auto [tileh, z] = GetTilePixelSlopeOutsideMap(x >> 4, y >> 4);
34 return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
37 static Foundation GetFoundation_Void(TileIndex, Slope)
39 return FOUNDATION_NONE;
42 static CommandCost ClearTile_Void(TileIndex, DoCommandFlag)
44 return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP);
48 static void GetTileDesc_Void(TileIndex, TileDesc *td)
50 td->str = STR_EMPTY;
51 td->owner[0] = OWNER_NONE;
54 static void TileLoop_Void(TileIndex tile)
56 /* Floods adjacent edge tile to prevent maps without water. */
57 TileLoop_Water(tile);
60 static void ChangeTileOwner_Void(TileIndex, Owner, Owner)
62 /* not used */
65 static TrackStatus GetTileTrackStatus_Void(TileIndex, TransportType, uint, DiagDirection)
67 return 0;
70 static CommandCost TerraformTile_Void(TileIndex, DoCommandFlag, int, Slope)
72 return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP);
75 extern const TileTypeProcs _tile_type_void_procs = {
76 DrawTile_Void, // draw_tile_proc
77 GetSlopePixelZ_Void, // get_slope_z_proc
78 ClearTile_Void, // clear_tile_proc
79 nullptr, // add_accepted_cargo_proc
80 GetTileDesc_Void, // get_tile_desc_proc
81 GetTileTrackStatus_Void, // get_tile_track_status_proc
82 nullptr, // click_tile_proc
83 nullptr, // animate_tile_proc
84 TileLoop_Void, // tile_loop_proc
85 ChangeTileOwner_Void, // change_tile_owner_proc
86 nullptr, // add_produced_cargo_proc
87 nullptr, // vehicle_enter_tile_proc
88 GetFoundation_Void, // get_foundation_proc
89 TerraformTile_Void, // terraform_tile_proc