DDraceNetwork Docs
config.cpp File Reference
Include dependency graph for config.cpp:

Macros

#define MACRO_CONFIG_INT(Name, ScriptName, Def, Min, Max, Flags, Desc)
 
#define MACRO_CONFIG_COL(Name, ScriptName, Def, Flags, Desc)
 
#define MACRO_CONFIG_STR(Name, ScriptName, Len, Def, Flags, Desc)
 

Functions

static void EscapeParam (char *pDst, const char *pSrc, int Size)
 
IConfigManagerCreateConfigManager ()
 

Variables

CConfig g_Config
 

Macro Definition Documentation

◆ MACRO_CONFIG_COL

#define MACRO_CONFIG_COL (   Name,
  ScriptName,
  Def,
  Flags,
  Desc 
)
Value:
{ \
const size_t HelpSize = (size_t)str_length(Desc) + 32; \
char *pHelp = static_cast<char *>(m_ConfigHeap.Allocate(HelpSize)); \
const bool Alpha = ((Flags)&CFGFLAG_COLALPHA) != 0; \
str_format(pHelp, HelpSize, "%s (default: $%0*X)", Desc, Alpha ? 8 : 6, color_cast<ColorRGBA>(ColorHSLA(Def, Alpha)).Pack(Alpha)); \
AddVariable(m_ConfigHeap.Allocate<SColorConfigVariable>(m_pConsole, #ScriptName, SConfigVariable::VAR_COLOR, Flags, pHelp, &g_Config.m_##Name, Def)); \
}
Definition: color.h:173
CConfig g_Config
Definition: config.cpp:12
int str_length(const char *str)
Definition: system.cpp:2754
@ CFGFLAG_COLALPHA
Definition: config.h:58
Definition: config.h:134
@ VAR_COLOR
Definition: config.h:68

◆ MACRO_CONFIG_INT

#define MACRO_CONFIG_INT (   Name,
  ScriptName,
  Def,
  Min,
  Max,
  Flags,
  Desc 
)
Value:
{ \
const char *pHelp = Min == Max ? Desc " (default: " #Def ")" : (Max == 0 ? Desc " (default: " #Def ", min: " #Min ")" : Desc " (default: " #Def ", min: " #Min ", max: " #Max ")"); \
AddVariable(m_ConfigHeap.Allocate<SIntConfigVariable>(m_pConsole, #ScriptName, SConfigVariable::VAR_INT, Flags, pHelp, &g_Config.m_##Name, Def, Min, Max)); \
}
@ VAR_INT
Definition: config.h:67
Definition: config.h:103

◆ MACRO_CONFIG_STR

#define MACRO_CONFIG_STR (   Name,
  ScriptName,
  Len,
  Def,
  Flags,
  Desc 
)
Value:
{ \
const size_t HelpSize = (size_t)str_length(Desc) + str_length(Def) + 64; \
char *pHelp = static_cast<char *>(m_ConfigHeap.Allocate(HelpSize)); \
str_format(pHelp, HelpSize, "%s (default: \"%s\", max length: %d)", Desc, Def, Len - 1); \
char *pOldValue = static_cast<char *>(m_ConfigHeap.Allocate(Len)); \
AddVariable(m_ConfigHeap.Allocate<SStringConfigVariable>(m_pConsole, #ScriptName, SConfigVariable::VAR_STRING, Flags, pHelp, g_Config.m_##Name, Def, Len, pOldValue)); \
}
@ VAR_STRING
Definition: config.h:69
Definition: config.h:176

Function Documentation

◆ CreateConfigManager()

IConfigManager * CreateConfigManager ( )

◆ EscapeParam()

static void EscapeParam ( char *  pDst,
const char *  pSrc,
int  Size 
)
static

Variable Documentation

◆ g_Config

CConfig g_Config