Codechange: Use EnumBitSet for WindowFlags.

This commit is contained in:
Peter Nelson
2025-01-30 08:40:42 +00:00
committed by Peter Nelson
parent 248f369e86
commit efb05396a7
21 changed files with 81 additions and 80 deletions
+6 -6
View File
@@ -726,7 +726,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_HEIGHTMAP_HEIGHT_DOWN:
case WID_GL_HEIGHTMAP_HEIGHT_UP: // Height level buttons
/* Don't allow too fast scrolling */
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
if (!this->flags.Test(WindowFlag::Timeout) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget);
_settings_newgame.game_creation.heightmap_height = Clamp(_settings_newgame.game_creation.heightmap_height + widget - WID_GL_HEIGHTMAP_HEIGHT_TEXT, MIN_HEIGHTMAP_HEIGHT, GetMapHeightLimit());
@@ -745,7 +745,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_START_DATE_DOWN:
case WID_GL_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
if (!this->flags.Test(WindowFlag::Timeout) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget);
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_GL_START_DATE_TEXT, CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
@@ -763,7 +763,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_SNOW_COVERAGE_DOWN:
case WID_GL_SNOW_COVERAGE_UP: // Snow coverage buttons
/* Don't allow too fast scrolling */
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
if (!this->flags.Test(WindowFlag::Timeout) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget);
_settings_newgame.game_creation.snow_coverage = Clamp(_settings_newgame.game_creation.snow_coverage + (widget - WID_GL_SNOW_COVERAGE_TEXT) * 10, 0, 100);
@@ -781,7 +781,7 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_DESERT_COVERAGE_DOWN:
case WID_GL_DESERT_COVERAGE_UP: // Desert coverage buttons
/* Don't allow too fast scrolling */
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
if (!this->flags.Test(WindowFlag::Timeout) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget);
_settings_newgame.game_creation.desert_coverage = Clamp(_settings_newgame.game_creation.desert_coverage + (widget - WID_GL_DESERT_COVERAGE_TEXT) * 10, 0, 100);
@@ -1180,7 +1180,7 @@ struct CreateScenarioWindow : public Window
case WID_CS_START_DATE_DOWN:
case WID_CS_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
if (!this->flags.Test(WindowFlag::Timeout) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget);
this->SetDirty();
@@ -1198,7 +1198,7 @@ struct CreateScenarioWindow : public Window
case WID_CS_FLAT_LAND_HEIGHT_DOWN:
case WID_CS_FLAT_LAND_HEIGHT_UP: // Height level buttons
/* Don't allow too fast scrolling */
if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
if (!this->flags.Test(WindowFlag::Timeout) || this->timeout_timer <= 1) {
this->HandleButtonClick(widget);
this->SetDirty();