| 1 | // ============================================================== |
|---|
| 2 | // This file is part of Glest (www.glest.org) |
|---|
| 3 | // |
|---|
| 4 | // Copyright (C) 2001-2008 Martiño Figueroa |
|---|
| 5 | // 2008-2009 Daniel Santos <daniel.santos@pobox.com> |
|---|
| 6 | // |
|---|
| 7 | // You can redistribute this code and/or modify it under |
|---|
| 8 | // the terms of the GNU General Public License as published |
|---|
| 9 | // by the Free Software Foundation; either version 2 of the |
|---|
| 10 | // License, or (at your option) any later version |
|---|
| 11 | // ============================================================== |
|---|
| 12 | |
|---|
| 13 | // This file is auto-generated from config.h.template using ../config.db and the script |
|---|
| 14 | // ../mkconfig.sh. To modify actual config settings, edit config.db and re-run ../mkconfig.sh. |
|---|
| 15 | |
|---|
| 16 | #ifndef _GLEST_GAME_CONFIG_H_ |
|---|
| 17 | #define _GLEST_GAME_CONFIG_H_ |
|---|
| 18 | |
|---|
| 19 | #include "properties.h" |
|---|
| 20 | |
|---|
| 21 | namespace Glest { namespace Game { |
|---|
| 22 | |
|---|
| 23 | using Shared::Util::Properties; |
|---|
| 24 | |
|---|
| 25 | // ===================================================== |
|---|
| 26 | // class Config |
|---|
| 27 | // |
|---|
| 28 | // Game configuration |
|---|
| 29 | // ===================================================== |
|---|
| 30 | |
|---|
| 31 | class Config { |
|---|
| 32 | private: |
|---|
| 33 | Properties *properties; |
|---|
| 34 | string fileName; |
|---|
| 35 | |
|---|
| 36 | float cameraFov; |
|---|
| 37 | bool cameraInvertXAxis; |
|---|
| 38 | bool cameraInvertYAxis; |
|---|
| 39 | float cameraMaxDistance; |
|---|
| 40 | float cameraMaxYaw; |
|---|
| 41 | float cameraMinDistance; |
|---|
| 42 | float cameraMinYaw; |
|---|
| 43 | int displayHeight; |
|---|
| 44 | int displayRefreshFrequency; |
|---|
| 45 | int displayWidth; |
|---|
| 46 | bool displayWindowed; |
|---|
| 47 | bool gsAutoRepairEnabled; |
|---|
| 48 | bool gsAutoReturnEnabled; |
|---|
| 49 | float gsDayTime; |
|---|
| 50 | bool gsFogOfWarEnabled; |
|---|
| 51 | float gsSpeedFastest; |
|---|
| 52 | float gsSpeedSlowest; |
|---|
| 53 | int gsWorldUpdateFps; |
|---|
| 54 | int miscAiLog; |
|---|
| 55 | bool miscAiRedir; |
|---|
| 56 | bool miscAutoTest; |
|---|
| 57 | bool miscCatchExceptions; |
|---|
| 58 | bool miscDebugKeys; |
|---|
| 59 | bool miscDebugMode; |
|---|
| 60 | int miscDebugTextureMode; |
|---|
| 61 | bool miscDebugTextures; |
|---|
| 62 | bool miscFirstTime; |
|---|
| 63 | bool netChangeSpeedAllowed; |
|---|
| 64 | bool netConsistencyChecks; |
|---|
| 65 | int netFps; |
|---|
| 66 | int netMinFullUpdateInterval; |
|---|
| 67 | bool netPauseAllowed; |
|---|
| 68 | string netPlayerName; |
|---|
| 69 | string netServerIp; |
|---|
| 70 | int netServerPort; |
|---|
| 71 | int pathFinderMaxNodes; |
|---|
| 72 | bool pathFinderUseAStar; |
|---|
| 73 | bool renderCheckGlCaps; |
|---|
| 74 | int renderColorBits; |
|---|
| 75 | int renderDepthBits; |
|---|
| 76 | float renderDistanceMax; |
|---|
| 77 | float renderDistanceMin; |
|---|
| 78 | int renderFilterMaxAnisotropy; |
|---|
| 79 | string renderFilter; |
|---|
| 80 | bool renderFogOfWarSmoothing; |
|---|
| 81 | int renderFogOfWarSmoothingFrameSkip; |
|---|
| 82 | string renderFontConsole; |
|---|
| 83 | string renderFontDisplay; |
|---|
| 84 | string renderFontMenu; |
|---|
| 85 | float renderFov; |
|---|
| 86 | int renderFpsMax; |
|---|
| 87 | string renderGraphicsFactory; |
|---|
| 88 | int renderLightsMax; |
|---|
| 89 | float renderShadowAlpha; |
|---|
| 90 | int renderShadowFrameSkip; |
|---|
| 91 | string renderShadows; |
|---|
| 92 | int renderShadowTextureSize; |
|---|
| 93 | int renderStencilBits; |
|---|
| 94 | bool renderTextures3D; |
|---|
| 95 | string soundFactory; |
|---|
| 96 | int soundStaticBuffers; |
|---|
| 97 | int soundStreamingBuffers; |
|---|
| 98 | int soundVolumeAmbient; |
|---|
| 99 | int soundVolumeFx; |
|---|
| 100 | int soundVolumeMusic; |
|---|
| 101 | int uiConsoleMaxLines; |
|---|
| 102 | int uiConsoleTimeout; |
|---|
| 103 | bool uiEnableCommandMinimap; |
|---|
| 104 | bool uiFocusArrows; |
|---|
| 105 | string uiLastMap; |
|---|
| 106 | bool uiLastRandStartLocs; |
|---|
| 107 | string uiLastScenarioCatagory; |
|---|
| 108 | string uiLastScenario; |
|---|
| 109 | string uiLastTechTree; |
|---|
| 110 | string uiLastTileset; |
|---|
| 111 | string uiLocale; |
|---|
| 112 | bool uiPhotoMode; |
|---|
| 113 | bool uiRandomStartLocations; |
|---|
| 114 | float uiScrollSpeed; |
|---|
| 115 | |
|---|
| 116 | Config(const char* fileName); |
|---|
| 117 | |
|---|
| 118 | static bool isWindows() { |
|---|
| 119 | #if defined(WIN32) || defined(WIN64) |
|---|
| 120 | return true; |
|---|
| 121 | #else |
|---|
| 122 | return false; |
|---|
| 123 | #endif |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | const char *getDefaultFontStr() const { |
|---|
| 127 | if(isWindows()) { |
|---|
| 128 | return "Verdana"; |
|---|
| 129 | } else { |
|---|
| 130 | return "-*-*-*-*-*-12-*-*-*-*-*-*-*"; |
|---|
| 131 | } |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | public: |
|---|
| 135 | static Config &getInstance() { |
|---|
| 136 | static Config singleton("glestadv.ini"); |
|---|
| 137 | return singleton; |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | void save(const char *path = "glestadv.ini"); |
|---|
| 141 | |
|---|
| 142 | float getCameraFov() const {return cameraFov;} |
|---|
| 143 | bool getCameraInvertXAxis() const {return cameraInvertXAxis;} |
|---|
| 144 | bool getCameraInvertYAxis() const {return cameraInvertYAxis;} |
|---|
| 145 | float getCameraMaxDistance() const {return cameraMaxDistance;} |
|---|
| 146 | float getCameraMaxYaw() const {return cameraMaxYaw;} |
|---|
| 147 | float getCameraMinDistance() const {return cameraMinDistance;} |
|---|
| 148 | float getCameraMinYaw() const {return cameraMinYaw;} |
|---|
| 149 | int getDisplayHeight() const {return displayHeight;} |
|---|
| 150 | int getDisplayRefreshFrequency() const {return displayRefreshFrequency;} |
|---|
| 151 | int getDisplayWidth() const {return displayWidth;} |
|---|
| 152 | bool getDisplayWindowed() const {return displayWindowed;} |
|---|
| 153 | bool getGsAutoRepairEnabled() const {return gsAutoRepairEnabled;} |
|---|
| 154 | bool getGsAutoReturnEnabled() const {return gsAutoReturnEnabled;} |
|---|
| 155 | float getGsDayTime() const {return gsDayTime;} |
|---|
| 156 | bool getGsFogOfWarEnabled() const {return gsFogOfWarEnabled;} |
|---|
| 157 | float getGsSpeedFastest() const {return gsSpeedFastest;} |
|---|
| 158 | float getGsSpeedSlowest() const {return gsSpeedSlowest;} |
|---|
| 159 | int getGsWorldUpdateFps() const {return gsWorldUpdateFps;} |
|---|
| 160 | int getMiscAiLog() const {return miscAiLog;} |
|---|
| 161 | bool getMiscAiRedir() const {return miscAiRedir;} |
|---|
| 162 | bool getMiscAutoTest() const {return miscAutoTest;} |
|---|
| 163 | bool getMiscCatchExceptions() const {return miscCatchExceptions;} |
|---|
| 164 | bool getMiscDebugKeys() const {return miscDebugKeys;} |
|---|
| 165 | bool getMiscDebugMode() const {return miscDebugMode;} |
|---|
| 166 | int getMiscDebugTextureMode() const {return miscDebugTextureMode;} |
|---|
| 167 | bool getMiscDebugTextures() const {return miscDebugTextures;} |
|---|
| 168 | bool getMiscFirstTime() const {return miscFirstTime;} |
|---|
| 169 | bool getNetChangeSpeedAllowed() const {return netChangeSpeedAllowed;} |
|---|
| 170 | bool getNetConsistencyChecks() const {return netConsistencyChecks;} |
|---|
| 171 | int getNetFps() const {return netFps;} |
|---|
| 172 | int getNetMinFullUpdateInterval() const {return netMinFullUpdateInterval;} |
|---|
| 173 | bool getNetPauseAllowed() const {return netPauseAllowed;} |
|---|
| 174 | const string &getNetPlayerName() const {return netPlayerName;} |
|---|
| 175 | const string &getNetServerIp() const {return netServerIp;} |
|---|
| 176 | int getNetServerPort() const {return netServerPort;} |
|---|
| 177 | int getPathFinderMaxNodes() const {return pathFinderMaxNodes;} |
|---|
| 178 | bool getPathFinderUseAStar() const {return pathFinderUseAStar;} |
|---|
| 179 | bool getRenderCheckGlCaps() const {return renderCheckGlCaps;} |
|---|
| 180 | int getRenderColorBits() const {return renderColorBits;} |
|---|
| 181 | int getRenderDepthBits() const {return renderDepthBits;} |
|---|
| 182 | float getRenderDistanceMax() const {return renderDistanceMax;} |
|---|
| 183 | float getRenderDistanceMin() const {return renderDistanceMin;} |
|---|
| 184 | int getRenderFilterMaxAnisotropy() const {return renderFilterMaxAnisotropy;} |
|---|
| 185 | const string &getRenderFilter() const {return renderFilter;} |
|---|
| 186 | bool getRenderFogOfWarSmoothing() const {return renderFogOfWarSmoothing;} |
|---|
| 187 | int getRenderFogOfWarSmoothingFrameSkip() const {return renderFogOfWarSmoothingFrameSkip;} |
|---|
| 188 | const string &getRenderFontConsole() const {return renderFontConsole;} |
|---|
| 189 | const string &getRenderFontDisplay() const {return renderFontDisplay;} |
|---|
| 190 | const string &getRenderFontMenu() const {return renderFontMenu;} |
|---|
| 191 | float getRenderFov() const {return renderFov;} |
|---|
| 192 | int getRenderFpsMax() const {return renderFpsMax;} |
|---|
| 193 | const string &getRenderGraphicsFactory() const {return renderGraphicsFactory;} |
|---|
| 194 | int getRenderLightsMax() const {return renderLightsMax;} |
|---|
| 195 | float getRenderShadowAlpha() const {return renderShadowAlpha;} |
|---|
| 196 | int getRenderShadowFrameSkip() const {return renderShadowFrameSkip;} |
|---|
| 197 | const string &getRenderShadows() const {return renderShadows;} |
|---|
| 198 | int getRenderShadowTextureSize() const {return renderShadowTextureSize;} |
|---|
| 199 | int getRenderStencilBits() const {return renderStencilBits;} |
|---|
| 200 | bool getRenderTextures3D() const {return renderTextures3D;} |
|---|
| 201 | const string &getSoundFactory() const {return soundFactory;} |
|---|
| 202 | int getSoundStaticBuffers() const {return soundStaticBuffers;} |
|---|
| 203 | int getSoundStreamingBuffers() const {return soundStreamingBuffers;} |
|---|
| 204 | int getSoundVolumeAmbient() const {return soundVolumeAmbient;} |
|---|
| 205 | int getSoundVolumeFx() const {return soundVolumeFx;} |
|---|
| 206 | int getSoundVolumeMusic() const {return soundVolumeMusic;} |
|---|
| 207 | int getUiConsoleMaxLines() const {return uiConsoleMaxLines;} |
|---|
| 208 | int getUiConsoleTimeout() const {return uiConsoleTimeout;} |
|---|
| 209 | bool getUiEnableCommandMinimap() const {return uiEnableCommandMinimap;} |
|---|
| 210 | bool getUiFocusArrows() const {return uiFocusArrows;} |
|---|
| 211 | const string &getUiLastMap() const {return uiLastMap;} |
|---|
| 212 | bool getUiLastRandStartLocs() const {return uiLastRandStartLocs;} |
|---|
| 213 | const string &getUiLastScenarioCatagory() const {return uiLastScenarioCatagory;} |
|---|
| 214 | const string &getUiLastScenario() const {return uiLastScenario;} |
|---|
| 215 | const string &getUiLastTechTree() const {return uiLastTechTree;} |
|---|
| 216 | const string &getUiLastTileset() const {return uiLastTileset;} |
|---|
| 217 | const string &getUiLocale() const {return uiLocale;} |
|---|
| 218 | bool getUiPhotoMode() const {return uiPhotoMode;} |
|---|
| 219 | bool getUiRandomStartLocations() const {return uiRandomStartLocations;} |
|---|
| 220 | float getUiScrollSpeed() const {return uiScrollSpeed;} |
|---|
| 221 | |
|---|
| 222 | void setCameraFov(float v) {cameraFov = v;} |
|---|
| 223 | void setCameraInvertXAxis(bool v) {cameraInvertXAxis = v;} |
|---|
| 224 | void setCameraInvertYAxis(bool v) {cameraInvertYAxis = v;} |
|---|
| 225 | void setCameraMaxDistance(float v) {cameraMaxDistance = v;} |
|---|
| 226 | void setCameraMaxYaw(float v) {cameraMaxYaw = v;} |
|---|
| 227 | void setCameraMinDistance(float v) {cameraMinDistance = v;} |
|---|
| 228 | void setCameraMinYaw(float v) {cameraMinYaw = v;} |
|---|
| 229 | void setDisplayHeight(int v) {displayHeight = v;} |
|---|
| 230 | void setDisplayRefreshFrequency(int v) {displayRefreshFrequency = v;} |
|---|
| 231 | void setDisplayWidth(int v) {displayWidth = v;} |
|---|
| 232 | void setDisplayWindowed(bool v) {displayWindowed = v;} |
|---|
| 233 | void setGsAutoRepairEnabled(bool v) {gsAutoRepairEnabled = v;} |
|---|
| 234 | void setGsAutoReturnEnabled(bool v) {gsAutoReturnEnabled = v;} |
|---|
| 235 | void setGsDayTime(float v) {gsDayTime = v;} |
|---|
| 236 | void setGsFogOfWarEnabled(bool v) {gsFogOfWarEnabled = v;} |
|---|
| 237 | void setGsSpeedFastest(float v) {gsSpeedFastest = v;} |
|---|
| 238 | void setGsSpeedSlowest(float v) {gsSpeedSlowest = v;} |
|---|
| 239 | void setGsWorldUpdateFps(int v) {gsWorldUpdateFps = v;} |
|---|
| 240 | void setMiscAiLog(int v) {miscAiLog = v;} |
|---|
| 241 | void setMiscAiRedir(bool v) {miscAiRedir = v;} |
|---|
| 242 | void setMiscAutoTest(bool v) {miscAutoTest = v;} |
|---|
| 243 | void setMiscCatchExceptions(bool v) {miscCatchExceptions = v;} |
|---|
| 244 | void setMiscDebugKeys(bool v) {miscDebugKeys = v;} |
|---|
| 245 | void setMiscDebugMode(bool v) {miscDebugMode = v;} |
|---|
| 246 | void setMiscDebugTextureMode(int v) {miscDebugTextureMode = v;} |
|---|
| 247 | void setMiscDebugTextures(bool v) {miscDebugTextures = v;} |
|---|
| 248 | void setMiscFirstTime(bool v) {miscFirstTime = v;} |
|---|
| 249 | void setNetChangeSpeedAllowed(bool v) {netChangeSpeedAllowed = v;} |
|---|
| 250 | void setNetConsistencyChecks(bool v) {netConsistencyChecks = v;} |
|---|
| 251 | void setNetFps(int v) {netFps = v;} |
|---|
| 252 | void setNetMinFullUpdateInterval(int v) {netMinFullUpdateInterval = v;} |
|---|
| 253 | void setNetPauseAllowed(bool v) {netPauseAllowed = v;} |
|---|
| 254 | void setNetPlayerName(const string &v) {netPlayerName = v;} |
|---|
| 255 | void setNetServerIp(const string &v) {netServerIp = v;} |
|---|
| 256 | void setNetServerPort(int v) {netServerPort = v;} |
|---|
| 257 | void setPathFinderMaxNodes(int v) {pathFinderMaxNodes = v;} |
|---|
| 258 | void setPathFinderUseAStar(bool v) {pathFinderUseAStar = v;} |
|---|
| 259 | void setRenderCheckGlCaps(bool v) {renderCheckGlCaps = v;} |
|---|
| 260 | void setRenderColorBits(int v) {renderColorBits = v;} |
|---|
| 261 | void setRenderDepthBits(int v) {renderDepthBits = v;} |
|---|
| 262 | void setRenderDistanceMax(float v) {renderDistanceMax = v;} |
|---|
| 263 | void setRenderDistanceMin(float v) {renderDistanceMin = v;} |
|---|
| 264 | void setRenderFilterMaxAnisotropy(int v) {renderFilterMaxAnisotropy = v;} |
|---|
| 265 | void setRenderFilter(const string &v) {renderFilter = v;} |
|---|
| 266 | void setRenderFogOfWarSmoothing(bool v) {renderFogOfWarSmoothing = v;} |
|---|
| 267 | void setRenderFogOfWarSmoothingFrameSkip(int v) {renderFogOfWarSmoothingFrameSkip = v;} |
|---|
| 268 | void setRenderFontConsole(const string &v) {renderFontConsole = v;} |
|---|
| 269 | void setRenderFontDisplay(const string &v) {renderFontDisplay = v;} |
|---|
| 270 | void setRenderFontMenu(const string &v) {renderFontMenu = v;} |
|---|
| 271 | void setRenderFov(float v) {renderFov = v;} |
|---|
| 272 | void setRenderFpsMax(int v) {renderFpsMax = v;} |
|---|
| 273 | void setRenderGraphicsFactory(const string &v) {renderGraphicsFactory = v;} |
|---|
| 274 | void setRenderLightsMax(int v) {renderLightsMax = v;} |
|---|
| 275 | void setRenderShadowAlpha(float v) {renderShadowAlpha = v;} |
|---|
| 276 | void setRenderShadowFrameSkip(int v) {renderShadowFrameSkip = v;} |
|---|
| 277 | void setRenderShadows(const string &v) {renderShadows = v;} |
|---|
| 278 | void setRenderShadowTextureSize(int v) {renderShadowTextureSize = v;} |
|---|
| 279 | void setRenderStencilBits(int v) {renderStencilBits = v;} |
|---|
| 280 | void setRenderTextures3D(bool v) {renderTextures3D = v;} |
|---|
| 281 | void setSoundFactory(const string &v) {soundFactory = v;} |
|---|
| 282 | void setSoundStaticBuffers(int v) {soundStaticBuffers = v;} |
|---|
| 283 | void setSoundStreamingBuffers(int v) {soundStreamingBuffers = v;} |
|---|
| 284 | void setSoundVolumeAmbient(int v) {soundVolumeAmbient = v;} |
|---|
| 285 | void setSoundVolumeFx(int v) {soundVolumeFx = v;} |
|---|
| 286 | void setSoundVolumeMusic(int v) {soundVolumeMusic = v;} |
|---|
| 287 | void setUiConsoleMaxLines(int v) {uiConsoleMaxLines = v;} |
|---|
| 288 | void setUiConsoleTimeout(int v) {uiConsoleTimeout = v;} |
|---|
| 289 | void setUiEnableCommandMinimap(bool v) {uiEnableCommandMinimap = v;} |
|---|
| 290 | void setUiFocusArrows(bool v) {uiFocusArrows = v;} |
|---|
| 291 | void setUiLastMap(const string &v) {uiLastMap = v;} |
|---|
| 292 | void setUiLastRandStartLocs(bool v) {uiLastRandStartLocs = v;} |
|---|
| 293 | void setUiLastScenarioCatagory(const string &v) {uiLastScenarioCatagory = v;} |
|---|
| 294 | void setUiLastScenario(const string &v) {uiLastScenario = v;} |
|---|
| 295 | void setUiLastTechTree(const string &v) {uiLastTechTree = v;} |
|---|
| 296 | void setUiLastTileset(const string &v) {uiLastTileset = v;} |
|---|
| 297 | void setUiLocale(const string &v) {uiLocale = v;} |
|---|
| 298 | void setUiPhotoMode(bool v) {uiPhotoMode = v;} |
|---|
| 299 | void setUiRandomStartLocations(bool v) {uiRandomStartLocations = v;} |
|---|
| 300 | void setUiScrollSpeed(float v) {uiScrollSpeed = v;} |
|---|
| 301 | }; |
|---|
| 302 | |
|---|
| 303 | }}//end namespace |
|---|
| 304 | |
|---|
| 305 | #endif |
|---|
| 306 | |
|---|
| 307 | |
|---|