00001 //////////////////////////////////////////////////////////////////////////////// 00002 // Scorched3D (c) 2000-2009 00003 // 00004 // This file is part of Scorched3D. 00005 // 00006 // Scorched3D is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Scorched3D is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Scorched3D; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 //////////////////////////////////////////////////////////////////////////////// 00020 00021 #if !defined(__INCLUDE_OptionsScorchedh_INCLUDE__) 00022 #define __INCLUDE_OptionsScorchedh_INCLUDE__ 00023 00024 #include <common/OptionsGame.h> 00025 00026 #define GENERIC_GETTER(x) \ 00027 { \ 00028 if (levelOptions_.get##x##Entry().isChangedValue()) return levelOptions_.get##x(); \ 00029 else return mainOptions_.get##x(); \ 00030 }; 00031 00032 #define OPTIONSTRING_GETTER(x) const char *get##x() GENERIC_GETTER(x) 00033 #define OPTIONINT_GETTER(x) int get##x() GENERIC_GETTER(x) 00034 #define OPTIONENUM_GETTER(x) OptionEntryEnum get##x() GENERIC_GETTER(x) 00035 #define OPTIONSTRINGENUM_GETTER(x) const char *get##x() GENERIC_GETTER(x) 00036 #define OPTIONBOOL_GETTER(x) bool get##x() GENERIC_GETTER(x) 00037 #define OPTIONFLOAT_GETTER(x) bool get##x() GENERIC_GETTER(x) 00038 #define OPTIONVECTOR_GETTER(x) bool get##x() GENERIC_GETTER(x) 00039 00040 class ScorchedContext; 00041 class LandscapeDefinition; 00042 class LandscapeInclude; 00043 class OptionsScorched 00044 { 00045 public: 00046 OptionsScorched(); 00047 virtual ~OptionsScorched(); 00048 00049 OPTIONINT_GETTER(PortNo); 00050 OPTIONINT_GETTER(ManagementPortNo); 00051 00052 OPTIONSTRING_GETTER(Tutorial); 00053 OPTIONINT_GETTER(PhysicsFPS); 00054 OPTIONINT_GETTER(Teams); 00055 OPTIONINT_GETTER(StartArmsLevel); 00056 OPTIONINT_GETTER(EndArmsLevel); 00057 OPTIONINT_GETTER(MaxNumberWeapons); 00058 OPTIONINT_GETTER(NoMaxPlayers); 00059 OPTIONINT_GETTER(NoMinPlayers); 00060 OPTIONINT_GETTER(NoRounds); 00061 OPTIONINT_GETTER(RemoveBotsAtPlayers); 00062 OPTIONINT_GETTER(NoMaxRoundTurns); 00063 OPTIONINT_GETTER(MaxLandscapeSize); 00064 OPTIONINT_GETTER(AllowedMissedMoves); 00065 OPTIONINT_GETTER(IdleKickTime); 00066 OPTIONINT_GETTER(IdleShotKickTime); 00067 OPTIONINT_GETTER(MinFallingDistance); 00068 OPTIONINT_GETTER(MaxClimbingDistance); 00069 OPTIONINT_GETTER(PlayerLives); 00070 OPTIONINT_GETTER(Gravity); 00071 00072 OPTIONINT_GETTER(StartTime); 00073 OPTIONINT_GETTER(ShotTime); 00074 OPTIONINT_GETTER(KeepAliveTime); 00075 OPTIONINT_GETTER(KeepAliveTimeoutTime); 00076 OPTIONINT_GETTER(BuyingTime); 00077 OPTIONINT_GETTER(RoundScoreTime); 00078 OPTIONINT_GETTER(ScoreTime); 00079 00080 OPTIONENUM_GETTER(WindForce); 00081 OPTIONENUM_GETTER(WindType); 00082 OPTIONENUM_GETTER(WallType); 00083 OPTIONENUM_GETTER(WeapScale); 00084 OPTIONENUM_GETTER(TurnType); 00085 OPTIONENUM_GETTER(TeamBallance); 00086 OPTIONENUM_GETTER(MovementRestriction); 00087 00088 OPTIONINT_GETTER(ScorePerMoney); 00089 OPTIONINT_GETTER(ScorePerAssist); 00090 OPTIONINT_GETTER(ScorePerKill); 00091 OPTIONINT_GETTER(ScoreWonForRound); 00092 OPTIONINT_GETTER(ScoreWonForLives); 00093 00094 OPTIONINT_GETTER(StartMoney); 00095 OPTIONINT_GETTER(Interest); 00096 OPTIONINT_GETTER(FreeMarketAdjustment); 00097 OPTIONINT_GETTER(FreeMarketLimits); 00098 OPTIONINT_GETTER(BuyOnRound); 00099 OPTIONINT_GETTER(MoneyPerRound); 00100 OPTIONINT_GETTER(MoneyWonForRound); 00101 OPTIONINT_GETTER(MoneyWonForLives); 00102 OPTIONINT_GETTER(MoneyWonPerKillPoint); 00103 OPTIONINT_GETTER(MoneyWonPerMultiKillPoint); 00104 OPTIONINT_GETTER(MoneyWonPerAssistPoint); 00105 OPTIONINT_GETTER(MoneyWonPerHitPoint); 00106 OPTIONBOOL_GETTER(MoneyPerHealthPoint); 00107 OPTIONBOOL_GETTER(LimitPowerByHealth); 00108 OPTIONBOOL_GETTER(GiveAllWeapons); 00109 OPTIONBOOL_GETTER(DelayedDefenseActivation); 00110 OPTIONSTRINGENUM_GETTER(Economy); 00111 OPTIONINT_GETTER(ResignMode); 00112 00113 OPTIONINT_GETTER(ComputersDeathTalk); 00114 OPTIONINT_GETTER(ComputersAttackTalk); 00115 OPTIONSTRING_GETTER(BotNamePrefix); 00116 OPTIONBOOL_GETTER(RandomizeBotNames); 00117 00118 OPTIONBOOL_GETTER(CycleMaps); 00119 OPTIONSTRING_GETTER(Landscapes); 00120 00121 OPTIONSTRING_GETTER(StatsLogger); 00122 OPTIONSTRING_GETTER(ServerFileLogger); 00123 00124 OPTIONSTRING_GETTER(Mod); 00125 OPTIONSTRING_GETTER(MOTD); 00126 OPTIONINT_GETTER(ModDownloadSpeed); 00127 OPTIONINT_GETTER(MaxAvatarSize); 00128 OPTIONSTRING_GETTER(ServerName); 00129 OPTIONSTRING_GETTER(ServerPassword); 00130 OPTIONSTRING_GETTER(PublishAddress); 00131 00132 OPTIONBOOL_GETTER(AllowMultiLingualChat); 00133 OPTIONBOOL_GETTER(AllowMultiLingualNames); 00134 OPTIONBOOL_GETTER(AllowSameIP); 00135 OPTIONBOOL_GETTER(AllowSameUniqueId); 00136 OPTIONBOOL_GETTER(PublishServer); 00137 OPTIONBOOL_GETTER(ResidualPlayers); 00138 OPTIONBOOL_GETTER(AutoSendSyncCheck); 00139 OPTIONBOOL_GETTER(ActionSyncCheck); 00140 00141 OPTIONSTRING_GETTER(AuthHandler); 00142 OPTIONBOOL_GETTER(RegisteredUserNames); 00143 OPTIONBOOL_GETTER(DebugFeatures); 00144 00145 OptionEntryString &getPlayerType(int no) { DIALOG_ASSERT(no<24); return mainOptions_.getPlayerType(no); } 00146 00147 OptionsGame &getChangedOptions() { return changedOptions_; } 00148 OptionsGame &getMainOptions() { return mainOptions_; } 00149 OptionsGame &getLevelOptions() { return levelOptions_; } 00150 00151 void updateLevelOptions(ScorchedContext &context, LandscapeDefinition &defn); 00152 void updateChangeSet(); 00153 bool commitChanges(); 00154 00155 protected: 00156 OptionsGame mainOptions_; 00157 OptionsGame changedOptions_; 00158 OptionsGame levelOptions_; 00159 00160 void updateLevelOptions(std::vector<LandscapeInclude *> &options, 00161 std::map<std::string, OptionEntry *> &values); 00162 }; 00163 00164 #endif
1.5.3