-
-
Save LordAro/fe545573f64e6c9375961c5fe3dfc208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp | |
index d34f59e09f..a3a8bd7dcc 100644 | |
--- a/src/framerate_gui.cpp | |
+++ b/src/framerate_gui.cpp | |
@@ -435,7 +435,7 @@ struct FramerateWindow : Window { | |
this->next_update.SetInterval(100); | |
/* Window is always initialised to MIN_ELEMENTS height, resize to contain num_displayed */ | |
- ResizeWindow(this, 0, (max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL); | |
+ ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL); | |
} | |
void OnRealtimeTick(uint delta_ms) override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/ld: CMakeFiles/openttd.dir/src/framerate_gui.cpp.o: warning: relocation against `_ZN15FramerateWindow12MIN_ELEMENTSE' in read-only section `.text._ZN15FramerateWindowC2EP10WindowDesci[_ZN15FramerateWindowC5EP10WindowDesci]' | |
/usr/bin/ld: CMakeFiles/openttd.dir/src/framerate_gui.cpp.o: in function `FramerateWindow::FramerateWindow(WindowDesc*, int)': | |
/home/lordaro/dev/openttd/src/framerate_gui.cpp:438: undefined reference to `FramerateWindow::MIN_ELEMENTS' | |
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE | |
collect2: error: ld returned 1 exit status |
Or a smaller variant:
diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp
index d34f59e09..c65967259 100644
--- a/src/framerate_gui.cpp
+++ b/src/framerate_gui.cpp
@@ -422,8 +422,8 @@ struct FramerateWindow : Window {
CachedDecimal times_shortterm[PFE_MAX]; ///< cached short term average times
CachedDecimal times_longterm[PFE_MAX]; ///< cached long term average times
- static const int VSPACING = 3; ///< space between column heading and values
- static const int MIN_ELEMENTS = 5; ///< smallest number of elements to display
+ const int VSPACING = 3; ///< space between column heading and values
+ const int MIN_ELEMENTS = 5; ///< smallest number of elements to display
FramerateWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
{
@@ -435,7 +435,7 @@ struct FramerateWindow : Window {
this->next_update.SetInterval(100);
/* Window is always initialised to MIN_ELEMENTS height, resize to contain num_displayed */
- ResizeWindow(this, 0, (max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
+ ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
}
void OnRealtimeTick(uint delta_ms) override
Or, another alternative:
diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp
index d34f59e09..93d326dc5 100644
--- a/src/framerate_gui.cpp
+++ b/src/framerate_gui.cpp
@@ -422,8 +422,8 @@ struct FramerateWindow : Window {
CachedDecimal times_shortterm[PFE_MAX]; ///< cached short term average times
CachedDecimal times_longterm[PFE_MAX]; ///< cached long term average times
- static const int VSPACING = 3; ///< space between column heading and values
- static const int MIN_ELEMENTS = 5; ///< smallest number of elements to display
+ static constexpr int VSPACING = 3; ///< space between column heading and values
+ static constexpr int MIN_ELEMENTS = 5; ///< smallest number of elements to display
FramerateWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
{
@@ -435,7 +435,7 @@ struct FramerateWindow : Window {
this->next_update.SetInterval(100);
/* Window is always initialised to MIN_ELEMENTS height, resize to contain num_displayed */
- ResizeWindow(this, 0, (max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
+ ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
}
void OnRealtimeTick(uint delta_ms) override
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My solution:
That works fine :)