0x004A668A
| 11 | { |
| 12 | // 0x004A668A |
| 13 | static currency32_t removeTrackMod(const TrackModsRemovalArgs& args, uint8_t flags) |
| 14 | { |
| 15 | setExpenditureType(ExpenditureType::Construction); |
| 16 | setPosition(args.pos + World::Pos3(16, 16, 0)); |
| 17 | |
| 18 | auto* elTrack = [&args]() -> const World::TrackElement* { |
| 19 | const auto tile = World::TileManager::get(args.pos); |
| 20 | for (const auto& el : tile) |
| 21 | { |
| 22 | auto* elTrack = el.as<World::TrackElement>(); |
| 23 | if (elTrack == nullptr) |
| 24 | { |
| 25 | continue; |
| 26 | } |
| 27 | |
| 28 | if (elTrack->baseHeight() != args.pos.z) |
| 29 | { |
| 30 | continue; |
| 31 | } |
| 32 | |
| 33 | if (elTrack->rotation() != args.rotation) |
| 34 | { |
| 35 | continue; |
| 36 | } |
| 37 | |
| 38 | if (elTrack->sequenceIndex() != args.index) |
| 39 | { |
| 40 | continue; |
| 41 | } |
| 42 | |
| 43 | if (elTrack->trackObjectId() != args.trackObjType) |
| 44 | { |
| 45 | continue; |
| 46 | } |
| 47 | |
| 48 | if (elTrack->trackId() != args.trackId) |
| 49 | { |
| 50 | continue; |
| 51 | } |
| 52 | |
| 53 | return elTrack; |
| 54 | } |
| 55 | return nullptr; |
| 56 | }(); |
| 57 | |
| 58 | if (elTrack == nullptr) |
| 59 | { |
| 60 | return kFailure; |
| 61 | } |
| 62 | |
| 63 | if (!sub_431E6A(elTrack->owner(), reinterpret_cast<const World::TileElement*>(elTrack))) |
| 64 | { |
| 65 | return kFailure; |
| 66 | } |
| 67 | |
| 68 | const auto& piece = World::TrackData::getTrackPiece(elTrack->trackId())[elTrack->sequenceIndex()]; |
| 69 | const auto offsetToFirstTile = World::Pos3{ |
| 70 | Math::Vector::rotate(World::Pos2{ piece.x, piece.y }, elTrack->rotation()), |
nothing calls this directly
no test coverage detected