0x00498101
| 1596 | |
| 1597 | // 0x00498101 |
| 1598 | static void buildInitialRoad(Town& town) |
| 1599 | { |
| 1600 | // 0x0049807D |
| 1601 | auto placeRoadAtTile = [&town](const World::Pos2& loc) { |
| 1602 | auto tile = World::TileManager::get(loc); |
| 1603 | auto* elSurface = tile.surface(); |
| 1604 | auto height = elSurface->baseHeight(); |
| 1605 | if (elSurface->slope()) |
| 1606 | { |
| 1607 | height += 16; |
| 1608 | if (elSurface->isSlopeDoubleHeight()) |
| 1609 | { |
| 1610 | height += 16; |
| 1611 | } |
| 1612 | } |
| 1613 | |
| 1614 | auto roadObjId = getIdealTownRoadId(town); |
| 1615 | if (!roadObjId.has_value()) |
| 1616 | { |
| 1617 | return true; |
| 1618 | } |
| 1619 | |
| 1620 | GameCommands::RoadPlacementArgs args{}; |
| 1621 | args.pos = World::Pos3{ loc, height }; |
| 1622 | args.rotation = town.prng.randNext(3); |
| 1623 | args.roadId = 0; |
| 1624 | args.mods = 0; |
| 1625 | args.bridge = 0xFF; |
| 1626 | args.roadObjectId = roadObjId.value(); |
| 1627 | args.unkFlags = 0; |
| 1628 | return GameCommands::doCommand(args, GameCommands::Flags::apply) == GameCommands::kFailure; |
| 1629 | }; |
| 1630 | squareSearch({ town.x, town.y }, 9, placeRoadAtTile); |
| 1631 | } |
| 1632 | |
| 1633 | /** |
| 1634 | * 0x00498116 |
no test coverage detected