MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / trainNormalMovementUpdate

Method trainNormalMovementUpdate

src/OpenLoco/src/Vehicles/VehicleHead.cpp:1613–1722  ·  view source on GitHub ↗

0x004A8D63

Source from the content-addressed store, hash-verified

1611
1612 // 0x004A8D63
1613 bool VehicleHead::trainNormalMovementUpdate(uint8_t al, uint8_t flags, StationId nextStation)
1614 {
1615 Vehicle train(head);
1616 if (al == 4)
1617 {
1618 status = Status::approaching;
1619 stationId = nextStation;
1620 return true;
1621 }
1622 else if (al == 3)
1623 {
1624 if (train.veh2->routingHandle != routingHandle || train.veh2->subPosition != subPosition)
1625 {
1626 return true;
1627 }
1628
1629 status = Status::waitingAtSignal;
1630
1631 if (!Config::get().trainsReverseAtSignals)
1632 {
1633 return true;
1634 }
1635
1636 auto* vehType1 = train.veh1;
1637 vehType1->timeAtSignal++;
1638
1639 if (hasVehicleFlags(VehicleFlags::manualControl))
1640 {
1641 var_5C = 2;
1642 vehType1->var_48 |= Flags48::passSignal;
1643 return true;
1644 }
1645
1646 // if one-way or two-way signal??
1647 if (flags & (1 << 1))
1648 {
1649 if (vehType1->timeAtSignal >= kTrainOneWaySignalTimeout)
1650 {
1651 if (flags & (1 << 7))
1652 {
1653 return landReverseFromSignal();
1654 }
1655
1656 if (sub_4AC1C2())
1657 {
1658 var_5C = 2;
1659 vehType1->var_48 |= Flags48::passSignal;
1660 return true;
1661 }
1662 return landReverseFromSignal();
1663 }
1664
1665 // Keep waiting at the signal
1666 return true;
1667 }
1668 else
1669 {
1670 if (!(vehType1->timeAtSignal & 0x3F))

Callers

nothing calls this directly

Calls 2

destroyTrainMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected