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

Method DrawMapIndicators

src/smallmap_gui.cpp:876–895  ·  view source on GitHub ↗

* Adds map indicators to the smallmap. */

Source from the content-addressed store, hash-verified

874 * Adds map indicators to the smallmap.
875 */
876 void DrawMapIndicators() const
877 {
878 /* Find main viewport. */
879 const Viewport &vp = *GetMainWindow()->viewport;
880
881 Point upper_left_smallmap_coord = InverseRemapCoords2(vp.virtual_left, vp.virtual_top);
882 Point lower_right_smallmap_coord = InverseRemapCoords2(vp.virtual_left + vp.virtual_width - 1, vp.virtual_top + vp.virtual_height - 1);
883
884 Point upper_left = this->RemapTile(upper_left_smallmap_coord.x / (int)TILE_SIZE, upper_left_smallmap_coord.y / (int)TILE_SIZE);
885 upper_left.x -= this->subscroll;
886
887 Point lower_right = this->RemapTile(lower_right_smallmap_coord.x / (int)TILE_SIZE, lower_right_smallmap_coord.y / (int)TILE_SIZE);
888 lower_right.x -= this->subscroll;
889
890 SmallMapWindow::DrawVertMapIndicator(upper_left.x, upper_left.y, lower_right.y);
891 SmallMapWindow::DrawVertMapIndicator(lower_right.x, upper_left.y, lower_right.y);
892
893 SmallMapWindow::DrawHorizMapIndicator(upper_left.x, lower_right.x, upper_left.y);
894 SmallMapWindow::DrawHorizMapIndicator(upper_left.x, lower_right.x, lower_right.y);
895 }
896
897 /**
898 * Draws one column of tiles of the small map in a certain mode onto the screen buffer, skipping the shifted rows in between.

Callers 1

DrawSmallMapMethod · 0.95

Calls 3

RemapTileMethod · 0.95
GetMainWindowFunction · 0.85
InverseRemapCoords2Function · 0.85

Tested by

no test coverage detected