UserPreferences.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. ///////////////////////////////////////////////////////////////////////////////////////
  24. // FILE: UserPreferences.h
  25. // Author: Matthew D. Campbell, April 2002
  26. // Description: Saving/Loading of user preferences
  27. ///////////////////////////////////////////////////////////////////////////////////////
  28. #pragma once
  29. #ifndef __USERPREFERENCES_H__
  30. #define __USERPREFERENCES_H__
  31. //-----------------------------------------------------------------------------
  32. // USER INCLUDES //////////////////////////////////////////////////////////////
  33. //-----------------------------------------------------------------------------
  34. #include "Common/STLTypedefs.h"
  35. class Money;
  36. //-----------------------------------------------------------------------------
  37. // PUBLIC TYPES ///////////////////////////////////////////////////////////////
  38. //-----------------------------------------------------------------------------
  39. typedef std::map<AsciiString, AsciiString> PreferenceMap;
  40. //-----------------------------------------------------------------------------
  41. // UserPreferences base class
  42. //-----------------------------------------------------------------------------
  43. class UserPreferences : public PreferenceMap
  44. {
  45. public:
  46. UserPreferences();
  47. virtual ~UserPreferences();
  48. virtual Bool load(AsciiString fname);
  49. virtual Bool write(void);
  50. Bool getBool(AsciiString key, Bool defaultValue) const;
  51. Real getReal(AsciiString key, Real defaultValue) const;
  52. Int getInt(AsciiString key, Int defaultValue) const;
  53. AsciiString getAsciiString(AsciiString key, AsciiString defaultValue) const;
  54. void setBool(AsciiString key, Bool val);
  55. void setReal(AsciiString key, Real val);
  56. void setInt(AsciiString key, Int val);
  57. void setAsciiString(AsciiString key, AsciiString val);
  58. protected:
  59. AsciiString m_filename;
  60. };
  61. //-----------------------------------------------------------------------------
  62. // OptionsPreferences options menu class
  63. //-----------------------------------------------------------------------------
  64. class OptionPreferences : public UserPreferences
  65. {
  66. public:
  67. OptionPreferences( );
  68. virtual ~OptionPreferences();
  69. UnsignedInt getLANIPAddress(void); // convenience function
  70. UnsignedInt getOnlineIPAddress(void); // convenience function
  71. void setLANIPAddress(AsciiString IP); // convenience function
  72. void setOnlineIPAddress(AsciiString IP); // convenience function
  73. void setLANIPAddress(UnsignedInt IP); // convenience function
  74. void setOnlineIPAddress(UnsignedInt IP); // convenience function
  75. Bool getAlternateMouseModeEnabled(void); // convenience function
  76. Bool getRetaliationModeEnabled(); // convenience function
  77. Bool getDoubleClickAttackMoveEnabled(void); // convenience function
  78. Real getScrollFactor(void); // convenience function
  79. Bool getSendDelay(void); // convenience function
  80. Int getFirewallBehavior(void); // convenience function
  81. Short getFirewallPortAllocationDelta(void); // convenience function
  82. UnsignedShort getFirewallPortOverride(void); // convenience function
  83. Bool getFirewallNeedToRefresh(void); // convenience function
  84. Bool usesSystemMapDir(void); // convenience function
  85. AsciiString getPreferred3DProvider(void); // convenience function
  86. AsciiString getSpeakerType(void); // convenience function
  87. Real getSoundVolume(void); // convenience function
  88. Real get3DSoundVolume(void); // convenience function
  89. Real getSpeechVolume(void); // convenience function
  90. Real getMusicVolume(void); // convenience function
  91. Bool saveCameraInReplays(void);
  92. Bool useCameraInReplays(void);
  93. Int getStaticGameDetail(void); // detail level selected by the user.
  94. Int getIdealStaticGameDetail(void); // detail level detected for user.
  95. Real getGammaValue(void);
  96. Int getTextureReduction(void);
  97. void getResolution(Int *xres, Int *yres);
  98. Bool get3DShadowsEnabled(void);
  99. Bool get2DShadowsEnabled(void);
  100. Bool getCloudShadowsEnabled(void);
  101. Bool getLightmapEnabled(void);
  102. Bool getSmoothWaterEnabled(void);
  103. Bool getTreesEnabled(void);
  104. Bool getExtraAnimationsDisabled(void);
  105. Bool getUseHeatEffects(void);
  106. Bool getDynamicLODEnabled(void);
  107. Bool getFPSLimitEnabled(void);
  108. Bool getNoDynamicLODEnabled(void);
  109. Bool getBuildingOcclusionEnabled(void);
  110. Int getParticleCap(void);
  111. Int getCampaignDifficulty(void);
  112. void setCampaignDifficulty( Int diff );
  113. };
  114. //-----------------------------------------------------------------------------
  115. // LANPreferences class
  116. //-----------------------------------------------------------------------------
  117. class LANPreferences : public UserPreferences
  118. {
  119. public:
  120. LANPreferences();
  121. virtual ~LANPreferences();
  122. UnicodeString getUserName(void); // convenience function
  123. Int getPreferredFaction(void); // convenience function
  124. Int getPreferredColor(void); // convenience function
  125. AsciiString getPreferredMap(void); // convenience function
  126. Bool usesSystemMapDir(void); // convenience function
  127. Int getNumRemoteIPs(void); // convenience function
  128. UnicodeString getRemoteIPEntry(Int i); // convenience function
  129. Bool getSuperweaponRestricted(void) const;
  130. Money getStartingCash(void) const;
  131. void setSuperweaponRestricted( Bool superweaponRestricted);
  132. void setStartingCash( const Money & startingCash );
  133. };
  134. #endif // __USERPREFERENCES_H__