Fix crash when setting separation mode for vehicles with no orders list.
[openttd-joker.git] / src / void_cmd.cpp
blob1adfe7e7d660559e0bc76d6917216feea1962dab
1 /* $Id: void_cmd.cpp 23160 2011-11-08 17:37:32Z yexo $ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file void_cmd.cpp Handling of void tiles. */
12 #include "stdafx.h"
13 #include "tile_cmd.h"
14 #include "command_func.h"
15 #include "viewport_func.h"
16 #include "slope_func.h"
18 #include "table/strings.h"
19 #include "table/sprites.h"
21 #include "safeguards.h"
23 static void DrawTile_Void(TileInfo *ti)
25 DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh), PALETTE_ALL_BLACK);
29 static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y)
31 return TilePixelHeight(tile);
34 static Foundation GetFoundation_Void(TileIndex tile, Slope tileh)
36 return FOUNDATION_NONE;
39 static CommandCost ClearTile_Void(TileIndex tile, DoCommandFlag flags)
41 return CommandError(STR_ERROR_OFF_EDGE_OF_MAP);
45 static void GetTileDesc_Void(TileIndex tile, TileDesc *td)
47 td->str = STR_EMPTY;
48 td->owner[0] = OWNER_NONE;
51 static void TileLoop_Void(TileIndex tile)
53 /* not used */
56 static void ChangeTileOwner_Void(TileIndex tile, Owner old_owner, Owner new_owner)
58 /* not used */
61 static TrackStatus GetTileTrackStatus_Void(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
63 return 0;
66 static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
68 return CommandError(STR_ERROR_OFF_EDGE_OF_MAP);
71 extern const TileTypeProcs _tile_type_void_procs = {
72 DrawTile_Void, // draw_tile_proc
73 GetSlopePixelZ_Void, // get_slope_z_proc
74 ClearTile_Void, // clear_tile_proc
75 nullptr, // add_accepted_cargo_proc
76 GetTileDesc_Void, // get_tile_desc_proc
77 GetTileTrackStatus_Void, // get_tile_track_status_proc
78 nullptr, // click_tile_proc
79 nullptr, // animate_tile_proc
80 TileLoop_Void, // tile_loop_proc
81 ChangeTileOwner_Void, // change_tile_owner_proc
82 nullptr, // add_produced_cargo_proc
83 nullptr, // vehicle_enter_tile_proc
84 GetFoundation_Void, // get_foundation_proc
85 TerraformTile_Void, // terraform_tile_proc