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

Method update

src/OpenLoco/src/Vehicles/VehicleBogie.cpp:34–68  ·  view source on GitHub ↗

0x004AA008

Source from the content-addressed store, hash-verified

32
33 // 0x004AA008
34 bool VehicleBogie::update()
35 {
36 if (mode == TransportMode::air || mode == TransportMode::water)
37 {
38 return true;
39 }
40
41 auto& distances = getVehicleUpdateDistances();
42 const auto motionResult = updateTrackMotion(distances.unkDistance1, false);
43
44 int32_t unkDistance = distances.unkDistance2;
45 if (wheelSlipping != 0)
46 {
47 auto unk = wheelSlipping;
48 if (unk > kWheelSlippingDuration / 2)
49 {
50 unk = kWheelSlippingDuration - unk;
51 }
52 unkDistance = 500 + unk * 320;
53 }
54
55 updateRoll(unkDistance);
56 if (motionResult.hasFlags(UpdateVar1136114Flags::noRouteFound))
57 {
58 destroyTrain();
59 return false;
60 }
61 else if (!motionResult.hasFlags(UpdateVar1136114Flags::crashed))
62 {
63 return true;
64 }
65
66 collision(motionResult.collidedEntityId);
67 return false;
68 }
69
70 // 0x004AAC02
71 void VehicleBogie::updateRoll(const int32_t unkDistance)

Callers

nothing calls this directly

Calls 2

updateTrackMotionFunction · 0.85
hasFlagsMethod · 0.45

Tested by

no test coverage detected