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

Function pickupToolUpdateLand

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

Source from the content-addressed store, hash-verified

4687 // 0x004B2A1D
4688 template<typename GetPlacementArgsFunc>
4689 static void pickupToolUpdateLand(const Vehicles::VehicleHead& head, const int16_t x, const int16_t y, GetPlacementArgsFunc&& getPlacementArgs)
4690 {
4691 auto placementArgs = getPlacementArgs(head, x, y);
4692 if (!placementArgs)
4693 {
4694 removeLandGhost(head);
4695 return;
4696 }
4697
4698 if (_ghostTrackProgress != -1 && _ghostLandTrackAndDirection == placementArgs->trackAndDirection && _ghostVehiclePos == placementArgs->pos && _ghostTrackProgress == placementArgs->trackProgress)
4699 {
4700 return;
4701 }
4702
4703 removeLandGhost(head);
4704 if (GameCommands::doCommand(*placementArgs, GameCommands::Flags::apply | GameCommands::Flags::ghost | GameCommands::Flags::noErrorWindow) != GameCommands::kFailure)
4705 {
4706 _ghostLandTrackAndDirection = placementArgs->trackAndDirection;
4707 _ghostVehiclePos = placementArgs->pos;
4708 _ghostTrackProgress = placementArgs->trackProgress;
4709 }
4710 }
4711
4712 // 0x004B29C0
4713 static void pickupToolUpdate(Window& self, const int16_t x, const int16_t y)

Callers 1

pickupToolUpdateFunction · 0.85

Calls 2

removeLandGhostFunction · 0.85
doCommandFunction · 0.50

Tested by

no test coverage detected