* 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. */
| 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 |
no outgoing calls
no test coverage detected