forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 150
refactor(preferences): Move OptionPreferences class into separate files #1840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bobtista
wants to merge
6
commits into
TheSuperHackers:main
Choose a base branch
from
bobtista:bobtista/separate-option-preferences-files
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
37ac026
Create separate OptionPreferences files for GeneralsMD
bobtista 2d8dc83
Create separate OptionPreferences files for Generals
bobtista 5775359
Replace OptionPreferences declaration with include directive in UserP…
bobtista ca04e01
Remove OptionPreferences implementation from OptionsMenu
bobtista 579a4aa
Add OptionPreferences to build configuration
bobtista f7e888b
refactor: remove refactor comment from OptionPreferences files
bobtista File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
112 changes: 112 additions & 0 deletions
112
Generals/Code/GameEngine/Include/Common/OptionPreferences.h
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| /* | ||
| ** Command & Conquer Generals Zero Hour(tm) | ||
| ** Copyright 2025 Electronic Arts Inc. | ||
| ** | ||
| ** This program is free software: you can redistribute it and/or modify | ||
| ** it under the terms of the GNU General Public License as published by | ||
| ** the Free Software Foundation, either version 3 of the License, or | ||
| ** (at your option) any later version. | ||
| ** | ||
| ** This program is distributed in the hope that it will be useful, | ||
| ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ** GNU General Public License for more details. | ||
| ** | ||
| ** You should have received a copy of the GNU General Public License | ||
| ** along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////// | ||
| // // | ||
| // (c) 2001-2003 Electronic Arts Inc. // | ||
| // // | ||
| //////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| /////////////////////////////////////////////////////////////////////////////////////// | ||
| // FILE: OptionPreferences.h | ||
| // Author: Matthew D. Campbell, April 2002 | ||
| // Description: Options menu preferences class | ||
| /////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Common/UserPreferences.h" | ||
|
|
||
| class Money; | ||
| typedef UnsignedInt CursorCaptureMode; | ||
| typedef UnsignedInt ScreenEdgeScrollMode; | ||
|
|
||
| class OptionPreferences : public UserPreferences | ||
| { | ||
| public: | ||
| OptionPreferences( ); | ||
| virtual ~OptionPreferences(); | ||
|
|
||
| Bool loadFromIniFile(); | ||
|
|
||
| UnsignedInt getLANIPAddress(void); // convenience function | ||
| UnsignedInt getOnlineIPAddress(void); // convenience function | ||
| void setLANIPAddress(AsciiString IP); // convenience function | ||
| void setOnlineIPAddress(AsciiString IP); // convenience function | ||
| void setLANIPAddress(UnsignedInt IP); // convenience function | ||
| void setOnlineIPAddress(UnsignedInt IP); // convenience function | ||
| Bool getArchiveReplaysEnabled() const; // convenience function | ||
| Bool getAlternateMouseModeEnabled(void); // convenience function | ||
| Real getScrollFactor(void); // convenience function | ||
| Bool getDrawScrollAnchor(void); | ||
| Bool getMoveScrollAnchor(void); | ||
| Bool getCursorCaptureEnabledInWindowedGame() const; | ||
| Bool getCursorCaptureEnabledInWindowedMenu() const; | ||
| Bool getCursorCaptureEnabledInFullscreenGame() const; | ||
| Bool getCursorCaptureEnabledInFullscreenMenu() const; | ||
| CursorCaptureMode getCursorCaptureMode() const; | ||
| Bool getScreenEdgeScrollEnabledInWindowedApp() const; | ||
| Bool getScreenEdgeScrollEnabledInFullscreenApp() const; | ||
| ScreenEdgeScrollMode getScreenEdgeScrollMode() const; | ||
| Bool getSendDelay(void); // convenience function | ||
| Int getFirewallBehavior(void); // convenience function | ||
| Short getFirewallPortAllocationDelta(void); // convenience function | ||
| UnsignedShort getFirewallPortOverride(void); // convenience function | ||
| Bool getFirewallNeedToRefresh(void); // convenience function | ||
| Bool usesSystemMapDir(void); // convenience function | ||
| AsciiString getPreferred3DProvider(void); // convenience function | ||
| AsciiString getSpeakerType(void); // convenience function | ||
| Real getSoundVolume(void); // convenience function | ||
| Real get3DSoundVolume(void); // convenience function | ||
| Real getSpeechVolume(void); // convenience function | ||
| Real getMusicVolume(void); // convenience function | ||
| Real getMoneyTransactionVolume(void) const; | ||
| Bool saveCameraInReplays(void); | ||
| Bool useCameraInReplays(void); | ||
| Bool getPlayerObserverEnabled() const; | ||
| Int getStaticGameDetail(void); // detail level selected by the user. | ||
| Int getIdealStaticGameDetail(void); // detail level detected for user. | ||
| Real getGammaValue(void); | ||
| Int getTextureReduction(void); | ||
| void getResolution(Int *xres, Int *yres); | ||
| Bool get3DShadowsEnabled(void); | ||
| Bool get2DShadowsEnabled(void); | ||
| Bool getCloudShadowsEnabled(void); | ||
| Bool getLightmapEnabled(void); | ||
| Bool getSmoothWaterEnabled(void); | ||
| Bool getTreesEnabled(void); | ||
| Bool getExtraAnimationsDisabled(void); | ||
| Bool getDynamicLODEnabled(void); | ||
| Bool getFPSLimitEnabled(void); | ||
| Bool getNoDynamicLODEnabled(void); | ||
| Bool getBuildingOcclusionEnabled(void); | ||
| Int getParticleCap(void); | ||
|
|
||
| Int getCampaignDifficulty(void); | ||
| void setCampaignDifficulty( Int diff ); | ||
|
|
||
| Int getNetworkLatencyFontSize(void); | ||
| Int getRenderFpsFontSize(void); | ||
| Int getSystemTimeFontSize(void); | ||
| Int getGameTimeFontSize(void); | ||
|
|
||
| Real getResolutionFontAdjustment(void); | ||
|
|
||
| Bool getShowMoneyPerMinute(void) const; | ||
| }; | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,82 +72,8 @@ class UserPreferences : public PreferenceMap | |
| AsciiString m_filename; | ||
| }; | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now this moved away, I think you can remove the forward declarations above. |
||
| // OptionsPreferences options menu class | ||
| //----------------------------------------------------------------------------- | ||
| class OptionPreferences : public UserPreferences | ||
| { | ||
| public: | ||
| OptionPreferences( ); | ||
| virtual ~OptionPreferences(); | ||
|
|
||
| Bool loadFromIniFile(); | ||
|
|
||
| UnsignedInt getLANIPAddress(void); // convenience function | ||
| UnsignedInt getOnlineIPAddress(void); // convenience function | ||
| void setLANIPAddress(AsciiString IP); // convenience function | ||
| void setOnlineIPAddress(AsciiString IP); // convenience function | ||
| void setLANIPAddress(UnsignedInt IP); // convenience function | ||
| void setOnlineIPAddress(UnsignedInt IP); // convenience function | ||
| Bool getArchiveReplaysEnabled() const; // convenience function | ||
| Bool getAlternateMouseModeEnabled(void); // convenience function | ||
| Real getScrollFactor(void); // convenience function | ||
| Bool getDrawScrollAnchor(void); | ||
| Bool getMoveScrollAnchor(void); | ||
| Bool getCursorCaptureEnabledInWindowedGame() const; | ||
| Bool getCursorCaptureEnabledInWindowedMenu() const; | ||
| Bool getCursorCaptureEnabledInFullscreenGame() const; | ||
| Bool getCursorCaptureEnabledInFullscreenMenu() const; | ||
| CursorCaptureMode getCursorCaptureMode() const; | ||
| Bool getScreenEdgeScrollEnabledInWindowedApp() const; | ||
| Bool getScreenEdgeScrollEnabledInFullscreenApp() const; | ||
| ScreenEdgeScrollMode getScreenEdgeScrollMode() const; | ||
| Bool getSendDelay(void); // convenience function | ||
| Int getFirewallBehavior(void); // convenience function | ||
| Short getFirewallPortAllocationDelta(void); // convenience function | ||
| UnsignedShort getFirewallPortOverride(void); // convenience function | ||
| Bool getFirewallNeedToRefresh(void); // convenience function | ||
| Bool usesSystemMapDir(void); // convenience function | ||
| AsciiString getPreferred3DProvider(void); // convenience function | ||
| AsciiString getSpeakerType(void); // convenience function | ||
| Real getSoundVolume(void); // convenience function | ||
| Real get3DSoundVolume(void); // convenience function | ||
| Real getSpeechVolume(void); // convenience function | ||
| Real getMusicVolume(void); // convenience function | ||
| Real getMoneyTransactionVolume(void) const; | ||
| Bool saveCameraInReplays(void); | ||
| Bool useCameraInReplays(void); | ||
| Bool getPlayerObserverEnabled() const; | ||
| Int getStaticGameDetail(void); // detail level selected by the user. | ||
| Int getIdealStaticGameDetail(void); // detail level detected for user. | ||
| Real getGammaValue(void); | ||
| Int getTextureReduction(void); | ||
| void getResolution(Int *xres, Int *yres); | ||
| Bool get3DShadowsEnabled(void); | ||
| Bool get2DShadowsEnabled(void); | ||
| Bool getCloudShadowsEnabled(void); | ||
| Bool getLightmapEnabled(void); | ||
| Bool getSmoothWaterEnabled(void); | ||
| Bool getTreesEnabled(void); | ||
| Bool getExtraAnimationsDisabled(void); | ||
| Bool getDynamicLODEnabled(void); | ||
| Bool getFPSLimitEnabled(void); | ||
| Bool getNoDynamicLODEnabled(void); | ||
| Bool getBuildingOcclusionEnabled(void); | ||
| Int getParticleCap(void); | ||
|
|
||
| Int getCampaignDifficulty(void); | ||
| void setCampaignDifficulty( Int diff ); | ||
|
|
||
| Int getNetworkLatencyFontSize(void); | ||
| Int getRenderFpsFontSize(void); | ||
| Int getSystemTimeFontSize(void); | ||
| Int getGameTimeFontSize(void); | ||
|
|
||
| Real getResolutionFontAdjustment(void); | ||
|
|
||
| Bool getShowMoneyPerMinute(void) const; | ||
| }; | ||
| // TheSuperHackers @refactor bobtista 13/11/2025 Moved OptionPreferences to separate files. | ||
bobtista marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not need to be documented. |
||
| #include "Common/OptionPreferences.h" | ||
|
|
||
| //----------------------------------------------------------------------------- | ||
| // LANPreferences class | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to be alphabetically sorted.