11 #ifndef CAFU_CONSOLE_VARIABLES_HPP_INCLUDED
12 #define CAFU_CONSOLE_VARIABLES_HPP_INCLUDED
15 #include "Templates/Array.hpp"
43 enum TypeT { String, Integer, Bool, Double };
49 FLAG_MAIN_EXE = 0x0001,
51 FLAG_SOUNDSYS = 0x0004,
52 FLAG_GAMEDLL = 0x0008,
67 ConVarT(
const std::string& Name_,
const std::string& Value_,
const int Flags_,
const std::string& Description_,
const char** AllowedValues_=NULL);
68 ConVarT(
const std::string& Name_,
const char* Value_,
const int Flags_,
const std::string& Description_,
const char** AllowedValues_=NULL);
69 ConVarT(
const std::string& Name_,
const int Value_,
const int Flags_,
const std::string& Description_,
const int MinValue_= 1,
const int MaxValue_= -1);
70 ConVarT(
const std::string& Name_,
const bool Value_,
const int Flags_,
const std::string& Description_);
71 ConVarT(
const std::string& Name_,
const double Value_,
const int Flags_,
const std::string& Description_,
const double MinValue_=1.0,
const double MaxValue_=-1.0);
77 const std::string& GetName()
const {
return Name; }
78 const std::string& GetDescription()
const {
return Description; }
79 int GetFlags()
const {
return Flags; }
80 TypeT GetType()
const {
return Type; }
81 const std::string& GetValueString()
const { assert(Type==String);
return ValueString; }
82 int GetValueInt()
const { assert(Type==Integer);
return ValueInt; }
83 bool GetValueBool()
const { assert(Type==Bool);
return ValueInt!=0; }
84 double GetValueDouble()
const { assert(Type==Double);
return ValueDouble; }
87 void SetValue(
const std::string& Value_);
88 void SetValue(
const char* Value_);
89 void SetValue(
const int Value_);
90 void SetValue(
const bool Value_);
91 void SetValue(
const double Value_);
93 void operator = (
const std::string& Value_) { SetValue(Value_); }
94 void operator = (
const char* Value_) { SetValue(Value_); }
95 void operator = (
const int Value_) { SetValue(Value_); }
96 void operator = (
const bool Value_) { SetValue(Value_); }
97 void operator = (
const double Value_) { SetValue(Value_); }
100 bool HasBeenModified()
const {
return IsModified; }
102 void ClearModified() { IsModified=
false; }
117 const std::string Name;
118 const std::string Description;
121 std::string ValueString;
124 const double MinValue;
125 const double MaxValue;
This variable has been statically declared by code, not by a user via the "set var xy" command...
Definition: ConVar.hpp:61
This variable (and its value) is archived in a config file.
Definition: ConVar.hpp:62
This class implements Console Variables ("convars").
Definition: ConVar.hpp:39
Use of this variable is considered a cheat.
Definition: ConVar.hpp:57
This class provides an implementation for the ConsoleInterpreterI interface.
Definition: ConsoleInterpreterImpl.hpp:33
Value of this variable is sync'ed from the server to the clients.
Definition: ConVar.hpp:56
Sent from clients to the server.
Definition: ConVar.hpp:54
static void RegisterStaticList()
Registers all convars in the StaticList with the ConsoleInterpreter and invalidates the StaticList...
Definition: ConVar.cpp:30
This variable is read-only, i.e. it cannot be modified by the user (neither in console nor at command...
Definition: ConVar.hpp:60
FlagT
Definition: ConVar.hpp:45
Sent from servers to the clients.
Definition: ConVar.hpp:55
This variable is used during initialization, and can thus only be changed at the command-line, not at the console.
Definition: ConVar.hpp:59