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

Method OnScroll

src/smallmap_gui.cpp:1871–1881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1869 }
1870
1871 void OnScroll(Point delta) override
1872 {
1873 if (_settings_client.gui.scroll_mode == VSM_VIEWPORT_RMB_FIXED || _settings_client.gui.scroll_mode == VSM_MAP_RMB_FIXED) _cursor.fix_at = true;
1874
1875 /* While tile is at (delta.x, delta.y)? */
1876 int sub;
1877 Point pt = this->PixelToTile(delta.x, delta.y, &sub);
1878 this->SetNewScroll(this->scroll_x + pt.x * TILE_SIZE, this->scroll_y + pt.y * TILE_SIZE, sub);
1879
1880 this->SetDirty();
1881 }
1882
1883 void OnMouseOver([[maybe_unused]] Point pt, WidgetID widget) override
1884 {

Callers

nothing calls this directly

Calls 3

PixelToTileMethod · 0.95
SetNewScrollMethod · 0.95
SetDirtyMethod · 0.45

Tested by

no test coverage detected