0x0047A21E
| 48 | |
| 49 | // 0x0047A21E |
| 50 | static uint32_t createRoadMod(const RoadModsPlacementArgs& args, uint8_t flags) |
| 51 | { |
| 52 | auto* roadEl = getRoadElement(args); |
| 53 | if (roadEl == nullptr || !sub_431E6A(roadEl->owner(), reinterpret_cast<const World::TileElement*>(roadEl))) |
| 54 | { |
| 55 | return kFailure; |
| 56 | } |
| 57 | |
| 58 | auto& piece = World::TrackData::getRoadPiece(args.roadId)[roadEl->sequenceIndex()]; |
| 59 | const auto roadLoc = World::Pos3{ Math::Vector::rotate(World::Pos2{ piece.x, piece.y }, args.rotation), piece.z }; |
| 60 | |
| 61 | // 0x0047A34C |
| 62 | const auto firstTilePos = args.pos - roadLoc; |
| 63 | const auto rad = Vehicles::TrackAndDirection::_RoadAndDirection(roadEl->roadId(), roadEl->rotation()); |
| 64 | |
| 65 | auto result = Vehicles::applyRoadModsToTrackNetwork(firstTilePos, rad, roadEl->owner(), args.roadObjType, flags, args.modSection, args.type); |
| 66 | if (result.allPlacementsFailed) |
| 67 | { |
| 68 | setErrorText(StringIds::track_road_unsuitable); |
| 69 | return kFailure; |
| 70 | } |
| 71 | if (result.networkTooComplex && (flags & Flags::apply) && !(flags & Flags::ghost)) |
| 72 | { |
| 73 | Ui::Windows::Error::open(StringIds::null, StringIds::too_much_track_some_track_not_upgraded); |
| 74 | } |
| 75 | |
| 76 | return result.cost; |
| 77 | } |
| 78 | |
| 79 | void createRoadMod(registers& regs) |
| 80 | { |
nothing calls this directly
no test coverage detected