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

Function ShipMoveUpDownOnLock

src/ship_cmd.cpp:591–609  ·  view source on GitHub ↗

* Test and move a ship up or down in a lock. * @param v Ship to move. * @return true iff ship is moving up or down in a lock. */

Source from the content-addressed store, hash-verified

589 * @return true iff ship is moving up or down in a lock.
590 */
591static bool ShipMoveUpDownOnLock(Ship *v)
592{
593 /* Moving up/down through lock */
594 int dz = ShipTestUpDownOnLock(v);
595 if (dz == 0) return false;
596
597 if (v->cur_speed != 0) {
598 v->cur_speed = 0;
599 SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
600 }
601
602 if ((v->tick_counter & 7) == 0) {
603 v->z_pos += dz;
604 v->UpdatePosition();
605 v->UpdateViewport(true, true);
606 }
607
608 return true;
609}
610
611/**
612 * Test if a tile is a docking tile for the given station.

Callers 1

ShipControllerFunction · 0.85

Calls 4

ShipTestUpDownOnLockFunction · 0.85
SetWindowWidgetDirtyFunction · 0.85
UpdatePositionMethod · 0.45
UpdateViewportMethod · 0.45

Tested by

no test coverage detected