src/core/serverapi/serverstructs.h
Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // serverstructs.h
00003 //------------------------------------------------------------------------------
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018 // 02110-1301, USA.
00019 //
00020 //------------------------------------------------------------------------------
00021 // Copyright (C) 2010 "Blzut3" <admin@maniacsvault.net>
00022 //------------------------------------------------------------------------------
00023 #ifndef __SERVER_STRUCTS_H_
00024 #define __SERVER_STRUCTS_H_
00025 
00026 #include <QString>
00027 #include <QList>
00028 
00029 #include "global.h"
00030 
00033 class MAIN_EXPORT DMFlag
00034 {
00035         public:
00036                 DMFlag(QString name, unsigned value)
00037                 : name(name), value(value)
00038                 {
00039                 }
00040 
00041                 QString         name;
00042                 unsigned        value;
00043 };
00044 
00048 class MAIN_EXPORT DMFlagsSection
00049 {
00050         public:
00051                 QString         name;
00052                 QList<DMFlag>   flags;
00053 };
00054 
00058 typedef QList<DMFlagsSection*>                                                  DMFlags;
00059 typedef QList<DMFlagsSection*>::iterator                                DMFlagsIt;
00060 typedef QList<DMFlagsSection*>::const_iterator                  DMFlagsItConst;
00061 typedef QList<const DMFlagsSection*>                                    DMFlagsConst;
00062 typedef QList<const DMFlagsSection*>::iterator                  DMFlagsConstIt;
00063 typedef QList<const DMFlagsSection*>::const_iterator    DMFlagsConstItConst;
00064 
00068 class MAIN_EXPORT GameCVar
00069 {
00070         public:
00074                 QString         name;
00075 
00079                 QString         consoleCommand;
00080 
00081                 GameCVar() {}
00082                 GameCVar(QString fname, QString fconsoleCommand):name(fname),consoleCommand(fconsoleCommand) {}
00083 
00084                 void                    setValue(bool b) { b == true ? val = "1" : val = "0"; }
00085                 void                    setValue(int i) { setValue(QString::number(i)); }
00086                 void                    setValue(const QString& str) { val = str; }
00087 
00088                 const QString&  value() const { return val; }
00089                 bool                    valueBool() const { return (val.toInt() != 0); }
00090                 bool                    valueInt() const { return val.toInt(); }
00091 
00092         protected:
00093                 QString         val;
00094 };
00095 
00099 class MAIN_EXPORT GameMode
00100 {
00101         public:
00102                 enum StandardGameModeIndexes
00103                 {
00104                         SGMICooperative         = 900,
00105                         SGMIDeathmatch          = 901,
00106                         SGMITeamDeathmatch      = 902,
00107                         SGMICTF                         = 903,
00108                         SGMIUnknown                     = 904
00109                 };
00110 
00111                 // Standard game mode set
00112                 // These should be used in order to keep the names uniform.
00113                 static const GameMode   COOPERATIVE;
00114                 static const GameMode   DEATHMATCH;
00115                 static const GameMode   TEAM_DEATHMATCH;
00116                 static const GameMode   CAPTURE_THE_FLAG;
00117                 static const GameMode   UNKNOWN;
00118 
00122                 GameMode(int index, const QString &name, bool teamgame);
00123 
00124                 int                             modeIndex() const { return gameModeIndex; }
00125                 const QString   &name() const { return modeName;}
00126                 bool                    isTeamGame() const { return teamgame; }
00127         protected:
00128                 int             gameModeIndex;
00129                 QString modeName;
00130                 bool    teamgame;
00131 };
00132 
00133 class MAIN_EXPORT SkillLevel
00134 {
00135         //const QString strName;
00136 
00137         static const int         numSkillLevels;
00138         static const QString names[];
00139 };
00140 
00141 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator