MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / TileAdd

Function TileAdd

src/map.cpp:90–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89#ifdef _DEBUG
90TileIndex TileAdd(TileIndex tile, TileIndexDiff offset)
91{
92 int dx = offset & Map::MaxX();
93 if (dx >= (int)Map::SizeX() / 2) dx -= Map::SizeX();
94 int dy = (offset - dx) / (int)Map::SizeX();
95
96 uint32_t x = TileX(tile) + dx;
97 uint32_t y = TileY(tile) + dy;
98
99 assert(x < Map::SizeX());
100 assert(y < Map::SizeY());
101 assert(TileXY(x, y) == Map::WrapToMap(tile + offset));
102
103 return TileXY(x, y);
104}
105#endif
106
107/**

Callers 9

FindRailStationEndFunction · 0.70
GetOtherAqueductEndFunction · 0.70
IsNeighbourRoadTileFunction · 0.70
GrowTownFunction · 0.70
CalcHeightdiffFunction · 0.70
CanEnterNewTileMethod · 0.50
UnreserveSingleTrackMethod · 0.50

Calls 3

TileXFunction · 0.85
TileYFunction · 0.85
TileXYFunction · 0.85

Tested by

no test coverage detected