1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-26 05:34:12 +01:00

Codechange: Use EnumBitSet for AspectFlags.

This commit is contained in:
Peter Nelson
2025-01-29 17:47:50 +00:00
committed by Peter Nelson
parent 5ef495da78
commit cea62a8399
2 changed files with 10 additions and 11 deletions

View File

@@ -932,8 +932,8 @@ void NWidgetBase::ApplyAspectRatio()
uint x = this->smallest_x;
uint y = this->smallest_y;
if (HasFlag(this->aspect_flags, AspectFlags::ResizeX)) x = std::max(this->smallest_x, static_cast<uint>(this->smallest_y * std::abs(this->aspect_ratio)));
if (HasFlag(this->aspect_flags, AspectFlags::ResizeY)) y = std::max(this->smallest_y, static_cast<uint>(this->smallest_x / std::abs(this->aspect_ratio)));
if (this->aspect_flags.Test(AspectFlag::ResizeX)) x = std::max(this->smallest_x, static_cast<uint>(this->smallest_y * std::abs(this->aspect_ratio)));
if (this->aspect_flags.Test(AspectFlag::ResizeY)) y = std::max(this->smallest_y, static_cast<uint>(this->smallest_x / std::abs(this->aspect_ratio)));
this->smallest_x = x;
this->smallest_y = y;