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

Function trackAdjustedInteraction

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

0x004B5AC9

Source from the content-addressed store, hash-verified

3367
3368 // 0x004B5AC9
3369 static ViewportInteraction::InteractionArg trackAdjustedInteraction(const Vehicles::VehicleHead& head, int16_t orderTableIndex, ViewportInteraction::InteractionArg interaction)
3370 {
3371 auto* el = static_cast<TileElement*>(interaction.object);
3372 auto* elTrack = el->as<TrackElement>();
3373 if (elTrack == nullptr)
3374 {
3375 return ViewportInteraction::kNoInteractionArg;
3376 }
3377
3378 if (elTrack->isAiAllocated() || elTrack->isGhost())
3379 {
3380 return ViewportInteraction::kNoInteractionArg;
3381 }
3382
3383 if (elTrack->owner() != CompanyManager::getControllingId())
3384 {
3385 return ViewportInteraction::kNoInteractionArg;
3386 }
3387
3388 if (elTrack->hasStationElement())
3389 {
3390 auto* elStation = elTrack->next()->as<StationElement>();
3391 if (elStation != nullptr)
3392 {
3393 if (!elStation->isAiAllocated() && !elStation->isGhost())
3394 {
3395 ViewportInteraction::InteractionArg arg{ interaction.pos, 0, interaction.type, interaction.modId };
3396 arg.object = elStation;
3397 return trainStationAdjustedInteraction(head, orderTableIndex, arg);
3398 }
3399 }
3400 }
3401
3402 if (head.mode == TransportMode::water || head.mode == TransportMode::air)
3403 {
3404 return ViewportInteraction::kNoInteractionArg;
3405 }
3406
3407 FormatArguments::mapToolTip(StringIds::click_to_insert_new_order_route_through);
3408 return interaction;
3409 }
3410
3411 // 0x004B5AC9
3412 static ViewportInteraction::InteractionArg roadAdjustedInteraction(const Vehicles::VehicleHead& head, int16_t orderTableIndex, ViewportInteraction::InteractionArg interaction)

Callers 1

Calls 7

getControllingIdFunction · 0.85
isAiAllocatedMethod · 0.80
isGhostMethod · 0.45
ownerMethod · 0.45
hasStationElementMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected