#include "tile_type.h"
#include "map_type.h"
#include "direction_func.h"
Go to the source code of this file.
Defines | |
#define | TILE_MASK(x) ((x) & _map_tile_mask) |
'Wraps' the given tile to it is within the map. | |
#define | TILE_ADD(x, y) ((x) + (y)) |
Adds to tiles together. | |
#define | TILE_ADDXY(tile, x, y) TILE_ADD(tile, TileDiffXY(x, y)) |
Adds a given offset to a tile. | |
#define | BEGIN_TILE_LOOP(var, w, h, tile) |
Starts a loop which iterates to a square of tiles. | |
#define | END_TILE_LOOP(var, w, h, tile) |
Ends the square-loop used before. | |
#define | RandomTile() RandomTileSeed(Random()) |
Get a valid random tile. | |
Typedefs | |
typedef int32 | TileIndexDiff |
An offset value between to tiles. | |
typedef bool | TestTileOnSearchProc (TileIndex tile, void *user_data) |
A callback function type for searching tiles. | |
Functions | |
void | AllocateMap (uint size_x, uint size_y) |
Allocate a new map with the given size. | |
static uint | MapLogX () |
Logarithm of the map size along the X side. | |
static uint | MapLogY () |
Logarithm of the map size along the y side. | |
static uint | MapSizeX () |
Get the size of the map along the X. | |
static uint | MapSizeY () |
Get the size of the map along the Y. | |
static uint | MapSize () |
Get the size of the map. | |
static uint | MapMaxX () |
Gets the maximum X coordinate within the map, including MP_VOID. | |
static uint | MapMaxY () |
Gets the maximum Y coordinate within the map, including MP_VOID. | |
uint | ScaleByMapSize (uint) |
Scales relative to the number of tiles. | |
uint | ScaleByMapSize1D (uint) |
Scale relative to the circumference of the map. | |
static TileIndex | TileXY (uint x, uint y) |
Returns the TileIndex of a coordinate. | |
static TileIndexDiff | TileDiffXY (int x, int y) |
Calculates an offset for the given coordinate(-offset). | |
static TileIndex | TileVirtXY (uint x, uint y) |
static uint | TileX (TileIndex tile) |
Get the X component of a tile. | |
static uint | TileY (TileIndex tile) |
Get the Y component of a tile. | |
static TileIndexDiff | ToTileIndexDiff (TileIndexDiffC tidc) |
Return the offset between to tiles from a TileIndexDiffC struct. | |
TileIndex | TileAddWrap (TileIndex tile, int addx, int addy) |
Adds an offset to a tile and check if we are still on the map. | |
static TileIndexDiffC | TileIndexDiffCByDiagDir (DiagDirection dir) |
Returns the TileIndexDiffC offset from a DiagDirection. | |
static TileIndexDiffC | TileIndexDiffCByDir (Direction dir) |
Returns the TileIndexDiffC offset from a Direction. | |
static TileIndex | AddTileIndexDiffCWrap (TileIndex tile, TileIndexDiffC diff) |
Add a TileIndexDiffC to a TileIndex and returns the new one. | |
static TileIndexDiffC | TileIndexToTileIndexDiffC (TileIndex tile_a, TileIndex tile_b) |
Returns the diff between two tiles. | |
uint | DistanceManhattan (TileIndex, TileIndex) |
also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads) | |
uint | DistanceSquare (TileIndex, TileIndex) |
euclidian- or L2-Norm squared | |
uint | DistanceMax (TileIndex, TileIndex) |
also known as L-Infinity-Norm | |
uint | DistanceMaxPlusManhattan (TileIndex, TileIndex) |
Max + Manhattan. | |
uint | DistanceFromEdge (TileIndex) |
shortest distance from any edge of the map | |
static TileIndexDiff | TileOffsByDiagDir (DiagDirection dir) |
Convert a DiagDirection to a TileIndexDiff. | |
static TileIndexDiff | TileOffsByDir (Direction dir) |
Convert a Direction to a TileIndexDiff. | |
static TileIndex | TileAddByDiagDir (TileIndex tile, DiagDirection dir) |
Adds a DiagDir to a tile. | |
bool | CircularTileSearch (TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data) |
Searches for some cirumstances of a tile around a given tile with a helper function. | |
bool | CircularTileSearch (TileIndex *tile, uint radius, uint w, uint h, TestTileOnSearchProc proc, void *user_data) |
Searches for some cirumstances of a tile around a given rectangle with a helper function. | |
static TileIndex | RandomTileSeed (uint32 r) |
Get a random tile out of a given seed. | |
Variables | |
uint | _map_tile_mask |
_map_size - 1 (to mask the mapsize) | |
Tile * | _m |
Pointer to the tile-array. | |
TileExtended * | _me |
Pointer to the extended tile-array. |
Definition in file map_func.h.
#define BEGIN_TILE_LOOP | ( | var, | |||
w, | |||||
h, | |||||
tile | ) |
Value:
{ \ int h_cur = h; \ uint var = tile; \ do { \ int w_cur = w; \ do {
This macro starts 2 nested loops which iterates over a square of tiles.
var | The name of the variable which contains the current tile | |
w | The width (x-width) of the square | |
h | The heigth (y-width) of the square | |
tile | The start tile of the square |
Definition at line 320 of file map_func.h.
Referenced by AITileList::AddRectangle(), AITileList_IndustryAccepting::AITileList_IndustryAccepting(), AITileList_IndustryProducing::AITileList_IndustryProducing(), AITileList_StationType::AITileList_StationType(), CheckFlatLandBelow(), CheckIfCanLevelIndustryPlatform(), CmdBuildAirport(), CmdBuildCanal(), CmdLevelLand(), CmdRemoveFromRailroadStation(), CommonRaiseLowerBigLand(), DeallocateSpecFromStation(), FindStationsNearby(), FloodVehicles(), GenerateDesertArea(), GenerateRockyArea(), AIIndustry::GetDockLocation(), AIIndustry::GetHeliportLocation(), AITileList::RemoveRectangle(), and StationRect::ScanForStationTiles().
#define END_TILE_LOOP | ( | var, | |||
w, | |||||
h, | |||||
tile | ) |
Value:
} while (++var, --w_cur != 0); \ } while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \ }
Definition at line 332 of file map_func.h.
Referenced by AITileList::AddRectangle(), AITileList_IndustryAccepting::AITileList_IndustryAccepting(), AITileList_IndustryProducing::AITileList_IndustryProducing(), AITileList_StationType::AITileList_StationType(), CheckFlatLandBelow(), CheckIfCanLevelIndustryPlatform(), CmdBuildAirport(), CmdBuildCanal(), CmdLevelLand(), CmdRemoveFromRailroadStation(), CommonRaiseLowerBigLand(), DeallocateSpecFromStation(), FindStationsNearby(), FloodVehicles(), GenerateDesertArea(), GenerateRockyArea(), AIIndustry::GetDockLocation(), AIIndustry::GetHeliportLocation(), AITileList::RemoveRectangle(), and StationRect::ScanForStationTiles().
#define RandomTile | ( | ) | RandomTileSeed(Random()) |
Get a valid random tile.
Definition at line 412 of file map_func.h.
Referenced by CmdBuildIndustry(), DisasterTick_Big_Ufo(), DisasterTick_Ufo(), MaybeNewIndustry(), PlaceInitialIndustry(), and PlaceMoreTrees().
#define TILE_ADD | ( | x, | |||
y | ) | ((x) + (y)) |
Adds to tiles together.
x | One tile | |
y | An other tile to add |
Definition at line 217 of file map_func.h.
Referenced by CalcHeightdiff(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), ChooseShipTrack(), CircularTileSearch(), FindStationsNearby(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), GrowTown(), IsNeighborRoadTile(), NPFSaveTargetData(), SetRailwayStationPlatformReservation(), and TileAddByDiagDir().
#define TILE_ADDXY | ( | tile, | |||
x, | |||||
y | ) | TILE_ADD(tile, TileDiffXY(x, y)) |
Adds a given offset to a tile.
tile | The tile to add an offset on it | |
x | The x offset to add to the tile | |
y | The y offset to add to the tile |
Definition at line 231 of file map_func.h.
Referenced by CheckAllowRemoveRoad(), FindStationsNearby(), FloodVehicles(), and MakeTownHouseBigger().
#define TILE_MASK | ( | x | ) | ((x) & _map_tile_mask) |
'Wraps' the given tile to it is within the map.
It does this by masking the 'high' bits of.
x | the tile to 'wrap' |
Definition at line 20 of file map_func.h.
Referenced by DisasterTick_Big_Ufo(), and RandomTileSeed().
typedef bool TestTileOnSearchProc(TileIndex tile, void *user_data) |
A callback function type for searching tiles.
tile | The tile to test | |
user_data | additional data for the callback function to use |
Definition at line 384 of file map_func.h.
typedef int32 TileIndexDiff |
An offset value between to tiles.
This value is used fro the difference between to tiles. It can be added to a tileindex to get the resulting tileindex of the start tile applied with this saved difference.
Definition at line 133 of file map_func.h.
static TileIndex AddTileIndexDiffCWrap | ( | TileIndex | tile, | |
TileIndexDiffC | diff | |||
) | [inline, static] |
Add a TileIndexDiffC to a TileIndex and returns the new one.
Returns tile + the diff given in diff. If the result tile would end up outside of the map, INVALID_TILE is returned instead.
tile | The base tile to add the offset on | |
diff | The offset to add on the tile |
Definition at line 276 of file map_func.h.
References INVALID_TILE, MapMaxX(), MapMaxY(), TileX(), TileXY(), TileY(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by TileLoop_Water().
void AllocateMap | ( | uint | size_x, | |
uint | size_y | |||
) |
Allocate a new map with the given size.
(Re)allocates a map with the given dimension
size_x | the width of the map along the NE/SW edge | |
size_y | the 'height' of the map along the SE/NW edge |
Definition at line 33 of file map.cpp.
References _map_log_x, _map_log_y, _map_size, _map_size_x, _map_size_y, _map_tile_mask, error, and FindFirstBit().
bool CircularTileSearch | ( | TileIndex * | tile, | |
uint | radius, | |||
uint | w, | |||
uint | h, | |||
TestTileOnSearchProc | proc, | |||
void * | user_data | |||
) |
Searches for some cirumstances of a tile around a given rectangle with a helper function.
Generalized circular search allowing for rectangles and a hole. Function performing a search around a center rectangle and going outward. The center rectangle is left out from the search. To do a rectangular search without a hole, set either h or w to zero. Every tile will be tested by means of the callback function proc, which will determine if yes or no the given tile meets criteria of search.
tile | to start the search from. Upon completion, it will return the tile matching the search | |
radius,: | How many tiles to search outwards. Note: This is a radius and thus different from the size parameter of the other CircularTileSearch function, which is a diameter. | |
proc,: | callback testing function pointer. | |
user_data | to be passed to the callback function. Depends on the implementation |
radius > 0
< Is the tile within the map?
< Is the callback successful?
< then stop the search
Definition at line 298 of file map.cpp.
References DIAGDIR_END, DIAGDIR_NE, DIR_W, INVALID_TILE, MapMaxX(), MapMaxY(), TileX(), TileXY(), TileY(), TileIndexDiffC::x, and TileIndexDiffC::y.
bool CircularTileSearch | ( | TileIndex * | tile, | |
uint | size, | |||
TestTileOnSearchProc | proc, | |||
void * | user_data | |||
) |
Searches for some cirumstances of a tile around a given tile with a helper function.
Function performing a search around a center tile and going outward, thus in circle. Although it really is a square search... Every tile will be tested by means of the callback function proc, which will determine if yes or no the given tile meets criteria of search.
tile | to start the search from. Upon completion, it will return the tile matching the search | |
size,: | number of tiles per side of the desired search area | |
proc,: | callback testing function pointer. | |
user_data | to be passed to the callback function. Depends on the implementation |
size > 0
Definition at line 263 of file map.cpp.
References CircularTileSearch(), DIR_W, TILE_ADD, and TileOffsByDir().
Referenced by ChopLumberMillTrees(), CircularTileSearch(), DeliverGoodsToIndustry(), FindStationsNearby(), GetDistanceFromNearbyHouse(), and TownActionBuildStatue().
uint DistanceFromEdge | ( | TileIndex | tile | ) |
shortest distance from any edge of the map
Param the minimum distance to an edge
tile | the tile to get the distance from |
Definition at line 239 of file map.cpp.
References MapSizeX(), MapSizeY(), min(), TileX(), and TileY().
Referenced by CmdBuildTown(), AIMap::DistanceFromEdge(), and GrayscaleToMapHeights().
also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
Gets the Manhattan distance between the two given tiles. The Manhattan distance is the sum of the delta of both the X and Y component. Also known as L1-Norm
t0 | the start tile | |
t1 | the end tile |
Definition at line 179 of file map.cpp.
References Delta(), TileX(), and TileY().
Referenced by AirportGetNearestTown(), AIMarine::AreWaterTilesConnected(), AIRail::BuildRail(), CalcRaildirsDrawstyle(), AIRoad::CanBuildConnectedRoadPartsHere(), DeliverGoods(), DeliverGoodsToIndustry(), AIMap::DistanceManhattan(), GetClosestDeletedStation(), GetCountAndDistanceOfClosestInstance(), GetDistanceFromNearbyHouse(), IndustryGetVariable(), IsCloseToTown(), AIRail::RemoveRail(), VehiclePayment(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and YapfCheckReverseTrain().
also known as L-Infinity-Norm
Gets the biggest distance component (x or y) between the two given tiles. Also known as L-Infinity-Norm.
t0 | the start tile | |
t1 | the end tile |
Definition at line 211 of file map.cpp.
References Delta(), max(), TileX(), and TileY().
Referenced by DeliverGoodsToIndustry(), AIMap::DistanceMax(), and FindStationsNearby().
Max + Manhattan.
Gets the biggest distance component (x or y) between the two given tiles plus the Manhattan distance, i.e. two times the biggest distance component and once the smallest component.
t0 | the start tile | |
t1 | the end tile |
euclidian- or L2-Norm squared
Gets the 'Square' distance between the two given tiles. The 'Square' distance is the square of the shortest (straight line) distance between the two tiles. Also known as euclidian- or L2-Norm squared.
t0 | the start tile | |
t1 | the end tile |
Definition at line 196 of file map.cpp.
References TileX(), and TileY().
Referenced by AIMap::DistanceSquare(), FindNearestHangar(), GetTownRadiusGroup(), IndustryGetVariable(), and UpdateTownGrowRate().
static uint MapLogX | ( | ) | [inline, static] |
Logarithm of the map size along the X side.
Definition at line 48 of file map_func.h.
References _map_log_x.
Referenced by StartupIndustryDailyChanges(), TileY(), and ToTileIndexDiff().
static uint MapLogY | ( | ) | [inline, static] |
Logarithm of the map size along the y side.
Definition at line 59 of file map_func.h.
References _map_log_y.
Referenced by StartupIndustryDailyChanges().
static uint MapMaxX | ( | ) | [inline, static] |
Gets the maximum X coordinate within the map, including MP_VOID.
Definition at line 99 of file map_func.h.
References MapSizeX().
Referenced by AddTileIndexDiffCWrap(), CheckIfCanLevelIndustryPlatform(), CircularTileSearch(), CmdBuildTunnel(), DeliverGoodsToIndustry(), DisasterTick_Airplane(), DisasterTick_Helicopter(), DrawSmallMapStuff(), GetClosestWaterDistance(), GetTileMaxZ(), GetTileSlope(), GetTileZ(), GrayscaleToMapHeights(), GrowTownWithExtraHouse(), GUIPlaceProcDragXY(), IsRoadAllowedHere(), IsTunnelInWay(), SetTileType(), SetWaterClassDependingOnSurroundings(), TerraformTileHeight(), TgenSetTileHeight(), TileAddWrap(), TileX(), and TranslateXYToTileCoord().
static uint MapMaxY | ( | ) | [inline, static] |
Gets the maximum Y coordinate within the map, including MP_VOID.
Definition at line 108 of file map_func.h.
References MapSizeY().
Referenced by AddTileIndexDiffCWrap(), CheckIfCanLevelIndustryPlatform(), CircularTileSearch(), DeliverGoodsToIndustry(), DrawSmallMapStuff(), GetClosestWaterDistance(), GetTileMaxZ(), GetTileSlope(), GetTileZ(), GrayscaleToMapHeights(), GrowTownWithExtraHouse(), GUIPlaceProcDragXY(), IsRoadAllowedHere(), IsTunnelInWay(), SetTileType(), SetWaterClassDependingOnSurroundings(), TerraformTileHeight(), TgenSetTileHeight(), TileAddWrap(), and TranslateXYToTileCoord().
static uint MapSize | ( | ) | [inline, static] |
Get the size of the map.
Definition at line 89 of file map_func.h.
References _map_size.
Referenced by CmdBuildBridge(), CmdBuildCanal(), CmdBuildLongRoad(), CmdClearArea(), CmdConvertRail(), CmdLevelLand(), CmdPlantTree(), CmdRailTrackHelper(), CmdRemoveFromRailroadStation(), CmdRemoveLongRoad(), CmdSignalTrackHelper(), CmdTerraformLand(), DoCommand(), DoCommandP(), DrawStationCoverageAreaText(), FindStationsNearby(), GetClosestWaterDistance(), AIMap::GetMapSize(), GetTileSlope(), GetTileType(), GetTropicZone(), GrowTownAtRoad(), GrowTownInTile(), IsValidTile(), AITile::LevelTiles(), AITile::LowerTile(), AITile::RaiseTile(), ScaleByMapSize(), SetDefaultRailGui(), SetTileHeight(), SetTileType(), SetTropicZone(), TerraformTileHeight(), TileHeight(), TownLayoutAllows2x2HouseHere(), UpdateHousesAndTowns(), and UpdateNearestTownForRoadTiles().
static uint MapSizeX | ( | ) | [inline, static] |
Get the size of the map along the X.
Definition at line 69 of file map_func.h.
References _map_size_x.
Referenced by _GenerateWorld(), AllocHeightMap(), AIRail::AreTilesConnected(), CommonRaiseLowerBigLand(), Disaster_Small_Ufo_Init(), DisasterTick_Big_Ufo_Destroyer(), DisasterTick_Helicopter(), DistanceFromEdge(), FixSlopes(), FlatEmptyWorld(), GenerateWorld(), GetAcceptanceAroundTiles(), AIVehicle::GetLocation(), AIMap::GetMapSizeX(), GetProductionAroundTiles(), GrayscaleToMapHeights(), MapMaxX(), MarkTileDirty(), ScaleByMapSize1D(), SimulateDrag(), TerraformTileHeight(), TileDiffXY(), TileXY(), and UpdateStationAcceptance().
static uint MapSizeY | ( | ) | [inline, static] |
Get the size of the map along the Y.
Definition at line 79 of file map_func.h.
References _map_size_y.
Referenced by _GenerateWorld(), AllocHeightMap(), CommonRaiseLowerBigLand(), Disaster_Small_Ufo_Init(), DisasterTick_Zeppeliner(), DistanceFromEdge(), FixSlopes(), FlatEmptyWorld(), GenerateWorld(), GetAcceptanceAroundTiles(), AIVehicle::GetLocation(), AIMap::GetMapSizeY(), GetProductionAroundTiles(), GrayscaleToMapHeights(), MapMaxY(), MarkTileDirty(), ScaleByMapSize1D(), TerraformTileHeight(), and UpdateStationAcceptance().
static TileIndex RandomTileSeed | ( | uint32 | r | ) | [inline, static] |
Get a random tile out of a given seed.
r | the random 'seed' |
Definition at line 401 of file map_func.h.
References TILE_MASK.
Referenced by PlaceTreesRandomly().
uint ScaleByMapSize | ( | uint | n | ) |
Scales relative to the number of tiles.
Scales the given value by the map size, where the given value is for a 256 by 256 map.
n | the value to scale |
Definition at line 100 of file map.cpp.
References MapSize().
Referenced by GenerateIndustries(), GenerateTrees(), PlaceInitialIndustry(), PlaceMoreTrees(), and PlaceTreesRandomly().
uint ScaleByMapSize1D | ( | uint | n | ) |
Scale relative to the circumference of the map.
Scales the given value by the maps circumference, where the given value is for a 256 by 256 map
n | the value to scale |
Definition at line 115 of file map.cpp.
References MapSizeX(), and MapSizeY().
Referenced by GenerateIndustries(), and PlaceInitialIndustry().
static TileIndex TileAddByDiagDir | ( | TileIndex | tile, | |
DiagDirection | dir | |||
) | [inline, static] |
Adds a DiagDir to a tile.
tile | The current tile | |
dir | The direction in which we want to step |
Definition at line 372 of file map_func.h.
References TILE_ADD, and TileOffsByDiagDir().
Referenced by CleanUpRoadBits(), ClearPathReservation(), GrowTownAtRoad(), GrowTownInTile(), GrowTownWithBridge(), GrowTownWithExtraHouse(), MaskWireBits(), NeighbourHasReachableRoad(), SetWaterClassDependingOnSurroundings(), and TryPathReserve().
Adds an offset to a tile and check if we are still on the map.
This function checks if we add addx/addy to tile, if we do wrap around the edges. For example, tile = (10,2) and addx = +3 and addy = -4. This function will now return INVALID_TILE, because the y is wrapped. This is needed in for example, farmland. When the tile is not wrapped, the result will be tile + TileDiffXY(addx, addy)
tile | the 'starting' point of the adding | |
addx | the amount of tiles in the X direction to add | |
addy | the amount of tiles in the Y direction to add |
Definition at line 138 of file map.cpp.
References INVALID_TILE, MapMaxX(), MapMaxY(), TileDiffXY(), TileX(), and TileY().
Referenced by CountMapSquareAround(), DisasterTick_Big_Ufo_Destroyer(), DoPlaceMoreTrees(), FindStationsAroundTiles(), and PlaceTreeAtSameHeight().
static TileIndexDiff TileDiffXY | ( | int | x, | |
int | y | |||
) | [inline, static] |
Calculates an offset for the given coordinate(-offset).
This function calculate an offset value which can be added to an TileIndex. The coordinates can be negative.
x | The offset in x direction | |
y | The offset in y direction |
Definition at line 158 of file map_func.h.
References MapSizeX().
Referenced by AITileList_IndustryAccepting::AITileList_IndustryAccepting(), AITileList_IndustryProducing::AITileList_IndustryProducing(), AIRoad::CanBuildConnectedRoadPartsHere(), ChangeIndustryProduction(), CheckIfCanLevelIndustryPlatform(), CmdBuildBridge(), CmdBuildLongRoad(), CmdBuildRailroadStation(), CmdBuildShipDepot(), CmdRemoveLongRoad(), CmdTerraformLand(), DestroyCompanyHQ(), Disaster_CoalMine_Init(), EnlargeCompanyHQ(), GetHouseNorthPart(), Station::GetPlatformLength(), GetTileMaxZ(), GetTileSlope(), GetTileZ(), GUIPlaceProcDragXY(), MakeCompanyHQ(), MakeTownHouse(), Station::MarkTilesDirty(), NormaliseTileOffset(), AITile::PlantTreeRectangle(), ReportNewsProductionChangeIndustry(), TerraformAddDirtyTileAround(), TileAddWrap(), and UpdateStationAcceptance().
static TileIndexDiffC TileIndexDiffCByDiagDir | ( | DiagDirection | dir | ) | [inline, static] |
Returns the TileIndexDiffC offset from a DiagDirection.
dir | The given direction |
Definition at line 244 of file map_func.h.
References _tileoffs_by_diagdir, DIAGDIR_END, and IsValidDiagDirection().
static TileIndexDiffC TileIndexDiffCByDir | ( | Direction | dir | ) | [inline, static] |
Returns the TileIndexDiffC offset from a Direction.
dir | The given direction |
Definition at line 258 of file map_func.h.
References _tileoffs_by_dir, DIR_END, and IsValidDirection().
Referenced by TileLoop_Water().
static TileIndexDiffC TileIndexToTileIndexDiffC | ( | TileIndex | tile_a, | |
TileIndex | tile_b | |||
) | [inline, static] |
Returns the diff between two tiles.
tile_a | from tile | |
tile_b | to tile |
Definition at line 293 of file map_func.h.
References TileX(), TileY(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by GetTownRoadGridElement(), and TownLayoutAllowsHouseHere().
static TileIndexDiff TileOffsByDiagDir | ( | DiagDirection | dir | ) | [inline, static] |
Convert a DiagDirection to a TileIndexDiff.
dir | The DiagDirection |
Definition at line 343 of file map_func.h.
References _tileoffs_by_diagdir, DIAGDIR_END, IsValidDiagDirection(), and ToTileIndexDiff().
Referenced by AIBridge::_BuildBridgeRoad1(), AIBridge::_BuildBridgeRoad2(), AITunnel::_BuildTunnelRoad1(), AITunnel::_BuildTunnelRoad2(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CheckFree2x2Area(), CheckTownBuild2House(), CheckTownBuild2x2House(), ChooseShipTrack(), CmdBuildDock(), CmdBuildRoad(), CmdBuildTunnel(), CmdConvertRail(), Disaster_CoalMine_Init(), DisasterTick_Submarine(), DoBuildShiplift(), DoTrainPathfind(), DrawCatenaryRailway(), ExploreSegment(), ExtendTrainReservation(), FixOwnerOfRailTrack(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), GetBridgeEnd(), AIRoad::GetDriveThroughBackTile(), GetOtherTunnelEnd(), Station::GetPlatformLength(), AIRail::GetRailDepotFrontTile(), AIRoad::GetRoadDepotFrontTile(), AIRoad::GetRoadStationFrontTile(), GetTrainForReservation(), GrowTownInTile(), GrowTownWithBridge(), IsNeighborRoadTile(), IsTunnelInWayDir(), NPFSaveTargetData(), RemoveRoad(), RoadFindPathToDest(), SetRailwayStationPlatformReservation(), TileAddByDiagDir(), TrainApproachingCrossing(), TrainApproachingCrossingTile(), TrainCheckIfLineEnds(), UpdateSignalsInBuffer(), and UpdateStationAcceptance().
static TileIndexDiff TileOffsByDir | ( | Direction | dir | ) | [inline, static] |
Convert a Direction to a TileIndexDiff.
dir | The direction to convert from |
Definition at line 357 of file map_func.h.
References _tileoffs_by_dir, DIR_END, IsValidDirection(), and ToTileIndexDiff().
Referenced by CircularTileSearch(), FindStationsNearby(), IsWateredTile(), and MarkCanalsAndRiversAroundDirty().
static uint TileX | ( | TileIndex | tile | ) | [inline, static] |
Get the X component of a tile.
tile | the tile to get the X component of |
Definition at line 178 of file map_func.h.
References MapMaxX().
Referenced by AIBridge::_BuildBridgeRoad1(), AIBridge::_BuildBridgeRoad2(), AIRoad::_BuildRoadInternal(), AIRoad::_BuildRoadStationInternal(), AITunnel::_BuildTunnelRoad1(), AITunnel::_BuildTunnelRoad2(), AITileList::AddRectangle(), AddTileIndexDiffCWrap(), AircraftController(), AircraftGetEntryPoint(), AIRoad::AreRoadTilesConnected(), AIMarine::AreWaterTilesConnected(), AIBridge::BuildBridge(), AIRail::BuildRail(), AIRail::BuildRailDepot(), AIRoad::BuildRoadDepot(), AIRail::BuildSignal(), AIMarine::BuildWaterDepot(), CalcClosestStationTile(), CalcHeightdiff(), CheckIfCanLevelIndustryPlatform(), CircularTileSearch(), CmdBuildAircraft(), CmdBuildBridge(), CmdBuildCanal(), CmdBuildLongRoad(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVeh(), CmdBuildShip(), CmdBuildTunnel(), CmdClearArea(), CmdConvertRail(), CmdLevelLand(), CmdPlaceSign(), CmdPlantTree(), CmdRemoveFromRailroadStation(), CmdRemoveLongRoad(), CommonRaiseLowerBigLand(), Disaster_Small_Ufo_Init(), Disaster_Zeppeliner_Init(), DisasterTick_Airplane(), DisasterTick_Big_Ufo(), DisasterTick_Helicopter(), DisasterTick_Ufo(), DistanceFromEdge(), DistanceManhattan(), DistanceMax(), DistanceMaxPlusManhattan(), DistanceSquare(), DoCommandP(), DrawTileSelection(), FindStationsNearby(), AITileList::FixRectangleSpan(), GenerateDesertArea(), GenerateRockyArea(), GetAcceptanceAroundTiles(), GetClosestWaterDistance(), GetDriveableTrackdirBits(), GetMinimalAirportDistanceToTile(), AIRoad::GetNeighbourRoadCount(), GetPCPElevation(), GetProductionAroundTiles(), GetRelativePosition(), AIRail::GetSignalType(), GetTileMaxZ(), GetTileSlope(), AIMap::GetTileX(), GetTileZ(), GetTunnelBridgeLength(), GrayscaleToMapHeights(), GrowTownWithBridge(), GrowTownWithExtraHouse(), GUIPlaceProcDragXY(), HouseGetVariable(), InitializeWindowViewport(), IsRoadAllowedHere(), IsTunnelInWay(), MarkTileDirtyByTile(), NPFDistanceTrack(), NPFHash(), CYapfDestinationTileT< Types >::PfCalcEstimate(), AIRail::RemoveRail(), AITileList::RemoveRectangle(), AIRoad::RemoveRoad(), AIRoad::RemoveRoadFull(), AIRail::RemoveSignal(), SetTileType(), SetWaterClassDependingOnSurroundings(), ShowBuildBridgeWindow(), SimulateDrag(), SwapDirection(), TerraformAddDirtyTileAround(), TerraformTileHeight(), TgenSetTileHeight(), TileAddWrap(), TileIndexToTileIndexDiffC(), TileStr(), TownLayoutAllows2x2HouseHere(), UpdateStationVirtCoord(), UpdateTownVirtCoord(), UpdateWaypointSign(), VehicleFromPos(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and VpStartPlaceSizing().
static TileIndex TileXY | ( | uint | x, | |
uint | y | |||
) | [inline, static] |
Returns the TileIndex of a coordinate.
x | The x coordinate of the tile | |
y | The y coordinate of the tile |
Definition at line 142 of file map_func.h.
References MapSizeX().
Referenced by _GenerateWorld(), AddTileIndexDiffCWrap(), AITileList_StationType::AITileList_StationType(), CalcClosestStationTile(), CircularTileSearch(), CmdBuildBridge(), CmdBuildCanal(), CmdClearArea(), CmdConvertRail(), CmdLevelLand(), CmdPlantTree(), CmdRemoveFromRailroadStation(), DeliverGoodsToIndustry(), Disaster_Small_Ufo_Init(), DrawSmallMapStuff(), AITileList::FixRectangleSpan(), FixSlopes(), FlatEmptyWorld(), GenerateDesertArea(), GenerateRockyArea(), GenerateTerrainPerlin(), GenerateWorld(), GetAcceptanceAroundTiles(), GetClosestWaterDistance(), AIVehicle::GetLocation(), GetProductionAroundTiles(), AIMap::GetTileIndex(), GrayscaleToMapHeights(), StationRect::ScanForStationTiles(), TerraformTileHeight(), and UpdateStationAcceptance().
static uint TileY | ( | TileIndex | tile | ) | [inline, static] |
Get the Y component of a tile.
tile | the tile to get the Y component of |
Definition at line 188 of file map_func.h.
References MapLogX().
Referenced by AIBridge::_BuildBridgeRoad1(), AIBridge::_BuildBridgeRoad2(), AIRoad::_BuildRoadInternal(), AIRoad::_BuildRoadStationInternal(), AITunnel::_BuildTunnelRoad1(), AITunnel::_BuildTunnelRoad2(), AITileList::AddRectangle(), AddTileIndexDiffCWrap(), AircraftController(), AircraftGetEntryPoint(), AIRoad::AreRoadTilesConnected(), AIBridge::BuildBridge(), AIRail::BuildRail(), AIRail::BuildRailDepot(), AIRoad::BuildRoadDepot(), AIRail::BuildSignal(), AIMarine::BuildWaterDepot(), CalcClosestStationTile(), CheckIfCanLevelIndustryPlatform(), CircularTileSearch(), CmdBuildAircraft(), CmdBuildBridge(), CmdBuildCanal(), CmdBuildLongRoad(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVeh(), CmdBuildShip(), CmdBuildTunnel(), CmdClearArea(), CmdConvertRail(), CmdLevelLand(), CmdPlaceSign(), CmdPlantTree(), CmdRemoveFromRailroadStation(), CmdRemoveLongRoad(), CommonRaiseLowerBigLand(), Disaster_Helicopter_Init(), DisasterTick_Airplane(), DisasterTick_Big_Ufo(), DisasterTick_Helicopter(), DisasterTick_Ufo(), DistanceFromEdge(), DistanceManhattan(), DistanceMax(), DistanceMaxPlusManhattan(), DistanceSquare(), DoCommandP(), DrawTileSelection(), FindStationsNearby(), AITileList::FixRectangleSpan(), GenerateDesertArea(), GenerateRockyArea(), GetAcceptanceAroundTiles(), GetClosestWaterDistance(), GetDriveableTrackdirBits(), GetMinimalAirportDistanceToTile(), AIRoad::GetNeighbourRoadCount(), GetPCPElevation(), GetProductionAroundTiles(), GetRelativePosition(), AIRail::GetSignalType(), GetTileMaxZ(), GetTileSlope(), AIMap::GetTileY(), GetTileZ(), GetTunnelBridgeLength(), GrayscaleToMapHeights(), GrowTownWithBridge(), GrowTownWithExtraHouse(), GUIPlaceProcDragXY(), HouseGetVariable(), InitializeWindowViewport(), IsRoadAllowedHere(), IsTunnelInWay(), MarkTileDirtyByTile(), NPFDistanceTrack(), NPFHash(), CYapfDestinationTileT< Types >::PfCalcEstimate(), AIRail::RemoveRail(), AITileList::RemoveRectangle(), AIRoad::RemoveRoad(), AIRoad::RemoveRoadFull(), AIRail::RemoveSignal(), SetTileType(), SetWaterClassDependingOnSurroundings(), ShowBuildBridgeWindow(), SimulateDrag(), SwapDirection(), TerraformAddDirtyTileAround(), TerraformTileHeight(), TgenSetTileHeight(), TileAddWrap(), TileIndexToTileIndexDiffC(), TileStr(), TownLayoutAllows2x2HouseHere(), UpdateStationVirtCoord(), UpdateTownVirtCoord(), UpdateWaypointSign(), VehicleFromPos(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and VpStartPlaceSizing().
static TileIndexDiff ToTileIndexDiff | ( | TileIndexDiffC | tidc | ) | [inline, static] |
Return the offset between to tiles from a TileIndexDiffC struct.
This function works like TileDiffXY(int, int) and returns the difference between two tiles.
tidc | The coordinate of the offset as TileIndexDiffC |
Definition at line 203 of file map_func.h.
References MapLogX(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by AIDepotList::AIDepotList(), CalcHeightdiff(), CmdBuildAircraft(), CmdBuildDock(), CmdRailTrackHelper(), CmdSignalTrackHelper(), AIAirport::GetHangarOfAirport(), GrowTown(), IsHangar(), TerraformTileHeight(), TileOffsByDiagDir(), and TileOffsByDir().
Pointer to the tile-array.
This variable points to the tile-array which contains the tiles of the map.
Definition at line 24 of file map.cpp.
Referenced by AddClearCounter(), AddClearDensity(), AddTreeCount(), AddTreeCounter(), AddTreeGrowth(), ClearSingleBridgeMiddle(), GetBridgeAxis(), GetBridgeType(), GetClearCounter(), GetClearDensity(), GetClearGround(), GetCompanyHQSection(), GetCompanyHQSize(), GetCrossingReservation(), GetDepotWaypointReservation(), GetDisallowedRoadDirections(), GetFenceSE(), GetFenceSW(), GetFieldType(), GetHouseAge(), GetHouseAnimationFrame(), GetHouseBuildingStage(), GetHouseConstructionTick(), GetHouseRandomBits(), GetHouseTriggers(), GetHouseType(), GetIndustryAnimationLoop(), GetIndustryAnimationState(), GetIndustryConstructionCounter(), GetIndustryConstructionStage(), GetIndustryIndex(), GetIndustryIndexOfField(), GetIndustryTriggers(), GetLiftPosition(), GetPresentSignals(), GetRailDepotDirection(), GetRailTileType(), GetRailType(), GetRailwayStationReservation(), GetSignalStates(), GetStationIndex(), GetStatueTownID(), GetTileOwner(), GetTileType(), GetTownIndex(), GetTrackBits(), GetTrackReservation(), GetTreeCount(), GetTreeCounter(), GetTreeDensity(), GetTreeGround(), GetTreeGrowth(), GetTreeType(), GetTropicZone(), GetTunnelBridgeDirection(), GetTunnelBridgeReservation(), GetTunnelBridgeTransportType(), GetUnmovableType(), GetWaypointAxis(), GetWaypointIndex(), IncHouseConstructionTick(), IncrementHouseAge(), IsBridge(), IsBridgeAbove(), IsCompanyHQ(), IsHouseCompleted(), IsIndustryCompleted(), IsTunnel(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeRailTunnel(), MakeRoadTunnel(), MakeStatue(), MakeTree(), MakeUnmovable(), MakeVoid(), ResetHouseAge(), ResetIndustryConstructionStage(), SetBridgeMiddle(), SetClearCounter(), SetClearGroundDensity(), SetCompanyHQSection(), SetCompanyHQSize(), SetCrossingReservation(), SetDepotWaypointReservation(), SetDisallowedRoadDirections(), SetFenceSE(), SetFenceSW(), SetFieldType(), SetHasSignals(), SetHouseAnimationFrame(), SetHouseCompleted(), SetHouseRandomBits(), SetHouseTriggers(), SetHouseType(), SetIndustryAnimationLoop(), SetIndustryAnimationState(), SetIndustryCompleted(), SetIndustryConstructionCounter(), SetIndustryConstructionStage(), SetIndustryGfx(), SetIndustryIndexOfField(), SetIndustryTriggers(), SetLiftPosition(), SetPresentSignals(), SetRailType(), SetRailwayStationReservation(), SetSignalStates(), SetTileHeight(), SetTileOwner(), SetTileType(), SetTownIndex(), SetTrackBits(), SetTrackReservation(), SetTreeCounter(), SetTreeGroundDensity(), SetTreeGrowth(), SetTropicZone(), SetTunnelBridgeReservation(), and TileHeight().
Pointer to the extended tile-array.
This variable points to the extended tile-array which contains the tiles of the map.
Definition at line 25 of file map.cpp.
Referenced by DecHouseProcessingTime(), GetHouseProcessingTime(), GetIndustryRandomBits(), GetLiftDestination(), HaltLift(), HasTunnelBridgeSnowOrDesert(), LiftHasDestination(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeRailTunnel(), MakeRoadTunnel(), MakeTree(), MakeUnmovable(), MakeVoid(), SetHouseProcessingTime(), SetIndustryRandomBits(), SetLiftDestination(), and SetTunnelBridgeSnowOrDesert().