0x004B0826
| 28 | { |
| 29 | // 0x004B0826 |
| 30 | static uint32_t vehiclePickup(const uint8_t flags, EntityId headId) |
| 31 | { |
| 32 | GameCommands::setExpenditureType(ExpenditureType::TrainRunningCosts); |
| 33 | |
| 34 | auto* head = EntityManager::get<Vehicles::VehicleHead>(headId); |
| 35 | if (head == nullptr) |
| 36 | { |
| 37 | return kFailure; |
| 38 | } |
| 39 | auto train = Vehicles::Vehicle(*head); |
| 40 | auto* veh2 = train.veh2; |
| 41 | |
| 42 | GameCommands::setPosition(veh2->position); |
| 43 | |
| 44 | if (!GameCommands::sub_431E6A(head->owner)) |
| 45 | { |
| 46 | return kFailure; |
| 47 | } |
| 48 | |
| 49 | if (!head->canBeModified()) |
| 50 | { |
| 51 | return kFailure; |
| 52 | } |
| 53 | |
| 54 | if (!(flags & GameCommands::Flags::apply)) |
| 55 | { |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | if (!(flags & GameCommands::Flags::ghost)) |
| 60 | { |
| 61 | Vehicles::playPickupSound(veh2); |
| 62 | } |
| 63 | |
| 64 | head->liftUpVehicle(); |
| 65 | |
| 66 | // Clear ghost flag on primary vehicle pieces and all car components. |
| 67 | train.applyToComponents([](auto& component) { component.var_38 &= ~Vehicles::Flags38::isGhost; }); |
| 68 | |
| 69 | head->vehicleFlags |= Vehicles::VehicleFlags::commandStop; |
| 70 | |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | void vehiclePickup(registers& regs) |
| 75 | { |
nothing calls this directly
no test coverage detected