2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
/** @file void_cmd.cpp Handling of void tiles. */
|
2007-02-23 18:55:07 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2019-01-13 19:58:48 +00:00
|
|
|
#include "landscape.h"
|
2007-12-21 21:50:46 +00:00
|
|
|
#include "command_func.h"
|
2008-01-09 09:57:48 +00:00
|
|
|
#include "viewport_func.h"
|
2014-09-21 08:19:32 +00:00
|
|
|
#include "slope_func.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/strings.h"
|
|
|
|
#include "table/sprites.h"
|
|
|
|
|
2014-04-23 20:13:33 +00:00
|
|
|
#include "safeguards.h"
|
|
|
|
|
2020-02-26 21:15:42 +00:00
|
|
|
static void DrawTile_Void(TileInfo *ti, DrawTileProcParams params)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2014-09-21 08:19:32 +00:00
|
|
|
DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh), PALETTE_ALL_BLACK);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-04 11:36:10 +00:00
|
|
|
static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y)
|
2005-10-19 14:49:46 +00:00
|
|
|
{
|
2019-09-29 20:27:32 +00:00
|
|
|
/* This function may be called on tiles outside the map, don't assume
|
2019-01-13 19:58:48 +00:00
|
|
|
* that 'tile' is a valid tile index. See GetSlopePixelZOutsideMap. */
|
|
|
|
int z;
|
|
|
|
Slope tileh = GetTilePixelSlopeOutsideMap(x >> 4, y >> 4, &z);
|
|
|
|
|
|
|
|
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
static Foundation GetFoundation_Void(TileIndex tile, Slope tileh)
|
2005-10-22 06:39:32 +00:00
|
|
|
{
|
2007-07-26 16:51:10 +00:00
|
|
|
return FOUNDATION_NONE;
|
2004-08-13 18:27:33 +00:00
|
|
|
}
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
static CommandCost ClearTile_Void(TileIndex tile, DoCommandFlag flags)
|
2005-06-24 12:38:35 +00:00
|
|
|
{
|
2009-04-21 23:40:56 +00:00
|
|
|
return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
static void GetTileDesc_Void(TileIndex tile, TileDesc *td)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
td->str = STR_EMPTY;
|
2008-05-21 22:15:39 +00:00
|
|
|
td->owner[0] = OWNER_NONE;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
static void TileLoop_Void(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
/* not used */
|
|
|
|
}
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
static void ChangeTileOwner_Void(TileIndex tile, Owner old_owner, Owner new_owner)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
/* not used */
|
|
|
|
}
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
static TrackStatus GetTileTrackStatus_Void(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-04 11:36:10 +00:00
|
|
|
static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
2007-08-30 17:17:04 +00:00
|
|
|
{
|
2009-04-21 23:40:56 +00:00
|
|
|
return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP);
|
2007-08-30 17:17:04 +00:00
|
|
|
}
|
|
|
|
|
2010-08-09 06:48:52 +00:00
|
|
|
extern const TileTypeProcs _tile_type_void_procs = {
|
|
|
|
DrawTile_Void, // draw_tile_proc
|
2011-11-04 10:18:13 +00:00
|
|
|
GetSlopePixelZ_Void, // get_slope_z_proc
|
2010-08-09 06:48:52 +00:00
|
|
|
ClearTile_Void, // clear_tile_proc
|
2019-04-10 21:07:06 +00:00
|
|
|
nullptr, // add_accepted_cargo_proc
|
2010-08-09 06:48:52 +00:00
|
|
|
GetTileDesc_Void, // get_tile_desc_proc
|
|
|
|
GetTileTrackStatus_Void, // get_tile_track_status_proc
|
2019-04-10 21:07:06 +00:00
|
|
|
nullptr, // click_tile_proc
|
|
|
|
nullptr, // animate_tile_proc
|
2011-11-08 17:37:32 +00:00
|
|
|
TileLoop_Void, // tile_loop_proc
|
|
|
|
ChangeTileOwner_Void, // change_tile_owner_proc
|
2019-04-10 21:07:06 +00:00
|
|
|
nullptr, // add_produced_cargo_proc
|
|
|
|
nullptr, // vehicle_enter_tile_proc
|
2010-08-09 06:48:52 +00:00
|
|
|
GetFoundation_Void, // get_foundation_proc
|
|
|
|
TerraformTile_Void, // terraform_tile_proc
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|