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

Method Contains

src/tilearea.cpp:104–116  ·  view source on GitHub ↗

* Does this tile area contain a tile? * @param tile Tile to test for. * @return True if the tile is inside the area. */

Source from the content-addressed store, hash-verified

102 * @return True if the tile is inside the area.
103 */
104bool OrthogonalTileArea::Contains(TileIndex tile) const
105{
106 if (this->w == 0) return false;
107
108 assert(this->w != 0 && this->h != 0);
109
110 uint left = TileX(this->tile);
111 uint top = TileY(this->tile);
112 uint tile_x = TileX(tile);
113 uint tile_y = TileY(tile);
114
115 return IsInsideBS(tile_x, left, this->w) && IsInsideBS(tile_y, top, this->h);
116}
117
118/**
119 * Expand a tile area by rad tiles in each direction, keeping within map bounds.

Callers 12

SetTileMethod · 0.45
ClrTileMethod · 0.45
HasTileMethod · 0.45
ShipControllerFunction · 0.45
CmdConvertRailFunction · 0.45
OnClickMethod · 0.45
OnClickMethod · 0.45
OnClickMethod · 0.45
SkipFalseMatchesMethod · 0.45
OnClickMethod · 0.45
CmdConvertRoadFunction · 0.45

Calls 3

TileXFunction · 0.85
TileYFunction · 0.85
IsInsideBSFunction · 0.85

Tested by

no test coverage detected