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