OpenTTD Source 20260206-master-g4d4e37dbf1
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
26static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlags flags)
27{
28 static constexpr Price clear_price_table[to_underlying(ClearGround::MaxSize)] = {
29 Price::ClearGrass, // Base price for clearing grass.
30 Price::ClearRough, // Base price for clearing rough land.
31 Price::ClearRocks, // Base price for clearing rocks.
32 Price::ClearFields, // Base price for clearing fields.
33 Price::ClearRough, // Unused.
34 Price::ClearRough, // Base price for clearing desert.
35 Price::ClearRough, // Unused.
36 Price::ClearRough, // Unused.
37 };
39
40 ClearGround ground = GetClearGround(tile);
41 uint8_t density = GetClearDensity(tile);
42 if (IsSnowTile(tile)) {
43 price.AddCost(_price[clear_price_table[to_underlying(ground)]]);
44 /* Add a little more for removing snow. */
45 price.AddCost(std::abs(_price[Price::ClearRough] - _price[Price::ClearGrass]));
46 } else if (ground != ClearGround::Grass || density != 0) {
47 price.AddCost(_price[clear_price_table[to_underlying(ground)]]);
48 }
49
50 if (flags.Test(DoCommandFlag::Execute)) DoClearSquare(tile);
51
52 return price;
53}
54
55void DrawClearLandTile(const TileInfo *ti, uint8_t set)
56{
57 DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh) + set * 19, PAL_NONE);
58}
59
60void DrawHillyLandTile(const TileInfo *ti)
61{
62 if (ti->tileh != SLOPE_FLAT) {
63 DrawGroundSprite(SPR_FLAT_ROUGH_LAND + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
64 } else {
65 DrawGroundSprite(_landscape_clear_sprites_rough[GB(TileHash(ti->x, ti->y), 0, 3)], PAL_NONE);
66 }
67}
68
69static void DrawClearLandFence(const TileInfo *ti)
70{
71 /* combine fences into one sprite object */
73
74 SpriteBounds bounds{{}, {TILE_SIZE, TILE_SIZE, 4}, {}};
75
76 bounds.extent.z += GetSlopeMaxPixelZ(ti->tileh);
77
78 uint fence_nw = GetFence(ti->tile, DIAGDIR_NW);
79 if (fence_nw != 0) {
80 bounds.offset.x = 0;
81 bounds.offset.y = -static_cast<int>(TILE_SIZE);
82 bounds.offset.z = GetSlopePixelZInCorner(ti->tileh, CORNER_W);
83 SpriteID sprite = _clear_land_fence_sprites[fence_nw - 1] + _fence_mod_by_tileh_nw[ti->tileh];
84 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
85 }
86
87 uint fence_ne = GetFence(ti->tile, DIAGDIR_NE);
88 if (fence_ne != 0) {
89 bounds.offset.x = -static_cast<int>(TILE_SIZE);
90 bounds.offset.y = 0;
91 bounds.offset.z = GetSlopePixelZInCorner(ti->tileh, CORNER_E);
92 SpriteID sprite = _clear_land_fence_sprites[fence_ne - 1] + _fence_mod_by_tileh_ne[ti->tileh];
93 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
94 }
95
96 uint fence_sw = GetFence(ti->tile, DIAGDIR_SW);
97 uint fence_se = GetFence(ti->tile, DIAGDIR_SE);
98
99 if (fence_sw != 0 || fence_se != 0) {
100 bounds.offset.x = 0;
101 bounds.offset.y = 0;
102 bounds.offset.z = GetSlopePixelZInCorner(ti->tileh, CORNER_S);
103
104 if (fence_sw != 0) {
105 SpriteID sprite = _clear_land_fence_sprites[fence_sw - 1] + _fence_mod_by_tileh_sw[ti->tileh];
106 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
107 }
108
109 if (fence_se != 0) {
110 SpriteID sprite = _clear_land_fence_sprites[fence_se - 1] + _fence_mod_by_tileh_se[ti->tileh];
111 AddSortableSpriteToDraw(sprite, PAL_NONE, *ti, bounds, false);
112
113 }
114 }
116}
117
118static void DrawTile_Clear(TileInfo *ti)
119{
120 if (IsSnowTile(ti->tile)) {
121 uint8_t density = GetClearDensity(ti->tile);
122 DrawGroundSprite(_clear_land_sprites_snow_desert[density] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
124 /* There 4 levels of snowy overlay rocks, each with 19 sprites. */
125 ++density;
126 DrawGroundSprite(SPR_OVERLAY_ROCKS_BASE + (density * 19) + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
127 }
128
129 DrawBridgeMiddle(ti, {});
130 return;
131 }
132
133 switch (GetClearGround(ti->tile)) {
135 DrawClearLandTile(ti, GetClearDensity(ti->tile));
136 break;
137
139 DrawHillyLandTile(ti);
140 break;
141
144 DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
146 } else {
147 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);
148 }
149 break;
150
152 DrawGroundSprite(_clear_land_sprites_farmland[GetFieldType(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
153 DrawClearLandFence(ti);
154 break;
155
157 DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
158 break;
159
160 default:
161 NOT_REACHED();
162 }
163
164 DrawBridgeMiddle(ti, {});
165}
166
167static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool)
168{
169 auto [tileh, z] = GetTilePixelSlope(tile);
170
171 return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
172}
173
174static Foundation GetFoundation_Clear(TileIndex, Slope)
175{
176 return FOUNDATION_NONE;
177}
178
179static void UpdateFences(TileIndex tile)
180{
182 bool dirty = false;
183
184 for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
185 if (GetFence(tile, dir) != 0) continue;
186 TileIndex neighbour = tile + TileOffsByDiagDir(dir);
187 if (IsTileType(neighbour, TileType::Clear) && IsClearGround(neighbour, ClearGround::Fields)) continue;
188 SetFence(tile, dir, 3);
189 dirty = true;
190 }
191
192 if (dirty) MarkTileDirtyByTile(tile);
193}
194
195
198{
199 int k = GetTileZ(tile) - GetSnowLine() + 1;
200
201 if (!IsSnowTile(tile)) {
202 /* Below the snow line, do nothing if no snow. */
203 /* At or above the snow line, make snow tile if needed. */
204 if (k >= 0) {
205 /* Snow density is started at 0 so that it can gradually reach the required density. */
206 MakeSnow(tile, 0);
208 }
209 return;
210 }
211
212 /* Update snow density. */
213 uint current_density = GetClearDensity(tile);
214 uint req_density = (k < 0) ? 0u : std::min<uint>(k, 3u);
215
216 if (current_density == req_density) {
217 /* Density at the required level. */
218 if (k >= 0) return;
219 ClearSnow(tile);
220 } else {
221 AddClearDensity(tile, current_density < req_density ? 1 : -1);
222 }
223
225}
226
232static inline bool NeighbourIsNormal(TileIndex tile)
233{
234 for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
235 TileIndex t = tile + TileOffsByDiagDir(dir);
236 if (!IsValidTile(t)) continue;
237 if (GetTropicZone(t) != TROPICZONE_DESERT) return true;
238 if (HasTileWaterClass(t) && GetWaterClass(t) == WaterClass::Sea) return true;
239 }
240 return false;
241}
242
243static void TileLoopClearDesert(TileIndex tile)
244{
245 ClearGround ground = GetClearGround(tile);
246
247 /* Current desert level - 0 if it is not desert */
248 uint current = 0;
249 if (ground == ClearGround::Desert || ground == ClearGround::Rocks) current = GetClearDensity(tile);
250
251 /* Expected desert level - 0 if it shouldn't be desert */
252 uint expected = 0;
253 if (GetTropicZone(tile) == TROPICZONE_DESERT) {
254 expected = NeighbourIsNormal(tile) ? 1 : 3;
255 }
256
257 if (current == expected) return;
258
259 if (ground == ClearGround::Rocks) {
261 } else if (expected == 0) {
263 } else {
264 /* Transition from clear to desert is not smooth (after clearing desert tile) */
266 }
267
269}
270
271static void TileLoop_Clear(TileIndex tile)
272{
273 AmbientSoundEffect(tile);
274
275 switch (_settings_game.game_creation.landscape) {
276 case LandscapeType::Tropic: TileLoopClearDesert(tile); break;
277 case LandscapeType::Arctic: TileLoopClearAlps(tile); break;
278 default: break;
279 }
280
281 if (IsSnowTile(tile)) return;
282
283 switch (GetClearGround(tile)) {
285 if (GetClearDensity(tile) == 3) return;
286
287 if (_game_mode != GM_EDITOR) {
288 if (GetClearCounter(tile) < 7) {
289 AddClearCounter(tile, 1);
290 return;
291 } else {
292 SetClearCounter(tile, 0);
293 AddClearDensity(tile, 1);
294 }
295 } else {
296 SetClearGroundDensity(tile, GB(Random(), 0, 8) > 21 ? ClearGround::Grass : ClearGround::Rough, 3);
297 }
298 break;
299
301 UpdateFences(tile);
302
303 if (_game_mode == GM_EDITOR) return;
304
305 if (GetClearCounter(tile) < 7) {
306 AddClearCounter(tile, 1);
307 return;
308 } else {
309 SetClearCounter(tile, 0);
310 }
311
312 if (GetIndustryIndexOfField(tile) == IndustryID::Invalid() && GetFieldType(tile) >= 7) {
313 /* This farmfield is no longer farmfield, so make it grass again */
315 } else {
316 uint field_type = GetFieldType(tile);
317 field_type = (field_type < 8) ? field_type + 1 : 0;
318 SetFieldType(tile, field_type);
319 }
320 break;
321
322 default:
323 return;
324 }
325
327}
328
329void GenerateClearTile()
330{
331 uint i, gi;
332 TileIndex tile;
333
334 /* add rough tiles */
335 i = Map::ScaleBySize(GB(Random(), 0, 10) + 0x400);
336 gi = Map::ScaleBySize(GB(Random(), 0, 7) + 0x80);
337
339 do {
341 tile = RandomTile();
343 } while (--i);
344
345 /* add rocky tiles */
346 i = gi;
347 do {
348 uint32_t r = Random();
349 tile = RandomTileSeed(r);
350
352 if (IsTileType(tile, TileType::Clear)) {
353 uint j = GB(r, 16, 4) + 5;
354 for (;;) {
355 TileIndex tile_new;
356
359 do {
360 if (--j == 0) goto get_out;
361 tile_new = tile + TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
362 } while (!IsTileType(tile_new, TileType::Clear));
363 tile = tile_new;
364 }
365get_out:;
366 }
367 } while (--i);
368}
369
370static TrackStatus GetTileTrackStatus_Clear(TileIndex, TransportType, uint, DiagDirection)
371{
372 return 0;
373}
374
375static void GetTileDesc_Clear(TileIndex tile, TileDesc &td)
376{
377 /* Each pair holds a normal and a snowy ClearGround description. */
378 static constexpr std::pair<StringID, StringID> clear_land_str[to_underlying(ClearGround::MaxSize)] = {
379 {STR_LAI_CLEAR_DESCRIPTION_GRASS, STR_LAI_CLEAR_DESCRIPTION_SNOWY_GRASS}, // Description for grass.
380 {STR_LAI_CLEAR_DESCRIPTION_ROUGH_LAND, STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROUGH_LAND}, // Description for rough land.
381 {STR_LAI_CLEAR_DESCRIPTION_ROCKS, STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROCKS}, // Description for rocks.
382 {STR_LAI_CLEAR_DESCRIPTION_FIELDS, STR_EMPTY}, // Description for fields.
383 {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map.
384 {STR_LAI_CLEAR_DESCRIPTION_DESERT, STR_EMPTY}, // Description for desert.
385 {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map.
386 {STR_EMPTY, STR_EMPTY}, // unused entry does not appear in the map.
387 };
388
389 if (!IsSnowTile(tile) && IsClearGround(tile, ClearGround::Grass) && GetClearDensity(tile) == 0) {
390 td.str = STR_LAI_CLEAR_DESCRIPTION_BARE_LAND;
391 } else {
392 const auto &[name, snowy_name] = clear_land_str[to_underlying(GetClearGround(tile))];
393 td.str = IsSnowTile(tile) ? snowy_name : name;
394 }
395 td.owner[0] = GetTileOwner(tile);
396}
397
398static void ChangeTileOwner_Clear(TileIndex, Owner, Owner)
399{
400 return;
401}
402
403static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlags flags, int, Slope)
404{
405 return Command<Commands::LandscapeClear>::Do(flags, tile);
406}
407
408static CommandCost CheckBuildAbove_Clear(TileIndex, DoCommandFlags, Axis, int)
409{
410 /* Can always build above clear tiles. */
411 return CommandCost();
412}
413
414extern const TileTypeProcs _tile_type_clear_procs = {
415 DrawTile_Clear,
416 GetSlopePixelZ_Clear,
417 ClearTile_Clear,
418 nullptr,
419 GetTileDesc_Clear,
420 GetTileTrackStatus_Clear,
421 nullptr,
422 nullptr,
423 TileLoop_Clear,
424 ChangeTileOwner_Clear,
425 nullptr,
426 nullptr,
427 GetFoundation_Clear,
428 TerraformTile_Clear,
429 CheckBuildAbove_Clear, // check_build_above_proc
430};
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.
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.
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:176
void AddClearCounter(Tile t, int c)
Increments the counter used to advance to the next clear density/field type.
Definition clear_map.h:125
uint GetFieldType(Tile t)
Get the field type (production stage) of the field.
Definition clear_map.h:164
void AddClearDensity(Tile t, int d)
Increment the density of a non-field clear tile.
Definition clear_map.h:88
void ClearSnow(Tile t)
Clear the snow from a tile and return it to its previous type.
Definition clear_map.h:309
bool IsClearGround(Tile t, ClearGround ct)
Set the type of clear tile.
Definition clear_map.h:64
void MakeSnow(Tile t, uint density=0)
Make a snow tile.
Definition clear_map.h:293
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:233
IndustryID GetIndustryIndexOfField(Tile t)
Get the industry (farm) that made the field.
Definition clear_map.h:188
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:252
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:137
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:151
uint GetFence(Tile t, DiagDirection side)
Is there a fence at the given border?
Definition clear_map.h:214
uint GetClearCounter(Tile t)
Get the counter used to advance to the next clear density/field type.
Definition clear_map.h:113
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:76
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.
@ 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:17
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:643
#define RandomTile()
Get a valid random tile.
Definition map_func.h:654
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Definition map_func.h:572
bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
Definition newgrf.h:213
@ 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
Foundation
Enumeration for Foundations.
Definition slope_type.h:92
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
Definition slope_type.h:93
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:330
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:154
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
TransportType
Available types of transport.
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