OpenTTD Source 20260311-master-g511d3794ce
clear_cmd.cpp
Go to the documentation of this file.
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#include "stdafx.h"
11#include "clear_map.h"
12#include "command_func.h"
13#include "landscape.h"
14#include "genworld.h"
15#include "viewport_func.h"
16#include "core/random_func.hpp"
17#include "newgrf_generic.h"
18#include "landscape_cmd.h"
19
20#include "table/strings.h"
21#include "table/sprites.h"
22#include "table/clear_land.h"
23
24#include "safeguards.h"
25
27static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlags flags)
28{
29 static constexpr Price clear_price_table[to_underlying(ClearGround::MaxSize)] = {
30 Price::ClearGrass, // Base price for clearing grass.
31 Price::ClearRough, // Base price for clearing rough land.
32 Price::ClearRocks, // Base price for clearing rocks.
33 Price::ClearFields, // Base price for clearing fields.
34 Price::ClearRough, // Unused.
35 Price::ClearRough, // Base price for clearing desert.
36 Price::ClearRough, // Unused.
37 Price::ClearRough, // Unused.
38 };
40
41 ClearGround ground = GetClearGround(tile);
42 uint8_t density = GetClearDensity(tile);
43 if (IsSnowTile(tile)) {
44 price.AddCost(_price[clear_price_table[to_underlying(ground)]]);
45 /* Add a little more for removing snow. */
47 } else if (ground != ClearGround::Grass || density != 0) {
48 price.AddCost(_price[clear_price_table[to_underlying(ground)]]);
49 }
50
51 if (flags.Test(DoCommandFlag::Execute)) DoClearSquare(tile);
52
53 return price;
54}
55
56void DrawClearLandTile(const TileInfo *ti, uint8_t set)
57{
58 DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh) + set * 19, PAL_NONE);
59}
60
61void DrawHillyLandTile(const TileInfo *ti)
62{
63 if (ti->tileh != SLOPE_FLAT) {
64 DrawGroundSprite(SPR_FLAT_ROUGH_LAND + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
65 } else {
66 DrawGroundSprite(_landscape_clear_sprites_rough[GB(TileHash(ti->x, ti->y), 0, 3)], PAL_NONE);
67 }
68}
69
70static void DrawClearLandFence(const TileInfo *ti)
71{
72 /* combine fences into one sprite object */
74
75 SpriteBounds bounds{{}, {TILE_SIZE, TILE_SIZE, 4}, {}};
76
77 bounds.extent.z += GetSlopeMaxPixelZ(ti->tileh);
78
79 uint fence_nw = GetFence(ti->tile, DIAGDIR_NW);
80 if (fence_nw != 0) {
81 bounds.offset.x = 0;
82 bounds.offset.y = -static_cast<int>(TILE_SIZE);
83 bounds.offset.z = GetSlopePixelZInCorner(ti->tileh, CORNER_W);
84 SpriteID sprite = _clear_land_fence_sprites[fence_nw - 1] + _fence_mod_by_tileh_nw[ti->tileh];
85 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
86 }
87
88 uint fence_ne = GetFence(ti->tile, DIAGDIR_NE);
89 if (fence_ne != 0) {
90 bounds.offset.x = -static_cast<int>(TILE_SIZE);
91 bounds.offset.y = 0;
92 bounds.offset.z = GetSlopePixelZInCorner(ti->tileh, CORNER_E);
93 SpriteID sprite = _clear_land_fence_sprites[fence_ne - 1] + _fence_mod_by_tileh_ne[ti->tileh];
94 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
95 }
96
97 uint fence_sw = GetFence(ti->tile, DIAGDIR_SW);
98 uint fence_se = GetFence(ti->tile, DIAGDIR_SE);
99
100 if (fence_sw != 0 || fence_se != 0) {
101 bounds.offset.x = 0;
102 bounds.offset.y = 0;
103 bounds.offset.z = GetSlopePixelZInCorner(ti->tileh, CORNER_S);
104
105 if (fence_sw != 0) {
106 SpriteID sprite = _clear_land_fence_sprites[fence_sw - 1] + _fence_mod_by_tileh_sw[ti->tileh];
107 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
108 }
109
110 if (fence_se != 0) {
111 SpriteID sprite = _clear_land_fence_sprites[fence_se - 1] + _fence_mod_by_tileh_se[ti->tileh];
112 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
113
114 }
115 }
117}
118
120static void DrawTile_Clear(TileInfo *ti)
121{
122 if (IsSnowTile(ti->tile)) {
123 uint8_t density = GetClearDensity(ti->tile);
124 DrawGroundSprite(_clear_land_sprites_snow_desert[density] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
126 /* There 4 levels of snowy overlay rocks, each with 19 sprites. */
127 ++density;
128 DrawGroundSprite(SPR_OVERLAY_ROCKS_BASE + (density * 19) + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
129 }
130
131 DrawBridgeMiddle(ti, {});
132 return;
133 }
134
135 switch (GetClearGround(ti->tile)) {
137 DrawClearLandTile(ti, GetClearDensity(ti->tile));
138 break;
139
141 DrawHillyLandTile(ti);
142 break;
143
146 DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
148 } else {
149 DrawGroundSprite((HasGrfMiscBit(GrfMiscBit::SecondRockyTileSet) && (TileHash(ti->x, ti->y) & 1) ? SPR_FLAT_ROCKY_LAND_2 : SPR_FLAT_ROCKY_LAND_1) + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
150 }
151 break;
152
154 DrawGroundSprite(_clear_land_sprites_farmland[GetFieldType(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
155 DrawClearLandFence(ti);
156 break;
157
159 DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
160 break;
161
162 default:
163 NOT_REACHED();
164 }
165
166 DrawBridgeMiddle(ti, {});
167}
168
170static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, [[maybe_unused]] bool ground_vehicle)
171{
172 auto [tileh, z] = GetTilePixelSlope(tile);
173
174 return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
175}
176
177static void UpdateFences(TileIndex tile)
178{
180 bool dirty = false;
181
182 for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
183 if (GetFence(tile, dir) != 0) continue;
184 TileIndex neighbour = tile + TileOffsByDiagDir(dir);
185 if (IsTileType(neighbour, TileType::Clear) && IsClearGround(neighbour, ClearGround::Fields)) continue;
186 SetFence(tile, dir, 3);
187 dirty = true;
188 }
189
190 if (dirty) MarkTileDirtyByTile(tile);
191}
192
193
199{
200 int k = GetTileZ(tile) - GetSnowLine() + 1;
201
202 if (!IsSnowTile(tile)) {
203 /* Below the snow line, do nothing if no snow. */
204 /* At or above the snow line, make snow tile if needed. */
205 if (k >= 0) {
206 /* Snow density is started at 0 so that it can gradually reach the required density. */
207 MakeSnow(tile, 0);
209 }
210 return;
211 }
212
213 /* Update snow density. */
214 uint current_density = GetClearDensity(tile);
215 uint req_density = (k < 0) ? 0u : std::min<uint>(k, 3u);
216
217 if (current_density == req_density) {
218 /* Density at the required level. */
219 if (k >= 0) return;
220 ClearSnow(tile);
221 } else {
222 AddClearDensity(tile, current_density < req_density ? 1 : -1);
223 }
224
226}
227
233static inline bool NeighbourIsNormal(TileIndex tile)
234{
235 for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
236 TileIndex t = tile + TileOffsByDiagDir(dir);
237 if (!IsValidTile(t)) continue;
238 if (GetTropicZone(t) != TROPICZONE_DESERT) return true;
239 if (HasTileWaterClass(t) && GetWaterClass(t) == WaterClass::Sea) return true;
240 }
241 return false;
242}
243
244static void TileLoopClearDesert(TileIndex tile)
245{
246 ClearGround ground = GetClearGround(tile);
247
248 /* Current desert level - 0 if it is not desert */
249 uint current = 0;
250 if (ground == ClearGround::Desert || ground == ClearGround::Rocks) current = GetClearDensity(tile);
251
252 /* Expected desert level - 0 if it shouldn't be desert */
253 uint expected = 0;
254 if (GetTropicZone(tile) == TROPICZONE_DESERT) {
255 expected = NeighbourIsNormal(tile) ? 1 : 3;
256 }
257
258 if (current == expected) return;
259
260 if (ground == ClearGround::Rocks) {
262 } else if (expected == 0) {
264 } else {
265 /* Transition from clear to desert is not smooth (after clearing desert tile) */
267 }
268
270}
271
273static void TileLoop_Clear(TileIndex tile)
274{
275 AmbientSoundEffect(tile);
276
277 switch (_settings_game.game_creation.landscape) {
278 case LandscapeType::Tropic: TileLoopClearDesert(tile); break;
279 case LandscapeType::Arctic: TileLoopClearAlps(tile); break;
280 default: break;
281 }
282
283 if (IsSnowTile(tile)) return;
284
285 switch (GetClearGround(tile)) {
287 if (GetClearDensity(tile) == 3) return;
288
289 if (_game_mode != GM_EDITOR) {
290 if (GetClearCounter(tile) < 7) {
291 AddClearCounter(tile, 1);
292 return;
293 } else {
294 SetClearCounter(tile, 0);
295 AddClearDensity(tile, 1);
296 }
297 } else {
298 SetClearGroundDensity(tile, GB(Random(), 0, 8) > 21 ? ClearGround::Grass : ClearGround::Rough, 3);
299 }
300 break;
301
303 UpdateFences(tile);
304
305 if (_game_mode == GM_EDITOR) return;
306
307 if (GetClearCounter(tile) < 7) {
308 AddClearCounter(tile, 1);
309 return;
310 } else {
311 SetClearCounter(tile, 0);
312 }
313
314 if (GetIndustryIndexOfField(tile) == IndustryID::Invalid() && GetFieldType(tile) >= 7) {
315 /* This farmfield is no longer farmfield, so make it grass again */
317 } else {
318 uint field_type = GetFieldType(tile);
319 field_type = (field_type < 8) ? field_type + 1 : 0;
320 SetFieldType(tile, field_type);
321 }
322 break;
323
324 default:
325 return;
326 }
327
329}
330
331void GenerateClearTile()
332{
333 uint i, gi;
334 TileIndex tile;
335
336 /* add rough tiles */
337 i = Map::ScaleBySize(GB(Random(), 0, 10) + 0x400);
338 gi = Map::ScaleBySize(GB(Random(), 0, 7) + 0x80);
339
341 do {
343 tile = RandomTile();
345 } while (--i);
346
347 /* add rocky tiles */
348 i = gi;
349 do {
350 uint32_t r = Random();
351 tile = RandomTileSeed(r);
352
354 if (IsTileType(tile, TileType::Clear)) {
355 uint j = GB(r, 16, 4) + 5;
356 for (;;) {
357 TileIndex tile_new;
358
361 do {
362 if (--j == 0) goto get_out;
363 tile_new = tile + TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
364 } while (!IsTileType(tile_new, TileType::Clear));
365 tile = tile_new;
366 }
367get_out:;
368 }
369 } while (--i);
370}
371
374{
375 /* Each pair holds a normal and a snowy ClearGround description. */
376 static constexpr std::pair<StringID, StringID> clear_land_str[to_underlying(ClearGround::MaxSize)] = {
377 {STR_LAI_CLEAR_DESCRIPTION_GRASS, STR_LAI_CLEAR_DESCRIPTION_SNOWY_GRASS}, // Description for grass.
378 {STR_LAI_CLEAR_DESCRIPTION_ROUGH_LAND, STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROUGH_LAND}, // Description for rough land.
379 {STR_LAI_CLEAR_DESCRIPTION_ROCKS, STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROCKS}, // Description for rocks.
380 {STR_LAI_CLEAR_DESCRIPTION_FIELDS, STR_EMPTY}, // Description for fields.
381 {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map.
382 {STR_LAI_CLEAR_DESCRIPTION_DESERT, STR_EMPTY}, // Description for desert.
383 {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map.
384 {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map.
385 };
386
387 if (!IsSnowTile(tile) && IsClearGround(tile, ClearGround::Grass) && GetClearDensity(tile) == 0) {
388 td.str = STR_LAI_CLEAR_DESCRIPTION_BARE_LAND;
389 } else {
390 const auto &[name, snowy_name] = clear_land_str[to_underlying(GetClearGround(tile))];
391 td.str = IsSnowTile(tile) ? snowy_name : name;
392 }
393 td.owner[0] = GetTileOwner(tile);
394}
395
398 .draw_tile_proc = DrawTile_Clear,
399 .get_slope_pixel_z_proc = GetSlopePixelZ_Clear,
400 .clear_tile_proc = ClearTile_Clear,
401 .get_tile_desc_proc = GetTileDesc_Clear,
402 .tile_loop_proc = TileLoop_Clear,
403 .terraform_tile_proc = [](TileIndex tile, DoCommandFlags flags, int, Slope) { return Command<Commands::LandscapeClear>::Do(flags, tile); },
404 .check_build_above_proc = [](TileIndex, DoCommandFlags, Axis, int) { return CommandCost(); }, // Can always build above clear tiles
405};
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
void DrawBridgeMiddle(const TileInfo *ti, BridgePillarFlags blocked_pillars)
Draw the middle bits of a bridge.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Common return value for all commands.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlags flags)
Tile callback function signature for clearing a tile.
Definition clear_cmd.cpp:27
static void GetTileDesc_Clear(TileIndex tile, TileDesc &td)
Tile callback function signature for obtaining a tile description.
static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool ground_vehicle)
Tile callback function signature for obtaining the world Z coordinate of a given point of a tile.
static bool NeighbourIsNormal(TileIndex tile)
Tests if at least one surrounding tile is non-desert.
static void TileLoopClearAlps(TileIndex tile)
Convert to or from snowy tiles.
static void TileLoop_Clear(TileIndex tile)
Tile callback function signature for running periodic tile updates.
static void DrawTile_Clear(TileInfo *ti)
Tile callback function signature for drawing a tile and its contents to the screen.
const TileTypeProcs _tile_type_clear_procs
TileTypeProcs definitions for TileType::Clear tiles.
Tables with sprites for clear land and fences.
Map accessors for 'clear' tiles.
void SetFieldType(Tile t, uint f)
Set the field type (production stage) of the field.
Definition clear_map.h:177
void AddClearCounter(Tile t, int c)
Increments the counter used to advance to the next clear density/field type.
Definition clear_map.h:126
uint GetFieldType(Tile t)
Get the field type (production stage) of the field.
Definition clear_map.h:165
void AddClearDensity(Tile t, int d)
Increment the density of a non-field clear tile.
Definition clear_map.h:89
void ClearSnow(Tile t)
Clear the snow from a tile and return it to its previous type.
Definition clear_map.h:310
bool IsClearGround(Tile t, ClearGround ct)
Set the type of clear tile.
Definition clear_map.h:65
void MakeSnow(Tile t, uint density=0)
Make a snow tile.
Definition clear_map.h:294
void SetFence(Tile t, DiagDirection side, uint h)
Sets the type of fence (and whether there is one) for the given border.
Definition clear_map.h:234
IndustryID GetIndustryIndexOfField(Tile t)
Get the industry (farm) that made the field.
Definition clear_map.h:189
ClearGround
Ground types.
Definition clear_map.h:21
@ Desert
Desert with transition (1,3).
Definition clear_map.h:26
@ MaxSize
The maximum possible number of clear ground types to be stored in map.
Definition clear_map.h:29
@ Rocks
Rocks with snow transition (0-3).
Definition clear_map.h:24
@ Fields
Farm fields (3).
Definition clear_map.h:25
@ Grass
Plain grass with dirt transition (0-3).
Definition clear_map.h:22
@ Rough
Rough mounds (3).
Definition clear_map.h:23
void MakeClear(Tile t, ClearGround g, uint density)
Make a clear tile.
Definition clear_map.h:253
ClearGround GetClearGround(Tile t)
Get the type of clear tile.
Definition clear_map.h:52
void SetClearCounter(Tile t, uint c)
Sets the counter used to advance to the next clear density/field type.
Definition clear_map.h:138
void SetClearGroundDensity(Tile t, ClearGround type, uint density)
Sets ground type and density in one go, also sets the counter to 0.
Definition clear_map.h:152
uint GetFence(Tile t, DiagDirection side)
Is there a fence at the given border?
Definition clear_map.h:215
uint GetClearCounter(Tile t)
Get the counter used to advance to the next clear density/field type.
Definition clear_map.h:114
bool IsSnowTile(Tile t)
Test if a tile is covered with snow.
Definition clear_map.h:40
uint GetClearDensity(Tile t)
Get the density of a non-field clear tile.
Definition clear_map.h:77
Functions related to commands.
@ Execute
execute the given command
Axis
Allow incrementing of DiagDirDiff variables.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ DIAGDIR_NW
Northwest.
@ DIAGDIR_SE
Southeast.
@ DIAGDIR_END
Used for iterations.
@ DIAGDIR_BEGIN
Used for iterations.
@ DIAGDIR_SW
Southwest.
Prices _price
Prices and also the fractional part.
Definition economy.cpp:106
@ EXPENSES_CONSTRUCTION
Construction costs.
Price
Enumeration of all base prices for use with Prices.
@ ClearRough
Price for destroying rough land.
@ ClearRocks
Price for destroying rocks.
@ ClearFields
Price for destroying fields.
@ ClearGrass
Price for destroying grass.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
Definition enum_type.hpp:21
Functions related to world/map generation.
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
Increases the current stage of the world generation with one.
@ GWP_ROUGH_ROCKY
Make rough and rocky areas.
Definition genworld.h:63
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
Set the total of a stage of the world generation.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:17
uint8_t GetSnowLine()
Get the current snow line, either variable or static.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
Functions related to OTTD's landscape.
int GetSlopePixelZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
Definition landscape.h:55
Command definitions related to landscape (slopes etc.).
@ Arctic
Landscape with snow levels.
@ Tropic
Landscape with distinct rainforests and deserts,.
TileIndex RandomTileSeed(uint32_t r)
Get a random tile out of a given seed.
Definition map_func.h:645
#define RandomTile()
Get a valid random tile.
Definition map_func.h:656
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Definition map_func.h:574
bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
Definition newgrf.h:217
@ SecondRockyTileSet
Enable using the second rocky tile set.
Definition newgrf.h:66
Functions related to generic callbacks.
void AmbientSoundEffect(TileIndex tile)
Play an ambient sound effect for an empty tile.
Pseudo random number generator.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
Definition slope_func.h:415
static constexpr int GetSlopeMaxPixelZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height).
Definition slope_func.h:173
Slope
Enumeration for the slope-type.
Definition slope_type.h:47
@ SLOPE_FLAT
a flat tile
Definition slope_type.h:48
This file contains all sprite-related enums and defines.
static constexpr SpriteID SPR_OVERLAY_ROCKS_BASE
Overlay rocks sprites.
Definition sprites.h:321
Definition of base types and functions in a cross-platform compatible way.
T x
X coordinate.
T y
Y coordinate.
T z
Z coordinate.
static uint ScaleBySize(uint n)
Scales the given value by the map size, where the given value is for a 256 by 256 map.
Definition map_func.h:331
Coord3D< int8_t > offset
Relative position of sprite from bounding box.
Definition sprite.h:21
Coord3D< uint8_t > extent
Size of bounding box.
Definition sprite.h:20
Tile description for the 'land area information' tool.
Definition tile_cmd.h:38
StringID str
Description of the tile.
Definition tile_cmd.h:39
std::array< Owner, 4 > owner
Name of the owner(s).
Definition tile_cmd.h:41
Tile information, used while rendering the tile.
Definition tile_cmd.h:32
Slope tileh
Slope of the tile.
Definition tile_cmd.h:33
TileIndex tile
Tile index.
Definition tile_cmd.h:34
Set of callback functions for performing tile operations of a given tile type.
Definition tile_cmd.h:212
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
Definition tile_map.cpp:115
static bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Definition tile_map.h:150
uint TileHash(uint x, uint y)
Calculate a hash value from a tile position.
Definition tile_map.h:324
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
Definition tile_map.h:178
std::tuple< Slope, int > GetTilePixelSlope(TileIndex tile)
Return the slope of a given tile.
Definition tile_map.h:289
bool IsValidTile(Tile tile)
Checks if a tile is valid.
Definition tile_map.h:161
TropicZone GetTropicZone(Tile tile)
Get the tropic zone.
Definition tile_map.h:238
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Definition tile_type.h:92
@ TROPICZONE_DESERT
Tile is desert.
Definition tile_type.h:83
static constexpr uint TILE_SIZE
Tile size in world coordinates.
Definition tile_type.h:15
@ Clear
A tile without any structures, i.e. grass, rocks, farm fields etc.
Definition tile_type.h:49
void StartSpriteCombine()
Starts a block of sprites, which are "combined" into a single bounding box.
Definition viewport.cpp:759
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int z, const SpriteBounds &bounds, bool transparent, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
Definition viewport.cpp:658
void EndSpriteCombine()
Terminates a block of sprites started by StartSpriteCombine.
Definition viewport.cpp:769
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
Definition viewport.cpp:579
Functions related to (drawing on) viewports.
@ Sea
Sea.
Definition water_map.h:40
bool HasTileWaterClass(Tile t)
Checks whether the tile has an waterclass associated.
Definition water_map.h:103
WaterClass GetWaterClass(Tile t)
Get the water class at a tile.
Definition water_map.h:114