| 554 | } |
| 555 | |
| 556 | void onDraw(Drawing::RenderTarget& rt) override |
| 557 | { |
| 558 | ScreenCoordsXY screenCoords; |
| 559 | WindowDrawWidgets(*this, rt); |
| 560 | WindowFootpathDrawDropdownButtons(rt); |
| 561 | |
| 562 | if (!isWidgetDisabled(WIDX_CONSTRUCT)) |
| 563 | { |
| 564 | // Get construction image |
| 565 | uint8_t direction = (_footpathConstructDirection + GetCurrentRotation()) % kNumOrthogonalDirections; |
| 566 | auto slopeOffset = EnumValue(_footpathConstructSlope); |
| 567 | |
| 568 | std::optional<uint32_t> baseImage; |
| 569 | if (gFootpathSelection.legacyPath == kObjectEntryIndexNull) |
| 570 | { |
| 571 | auto selectedPath = gFootpathSelection.getSelectedSurface(); |
| 572 | const auto* pathType = GetPathSurfaceEntry(selectedPath); |
| 573 | if (pathType != nullptr) |
| 574 | { |
| 575 | baseImage = pathType->BaseImageId; |
| 576 | } |
| 577 | } |
| 578 | else |
| 579 | { |
| 580 | auto& objManager = GetContext()->GetObjectManager(); |
| 581 | const auto* pathObj = objManager.GetLoadedObject<FootpathObject>(gFootpathSelection.legacyPath); |
| 582 | if (pathObj != nullptr) |
| 583 | { |
| 584 | auto pathEntry = reinterpret_cast<const FootpathEntry*>(pathObj->GetLegacyData()); |
| 585 | if (gFootpathSelection.isQueueSelected) |
| 586 | baseImage = pathEntry->GetQueueImage(); |
| 587 | else |
| 588 | baseImage = pathEntry->image; |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | if (baseImage) |
| 593 | { |
| 594 | auto image = *baseImage + kConstructionPreviewImages[slopeOffset][direction]; |
| 595 | |
| 596 | // Draw construction image |
| 597 | screenCoords = this->windowPos |
| 598 | + ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 60 }; |
| 599 | GfxDrawSprite(rt, ImageId(image), screenCoords); |
| 600 | } |
| 601 | |
| 602 | // Draw build this... label |
| 603 | screenCoords = this->windowPos |
| 604 | + ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 23 }; |
| 605 | drawText(rt, screenCoords, STR_BUILD_THIS, { TextAlignment::centre }); |
| 606 | } |
| 607 | |
| 608 | // Draw cost |
| 609 | screenCoords = this->windowPos |
| 610 | + ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 12 }; |
| 611 | if (_windowFootpathCost != kMoney64Undefined) |
| 612 | { |
| 613 | if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) |
nothing calls this directly
no test coverage detected