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

Function roadAdjustedInteraction

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

0x004B5AC9

Source from the content-addressed store, hash-verified

3410
3411 // 0x004B5AC9
3412 static ViewportInteraction::InteractionArg roadAdjustedInteraction(const Vehicles::VehicleHead& head, int16_t orderTableIndex, ViewportInteraction::InteractionArg interaction)
3413 {
3414 auto* el = static_cast<TileElement*>(interaction.object);
3415 auto* elRoad = el->as<RoadElement>();
3416 if (elRoad == nullptr)
3417 {
3418 return ViewportInteraction::kNoInteractionArg;
3419 }
3420
3421 if (elRoad->isAiAllocated() || elRoad->isGhost())
3422 {
3423 return ViewportInteraction::kNoInteractionArg;
3424 }
3425
3426 if (elRoad->hasStationElement())
3427 {
3428 auto* elStation = getStationElement({ interaction.pos, elRoad->baseHeight() });
3429 if (elStation != nullptr)
3430 {
3431 if (!elStation->isAiAllocated() && !elStation->isGhost())
3432 {
3433 return stationAdjustedInteraction(head, orderTableIndex, elStation, interaction);
3434 }
3435 }
3436 }
3437 if (head.mode == TransportMode::air)
3438 {
3439 return ViewportInteraction::kNoInteractionArg;
3440 }
3441 FormatArguments::mapToolTip(StringIds::click_to_insert_new_order_route_through);
3442 return interaction;
3443 }
3444
3445 // 0x004B5B7F
3446 static ViewportInteraction::InteractionArg dockAirportAdjustedInteraction(const Vehicles::VehicleHead& head, int16_t orderTableIndex, ViewportInteraction::InteractionArg interaction)

Callers 1

Calls 6

getStationElementFunction · 0.85
isAiAllocatedMethod · 0.80
baseHeightMethod · 0.80
isGhostMethod · 0.45
hasStationElementMethod · 0.45

Tested by

no test coverage detected