| 1432 | } |
| 1433 | |
| 1434 | static GameActions::Result TrackDesignPlaceMaze( |
| 1435 | TrackDesignState& tds, const TrackDesign& td, const CoordsXYZ& origin, const Ride& ride) |
| 1436 | { |
| 1437 | if (tds.placeOperation == TrackPlaceOperation::drawOutlines) |
| 1438 | { |
| 1439 | MapSelection::clearSelectedTiles(); |
| 1440 | gMapSelectArrowPosition = CoordsXYZ{ origin, TileElementHeight(origin) }; |
| 1441 | gMapSelectArrowDirection = _currentTrackPieceDirection; |
| 1442 | } |
| 1443 | |
| 1444 | tds.placeZ = 0; |
| 1445 | money64 totalCost = 0; |
| 1446 | |
| 1447 | auto& gameState = getGameState(); |
| 1448 | |
| 1449 | for (const auto& maze_element : td.mazeElements) |
| 1450 | { |
| 1451 | uint8_t rotation = _currentTrackPieceDirection & 3; |
| 1452 | CoordsXY mazeMapPos = maze_element.location.ToCoordsXY(); |
| 1453 | auto mapCoord = mazeMapPos.Rotate(rotation); |
| 1454 | mapCoord += origin; |
| 1455 | |
| 1456 | TrackDesignUpdatePreviewBounds(tds, { mapCoord, origin.z }); |
| 1457 | |
| 1458 | if (tds.placeOperation == TrackPlaceOperation::drawOutlines) |
| 1459 | { |
| 1460 | TrackDesignAddSelectedTile(mapCoord); |
| 1461 | } |
| 1462 | |
| 1463 | if (tds.placeOperation == TrackPlaceOperation::placeQuery || tds.placeOperation == TrackPlaceOperation::place |
| 1464 | || tds.placeOperation == TrackPlaceOperation::placeGhost |
| 1465 | || tds.placeOperation == TrackPlaceOperation::placeTrackPreview) |
| 1466 | { |
| 1467 | CommandFlags flags; |
| 1468 | money64 cost = 0; |
| 1469 | |
| 1470 | uint16_t mazeEntry = Numerics::rol16(maze_element.mazeEntry, rotation * 4); |
| 1471 | |
| 1472 | if (tds.placeOperation == TrackPlaceOperation::placeTrackPreview) |
| 1473 | { |
| 1474 | flags = { CommandFlag::apply, CommandFlag::allowDuringPaused, CommandFlag::noSpend }; |
| 1475 | } |
| 1476 | else if (tds.placeOperation == TrackPlaceOperation::placeGhost) |
| 1477 | { |
| 1478 | flags = { CommandFlag::apply, CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost }; |
| 1479 | } |
| 1480 | else if (tds.placeOperation == TrackPlaceOperation::placeQuery) |
| 1481 | { |
| 1482 | flags = {}; |
| 1483 | } |
| 1484 | else |
| 1485 | { |
| 1486 | flags = { CommandFlag::apply }; |
| 1487 | } |
| 1488 | if (tds.isReplay) |
| 1489 | { |
| 1490 | flags.set(CommandFlag::replay); |
| 1491 | } |
no test coverage detected