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

Method OnPlacePresize

src/dock_gui.cpp:293–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291 }
292
293 void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile_from) override
294 {
295 TileIndex tile_to = tile_from;
296
297 if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) {
298 GetOtherAqueductEnd(tile_from, &tile_to);
299 } else {
300 DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from));
301 if (IsValidDiagDirection(dir)) {
302 /* Locks and docks always select the tile "down" the slope. */
303 tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
304 /* Locks also select the tile "up" the slope. */
305 if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
306 }
307 }
308
309 VpSetPresizeRange(tile_from, tile_to);
310 }
311
312 /**
313 * Handler for global hotkeys of the BuildDocksToolbarWindow.

Callers

nothing calls this directly

Calls 7

GetOtherAqueductEndFunction · 0.85
GetTileSlopeFunction · 0.85
IsValidDiagDirectionFunction · 0.85
TileAddByDiagDirFunction · 0.85
ReverseDiagDirFunction · 0.85
VpSetPresizeRangeFunction · 0.85

Tested by

no test coverage detected