1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 13:39:09 +00:00

Codechange: replace LeastCommonMultiple with std::lcm

This commit is contained in:
Rubidium
2024-01-20 15:58:37 +01:00
committed by rubidium42
parent bd85f61a40
commit 1403f24fa9
2 changed files with 12 additions and 12 deletions

View File

@@ -1239,10 +1239,10 @@ void NWidgetStacked::SetupSmallestSize(Window *w)
this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding.Horizontal());
this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding.Vertical());
this->fill_x = LeastCommonMultiple(this->fill_x, child_wid->fill_x);
this->fill_y = LeastCommonMultiple(this->fill_y, child_wid->fill_y);
this->resize_x = LeastCommonMultiple(this->resize_x, child_wid->resize_x);
this->resize_y = LeastCommonMultiple(this->resize_y, child_wid->resize_y);
this->fill_x = std::lcm(this->fill_x, child_wid->fill_x);
this->fill_y = std::lcm(this->fill_y, child_wid->fill_y);
this->resize_x = std::lcm(this->resize_x, child_wid->resize_x);
this->resize_y = std::lcm(this->resize_y, child_wid->resize_y);
}
}
@@ -1409,12 +1409,12 @@ void NWidgetHorizontal::SetupSmallestSize(Window *w)
if (child_wid->fill_x > 0) {
if (this->fill_x == 0 || this->fill_x > child_wid->fill_x) this->fill_x = child_wid->fill_x;
}
this->fill_y = LeastCommonMultiple(this->fill_y, child_wid->fill_y);
this->fill_y = std::lcm(this->fill_y, child_wid->fill_y);
if (child_wid->resize_x > 0) {
if (this->resize_x == 0 || this->resize_x > child_wid->resize_x) this->resize_x = child_wid->resize_x;
}
this->resize_y = LeastCommonMultiple(this->resize_y, child_wid->resize_y);
this->resize_y = std::lcm(this->resize_y, child_wid->resize_y);
}
if (this->fill_x == 0 && this->pip_ratio_pre + this->pip_ratio_inter + this->pip_ratio_post > 0) this->fill_x = 1;
/* 4. Increase by required PIP space. */
@@ -1598,12 +1598,12 @@ void NWidgetVertical::SetupSmallestSize(Window *w)
if (child_wid->fill_y > 0) {
if (this->fill_y == 0 || this->fill_y > child_wid->fill_y) this->fill_y = child_wid->fill_y;
}
this->fill_x = LeastCommonMultiple(this->fill_x, child_wid->fill_x);
this->fill_x = std::lcm(this->fill_x, child_wid->fill_x);
if (child_wid->resize_y > 0) {
if (this->resize_y == 0 || this->resize_y > child_wid->resize_y) this->resize_y = child_wid->resize_y;
}
this->resize_x = LeastCommonMultiple(this->resize_x, child_wid->resize_x);
this->resize_x = std::lcm(this->resize_x, child_wid->resize_x);
}
if (this->fill_y == 0 && this->pip_ratio_pre + this->pip_ratio_inter + this->pip_ratio_post > 0) this->fill_y = 1;
/* 4. Increase by required PIP space. */