38 #include "table/strings.h" 44 _tile_type_clear_procs,
45 _tile_type_rail_procs,
48 _tile_type_trees_procs,
49 _tile_type_station_procs,
50 _tile_type_water_procs,
51 _tile_type_void_procs,
52 _tile_type_industry_procs,
53 _tile_type_tunnelbridge_procs,
54 _tile_type_object_procs;
62 &_tile_type_clear_procs,
63 &_tile_type_rail_procs,
66 &_tile_type_trees_procs,
67 &_tile_type_station_procs,
68 &_tile_type_water_procs,
69 &_tile_type_void_procs,
70 &_tile_type_industry_procs,
71 &_tile_type_tunnelbridge_procs,
72 &_tile_type_object_procs,
77 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0,
78 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 0, 15, 18, 0,
124 *s = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ?
SLOPE_SW :
SLOPE_NE);
128 *s = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ?
SLOPE_SE :
SLOPE_NW);
139 default: NOT_REACHED();
172 default: NOT_REACHED();
258 z = 1 + ((x + y) >> 1);
262 z = 1 + ((x + (y ^ 0xF)) >> 1);
266 z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
270 z = 1 + (((x ^ 0xF) + y) >> 1);
279 int GetSlopePixelZ(
int x,
int y)
283 return _tile_type_procs[
GetTileType(tile)]->get_slope_z_proc(tile, x, y);
315 static const Slope corners[4][4] = {
325 if (halftile_test == corners[edge][0]) *z2 +=
TILE_HEIGHT;
326 if (halftile_test == corners[edge][1]) *z1 +=
TILE_HEIGHT;
328 if ((tileh & corners[edge][0]) != 0) *z1 +=
TILE_HEIGHT;
329 if ((tileh & corners[edge][1]) != 0) *z2 +=
TILE_HEIGHT;
347 if (z != NULL) *z += z_inc;
352 bool HasFoundationNW(
TileIndex tile,
Slope slope_here, uint z_here)
356 int z_W_here = z_here;
357 int z_N_here = z_here;
365 return (z_N_here > z_N) || (z_W_here > z_W);
369 bool HasFoundationNE(
TileIndex tile,
Slope slope_here, uint z_here)
373 int z_E_here = z_here;
374 int z_N_here = z_here;
382 return (z_N_here > z_N) || (z_E_here > z_E);
397 uint sprite_block = 0;
407 if (!HasFoundationNW(ti->
tile, slope, z)) sprite_block += 1;
408 if (!HasFoundationNE(ti->
tile, slope, z)) sprite_block += 2;
411 SpriteID leveled_base = (sprite_block == 0 ? (int)SPR_FOUNDATION_BASE : (SPR_SLOPES_VIRTUAL_BASE + sprite_block * SPR_TRKFOUND_BLOCK_SIZE));
412 SpriteID inclined_base = SPR_SLOPES_VIRTUAL_BASE + SPR_SLOPES_INCLINED_OFFSET + sprite_block * SPR_TRKFOUND_BLOCK_SIZE;
444 int x_bb = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? 8 : 0);
445 int y_bb = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? 8 : 0);
458 int x_bb = (((halftile_corner == CORNER_W) || (halftile_corner == CORNER_S)) ? 8 : 0);
459 int y_bb = (((halftile_corner == CORNER_S) || (halftile_corner == CORNER_E)) ? 8 : 0);
522 _tile_type_procs[
GetTileType(tile)]->change_tile_owner_proc(tile, old_owner, new_owner);
537 return _snow_line != NULL;
547 _snow_line = CallocT<SnowLine>(1);
549 memcpy(_snow_line->
table, table,
sizeof(_snow_line->
table));
615 bool do_clear =
false;
647 if (do_clear) DoClearSquare(tile);
669 bool had_success =
false;
672 int limit = (c == NULL ? INT32_MAX :
GB(c->
clear_limit, 16, 16));
689 if (ret.
GetCost() > 0 && money < 0) {
690 _additional_cash_required = ret.
GetCost();
706 if (ret.
GetCost() != 0 && --limit <= 0)
break;
712 return had_success ? cost : last_error;
729 static const uint32 feedbacks[] = {
730 0xD8F, 0x1296, 0x2496, 0x4357, 0x8679, 0x1030E, 0x206CD, 0x403FE, 0x807B8, 0x1004B2, 0x2006A8, 0x4004B2, 0x800B87
744 _tile_type_procs[
GetTileType(0)]->tile_loop_proc(0);
749 _tile_type_procs[
GetTileType(tile)]->tile_loop_proc(tile);
752 tile = (tile >> 1) ^ (-(int32)(tile & 1) & feedback);
755 _cur_tileloop_tile = tile;
758 void InitializeLandscape()
775 for (uint x = 0; x < sizex; x++)
MakeVoid(sizex * y + x);
778 static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 };
779 static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 };
781 static void GenerateTerrain(
int type, uint flag)
785 const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845,
ST_MAPGEN);
786 if (templ == NULL)
usererror(
"Map generator sprites could not be loaded");
791 if (x < 2 || y < 2)
return;
794 uint w = templ->
width;
799 const byte *p = templ->
data;
801 if ((flag & 4) != 0) {
807 default: NOT_REACHED();
809 if (xw + yw >
MapSize() - bias)
return;
813 if (yw < xw + bias)
return;
817 if (xw + yw <
MapSize() + bias)
return;
821 if (xw < yw + bias)
return;
826 if (x + w >=
MapMaxX() - 1)
return;
827 if (y + h >=
MapMaxY() - 1)
return;
832 default: NOT_REACHED();
837 for (uint w_cur = w; w_cur != 0; --w_cur) {
850 for (uint h_cur = h; h_cur != 0; --h_cur) {
864 for (uint w_cur = w; w_cur != 0; --w_cur) {
878 for (uint h_cur = h; h_cur != 0; --h_cur) {
892 static void CreateDesertOrRainForest()
903 for (data = _make_desert_or_rainforest_data;
904 data !=
endof(_make_desert_or_rainforest_data); ++data) {
908 if (data ==
endof(_make_desert_or_rainforest_data)) {
913 for (uint i = 0; i != 256; i++) {
924 for (data = _make_desert_or_rainforest_data;
925 data !=
endof(_make_desert_or_rainforest_data); ++data) {
929 if (data ==
endof(_make_desert_or_rainforest_data)) {
951 for (
int dx = -1; dx <= 1; dx++) {
952 for (
int dy = -1; dy <= 1; dy++) {
958 if (num < 4)
return false;
961 for (
int dx = -16; dx <= 16; dx++) {
962 for (
int dy = -16; dy <= 16; dy++) {
979 uint height = *(uint*)user_data;
1009 return heightEnd <= heightBegin &&
1013 ((slopeEnd == slopeBegin && heightEnd < heightBegin) || slopeEnd ==
SLOPE_FLAT || slopeBegin ==
SLOPE_FLAT);
1037 TileIndex tile = current->path.node.tile;
1039 aystar->num_neighbours = 0;
1043 aystar->neighbours[aystar->num_neighbours].tile = t2;
1045 aystar->num_neighbours++;
1053 for (
PathNode *path = ¤t->path; path != NULL; path = path->
parent) {
1085 finder.CalculateG = River_CalculateG;
1086 finder.CalculateH = River_CalculateH;
1087 finder.GetNeighbours = River_GetNeighbours;
1088 finder.EndNodeCheck = River_EndNodeCheck;
1089 finder.FoundEndNode = River_FoundEndNode;
1090 finder.user_target = &end;
1110 #define SET_MARK(x) marks.insert(x) 1111 #define IS_MARKED(x) (marks.find(x) != marks.end()) 1116 std::set<TileIndex> marks;
1120 std::list<TileIndex> queue;
1121 queue.push_back(begin);
1127 end = queue.front();
1141 queue.push_back(t2);
1144 }
while (!queue.empty());
1149 }
else if (count > 32) {
1153 std::set<TileIndex>::const_iterator cit = marks.begin();
1163 lakeCenter != begin &&
1190 if (amount == 0)
return;
1195 for (; wells != 0; wells--) {
1197 for (
int tries = 0; tries < 128; tries++) {
1205 for (uint i = 0; i != 256; i++) {
1214 enum GenLandscapeSteps {
1216 GLS_TERRAGENESIS = 5,
1238 uint32 r = Random();
1241 GenerateTerrain(2, 0);
1244 uint flag =
GB(r, 7, 2) | 4;
1246 GenerateTerrain(4, flag);
1252 uint32 r = Random();
1255 GenerateTerrain(0, 0);
1258 uint flag =
GB(r, 7, 2) | 4;
1260 GenerateTerrain(0, flag);
1266 GenerateTerrain(3, flag);
1272 uint32 r = Random();
1276 for (; i != 0; --i) {
1289 ConvertGroundTilesIntoWaterTiles();
1298 void OnTick_Trees();
1299 void OnTick_Station();
1300 void OnTick_Industry();
1305 void CallLandscapeTick()
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
don't allow building on structures
static bool IsHalftileSlope(Slope s)
Checks for non-continuous slope on halftile foundations.
uint ApplyFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
void Init(Hash_HashProc hash, uint num_buckets)
Initialize an AyStar.
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
Change the owner of a tile.
static void Swap(T &a, T &b)
Type safe swap operation.
the north corner of the tile is raised
Corner
Enumeration of tile corners.
#define RandomTile()
Get a valid random tile.
TileIndex first_tile
The first tile being cleared, which then causes the whole object to be cleared.
uint8 max_heightlevel
maximum allowed heightlevel
static void ClearBridgeMiddle(TileIndex t)
Removes bridges from the given, that is bridges along the X and Y axis.
static uint MapSizeX()
Get the size of the map along the X.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]
Height of the snow line each day of the year.
byte river_route_random
the amount of randomicity for the route finding
static TropicZone GetTropicZone(TileIndex tile)
Get the tropic zone.
static const SpriteID SPR_HALFTILE_FOUNDATION_BASE
Halftile foundations.
static uint MapSizeY()
Get the size of the map along the Y.
do not only remove the object on the tile, but also clear any water left on it
Tile information, used while rendering the tile.
south and east corner are raised
static void MakeVoid(TileIndex t)
Make a nice void tile ;)
the west corner of the tile is raised
byte landscape
the landscape we're currently in
byte LowestSnowLine()
Get the lowest possible snow line height, either variable or static.
byte land_generator
the landscape generator
static const uint RIVER_HASH_SIZE
The number of bits the hash for river finding should have.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
void LoadHeightmap(DetailedFileType dft, const char *filename)
Load a heightmap from file and change the map in his current dimensions to a landscape representing t...
byte amount_of_rivers
the amount of rivers
Money GetAvailableMoneyForCommand()
static Corner GetHalftileFoundationCorner(Foundation f)
Returns the halftile corner of a halftile-foundation.
Functions related to dates.
static WaterClass GetWaterClass(TileIndex t)
Get the water class at a tile.
const byte _slope_to_sprite_offset[32]
landscape slope => sprite
static uint MapLogX()
Logarithm of the map size along the X side.
north and south corner are raised
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
Data structure describing a sprite.
Slope tileh
Slope of the tile.
static uint ScaleByMapSize(uint n)
Scales the given value by the map size, where the given value is for a 256 by 256 map...
static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY
Value for custom sea level in difficulty settings.
FileToSaveLoad _file_to_saveload
File to save or load in the openttd loop.
void FixSlopes()
This function takes care of the fact that land in OpenTTD can never differ more than 1 in height...
void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS])
Set a variable snow line, as loaded from a newgrf file.
bool IsSnowLineSet()
Has a snow line table already been loaded.
CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clear a big piece of landscape.
static uint TileX(TileIndex tile)
Get the X component of a tile.
Not an end-tile, or wrong direction.
static bool IsFoundation(Foundation f)
Tests for FOUNDATION_NONE.
Generate a newgame from a heightmap.
Tile description for the 'land area information' tool.
DifficultySettings difficulty
settings related to the difficulty
the east corner of the tile is raised
Northeast, upper right on your monitor.
void OnTick_Companies()
Called every tick for updating some company info.
static const uint SNOW_LINE_MONTHS
Number of months in the snow line table.
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
void OnTick_LinkGraph()
Spawn or join a link graph job or compress a link graph if any link graph is due to do so...
static bool FindSpring(TileIndex tile, void *user_data)
Find the spring of a river.
static Corner GetHalftileSlopeCorner(Slope s)
Returns the leveled halftile of a halftile slope.
Functions related to world/map generation.
Money GetCost() const
The costs as made up to this moment.
north, west and south corner are raised
static uint MapLogY()
Logarithm of the map size along the y side.
south and west corner are raised
Common return value for all commands.
static Slope SlopeWithOneCornerRaised(Corner corner)
Returns the slope with a specific corner raised.
static T max(const T a, const T b)
Returns the maximum of two values.
static bool IsInclinedSlope(Slope s)
Tests if a specific slope is an inclined slope.
static bool IsClearGround(TileIndex t, ClearGround ct)
Set the type of clear tile.
EffectVehicle * CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular location.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
static Slope GetFoundationPixelSlope(TileIndex tile, int *z)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation, the function returns the same as GetTilePixelSlope.
Functions for the Perlin noise enhanced map generator.
static const uint TILE_SIZE
Tile size in world coordinates.
static uint32 RandomRange(uint32 limit)
Pick a random number between 0 and limit - 1, inclusive.
This file has the header for AyStar.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
static Corner GetHighestSlopeCorner(Slope s)
Returns the highest corner of a slope (one corner raised or a steep slope).
north and east corner are raised
company bankrupts, skip money check, skip vehicle on tile check in some cases
Functions related to (drawing on) viewports.
Pseudo random number generator.
static void SetTileHeight(TileIndex tile, uint height)
Sets the height of a tile.
bool freeform_edges
allow terraforming the tiles at the map edges
GetTileTrackStatusProc * get_tile_track_status_proc
Get available tracks and status of a tile.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
static Slope SteepSlope(Corner corner)
Returns a specific steep slope.
east, north and west corner are raised
AyStar search algorithm struct.
indicates the slope is steep
static bool FlowsDown(TileIndex begin, TileIndex end)
Check whether a river at begin could (logically) flow down to end.
uint x
X position of the tile in unit coordinates.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Functions/types related to saving and loading games.
Foundation
Enumeration for Foundations.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a give tiletype.
bool RiverModifyDesertZone(TileIndex tile, void *data)
Callback to create non-desert around a river tile.
Iterator to iterate over a diagonal area of the map.
TileIndex tile
Tile index.
static uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
west, south and east corner are raised
void AddStartNode(AyStarNode *start_node, uint g)
Adds a node from where to start an algorithm.
byte min_river_length
the minimum river length
static void CreateRivers()
Actually (try to) create some rivers.
DoCommandFlag
List of flags for a command.
void ClearSnowLine()
Clear the variable snow line table and free the memory.
Special sprite for the map generator.
byte snow_line_height
the configured snow line height
Keeps track of removed objects during execution/testruns of commands.
const TileTypeProcs _tile_type_road_procs
Tile callback functions for road tiles.
void DeleteAnimatedTile(TileIndex tile)
Removes the given tile from the animated tile table.
Definition of base types and functions in a cross-platform compatible way.
Data structure to convert between Date and triplet (year, month, and day).
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
void CDECL usererror(const char *s,...)
Error handling for fatal user errors.
A number of safeguards to prevent using unsafe methods.
Table used to generate deserts and/or rain forests.
bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data)
Function performing a search around a center tile and going outward, thus in circle.
uint32 clear_limit
Amount of tiles we can (still) clear (times 65536).
Structure describing the height of the snow line each day of the year.
uint y
Y position of the tile in unit coordinates.
static uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
The tile has an along Y-axis inclined foundation.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
don't allow building on water
void GenerateTerrainPerlin()
The main new land generator using Perlin noise.
TerraGenesis Perlin landscape generator.
Base class for tile iterators.
static Slope SlopeWithThreeCornersRaised(Corner corner)
Returns the slope with all except one corner raised.
byte lowest_value
Lowest snow line of the year.
DiagDirection
Enumeration for diagonal directions.
#define lengthof(x)
Return the length of an fixed size array.
bit mask containing all 'simple' slopes
PauseModeByte _pause_mode
The current pause mode.
static uint TileHash(uint x, uint y)
Calculate a hash value from a tile position.
static bool IsWaterTile(TileIndex t)
Is it a water tile with plain water?
static T min(const T a, const T b)
Returns the minimum of two values.
static void MakeRiver(TileIndex t, uint8 random_bits)
Make a river tile.
The tile has a steep slope. The lowest corner is raised by a foundation and the upper halftile is lev...
ClearedObjectArea * FindClearedObject(TileIndex tile)
Find the entry in _cleared_object_areas which occupies a certain tile.
PathNode * parent
The parent of this item.
Functions to cache sprites in memory.
bool Failed() const
Did this command fail?
CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clear a piece of landscape.
a steep slope falling to east (from west)
east and west corner are raised
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
static Slope RemoveHalftileSlope(Slope s)
Removes a halftile slope from a slope.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
uint16 height
Height of the sprite.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
TileIndex TileAddWrap(TileIndex tile, int addx, int addy)
This function checks if we add addx/addy to tile, if we do wrap around the edges. ...
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset)
Mark a tile given by its index dirty for repaint.
uint16 _tick_counter
Ever incrementing (and sometimes wrapping) tick counter for setting off various events.
A pair-construct of a TileIndexDiff.
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
byte quantity_sea_lakes
the amount of seas/lakes
execute the given command
static int GetSlopeMaxPixelZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height) ...
Slope GetFoundationSlope(TileIndex tile, int *z)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation, the function returns the same as GetTileSlope.
byte highest_value
Highest snow line of the year.
uint16 width
Width of the sprite.
void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2)
Determine the Z height of the corners of a specific tile edge.
Functions related to companies.
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
static uint MapSize()
Get the size of the map.
bool _generating_world
Whether we are generating the map or not.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
Declarations for savegames operations.
Types related to the landscape.
CompanyByte _current_company
Company currently doing an action.
Set of callback functions for performing tile operations of a given tile type.
Functions related to creating heightmaps from files.
uint32 TileIndex
The index/ID of a Tile.
Map accessors for 'clear' tiles.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
Map accessors for void tiles.
static Corner GetRailFoundationCorner(Foundation f)
Returns the track corner of a special rail foundation.
north and west corner are raised
static uint TileY(TileIndex tile)
Get the Y component of a tile.
int Main()
This is the function you call to run AyStar.
static void MakeClear(TileIndex t, ClearGround g, uint density)
Make a clear tile.
The tile has an along X-axis inclined foundation.
TransportType
Available types of transport.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
static bool IsLeveledFoundation(Foundation f)
Tests if the foundation is a leveled foundation.
Slope
Enumeration for the slope-type.
static uint River_Hash(uint tile, uint dir)
Simple hash function for river tiles to be used by AyStar.
const TileTypeProcs *const _tile_type_procs[16]
Tile callback functions for each type of tile.
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
#define endof(x)
Get the end element of an fixed size array.
Functions related to OTTD's landscape.
void OffsetGroundSprite(int x, int y)
Called when a foundation has been drawn for the current tile.
Functions related to commands.
char name[MAX_PATH]
Name of the file.
byte terrain_type
the mountainousness of the landscape
a steep slope falling to south (from north)
Iterator to iterate over a tile area (rectangle) of the map.
byte GetSnowLine()
Get the current snow line, either variable or static.
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
The tile has a steep slope. The lowest corner is raised by a foundation to allow building railroad on...
ConstructionSettings construction
construction of things in-game
static const uint SNOW_LINE_DAYS
Number of days in each month in the snow line table.
static bool IsCoastTile(TileIndex t)
Is it a coast tile.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
int GetSlopeZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
static const uint MAX_MAP_SIZE_BITS
Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS.
static bool FlowRiver(TileIndex spring, TileIndex begin)
Try to flow the river down from a given begin.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static bool HasTileWaterClass(TileIndex t)
Checks whether the tile has an waterclass associated.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
void RunTileLoop()
Gradually iterate over all tiles on the map, calling their TileLoopProcs once every 256 ticks...
static Slope HalftileSlope(Slope s, Corner corner)
Adds a halftile slope to a slope.
GameCreationSettings game_creation
settings used during the creation of a game (map)
void Free()
This function frees the memory it allocated.
A tile without any structures, i.e. grass, rocks, farm fields etc.
static bool IsInclinedFoundation(Foundation f)
Tests if the foundation is an inclined foundation.
DetailedFileType detail_ftype
Concrete file type (PNG, BMP, old save, etc).
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Owner
Enum for all companies/owners.
Flag for an invalid trackdir.
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
Set the total of a stage of the world generation.
a steep slope falling to west (from east)
Functions related to water (management)
static bool IsNonContinuousFoundation(Foundation f)
Tests if a foundation is a non-continuous foundation, i.e.
static bool IsTileOnWater(TileIndex t)
Tests if the tile was built on water.
static TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC diff)
Add a TileIndexDiffC to a TileIndex and returns the new one.
void GenerateLandscape(byte mode)
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
Increases the current stage of the world generation with one.
Date _date
Current date in days (day counter)
static bool MakeLake(TileIndex tile, void *user_data)
Make a connected lake; fill all tiles in the circular tile search that are connected.
void ConvertDateToYMD(Date date, YearMonthDay *ymd)
Converts a Date to a Year, Month & Day.
the south corner of the tile is raised
static SnowLine * _snow_line
Description of the snow line throughout the year.
static void BuildRiver(TileIndex begin, TileIndex end)
Actually build the river between the begin and end tiles using AyStar.
static bool IsSpecialRailFoundation(Foundation f)
Tests if a foundation is a special rail foundation for single horizontal/vertical track...
This file contains all sprite-related enums and defines.
Functions related to effect vehicles.
south, east and north corner are raised
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
static Corner OppositeCorner(Corner corner)
Returns the opposite corner.
a steep slope falling to north (from south)
const TileTypeProcs _tile_type_town_procs
Tile callback functions for a town.
static void SetTropicZone(TileIndex tile, TropicZone type)
Set the tropic zone.
static const uint MIN_MAP_SIZE_BITS
Minimal and maximal map width and height.
byte HighestSnowLine()
Get the highest possible snow line height, either variable or static.
static void MemSetT(T *ptr, byte value, size_t num=1)
Type-safe version of memset().
GetTileDescProc * get_tile_desc_proc
Get a description of a tile (for the 'land area information' tool)