mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Make the progress bar work with large numbers
Fix the progress bar freaking out
This commit is contained in:
@@ -198,9 +198,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
int16_t vehicleWidth = (vehicle != nullptr) ? vehicle->width : 0;
|
||||
int32_t position;
|
||||
if (_totalCount > 0)
|
||||
position = (-vehicleWidth + 2) + width * _currentProgress / _totalCount;
|
||||
{
|
||||
const auto progress = static_cast<double>(_currentProgress) / _totalCount;
|
||||
position = static_cast<int32_t>((-vehicleWidth + 2) + width * progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
position = (vehicleWidth + width) / 2;
|
||||
}
|
||||
|
||||
GfxDrawSprite(clipDPI, variant.vehicle, ScreenCoordsXY(position, widget.bottom + 1));
|
||||
}
|
||||
@@ -208,9 +213,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
void setCaption(const std::string& text)
|
||||
{
|
||||
_progressTitle = text;
|
||||
_currentProgress = 0;
|
||||
_totalCount = 0;
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user