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

Method RemapTile

src/smallmap_gui.cpp:1124–1136  ·  view source on GitHub ↗

* Remap tile to location on this smallmap. * @param tile_x X coordinate of the tile. * @param tile_y Y coordinate of the tile. * @return Position to draw on. */

Source from the content-addressed store, hash-verified

1122 * @return Position to draw on.
1123 */
1124 Point RemapTile(int tile_x, int tile_y) const
1125 {
1126 int x_offset = tile_x - this->scroll_x / (int)TILE_SIZE;
1127 int y_offset = tile_y - this->scroll_y / (int)TILE_SIZE;
1128
1129 if (this->zoom == 1) return SmallmapRemapCoords(x_offset, y_offset);
1130
1131 /* For negative offsets, round towards -inf. */
1132 if (x_offset < 0) x_offset -= this->zoom - 1;
1133 if (y_offset < 0) y_offset -= this->zoom - 1;
1134
1135 return SmallmapRemapCoords(x_offset / this->zoom, y_offset / this->zoom);
1136 }
1137
1138 /**
1139 * Determine the tile relative to the base tile of the smallmap, and the pixel position at

Callers 5

DrawMapIndicatorsMethod · 0.95
DrawVehiclesMethod · 0.95
DrawTownsMethod · 0.95
DrawIndustryNamesMethod · 0.95
GetStationMiddleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected