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

Function onSpeedControl

src/OpenLoco/src/Ui/Windows/Vehicle.cpp:745–756  ·  view source on GitHub ↗

0x004B2637

Source from the content-addressed store, hash-verified

743
744 // 0x004B2637
745 static void onSpeedControl(Window& self)
746 {
747 Input::setClickRepeatTicks(31);
748 auto pos = Input::getScrollLastLocation();
749 auto speed = pos.y - (self.y + self.widgets[widx::speedControl].top + 58);
750 speed = -(std::clamp(speed, -40, 40));
751
752 GameCommands::VehicleSpeedControlArgs args{};
753 args.head = EntityId(self.number);
754 args.speed = speed;
755 GameCommands::doCommand(args, GameCommands::Flags::apply);
756 }
757
758 // 0x004B251A
759 static void onMouseDown(Window& self, const WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)

Callers 1

onMouseDownFunction · 0.85

Calls 4

setClickRepeatTicksFunction · 0.85
getScrollLastLocationFunction · 0.85
EntityIdEnum · 0.85
doCommandFunction · 0.50

Tested by

no test coverage detected