user Cvar_DirectSet for Convar::SetString

This commit is contained in:
jeefo 2016-03-08 17:22:44 +03:00
commit cbac5da0b7
5 changed files with 18 additions and 18 deletions

View file

@ -2284,7 +2284,7 @@ bool Bot::LastEnemyShootable (void)
void Bot::CheckRadioCommands (void)
{
// this function handling radio and reactings to it
// this function handling radio and reacting to it
float distance = (m_radioEntity->v.origin - pev->origin).GetLength ();

View file

@ -453,7 +453,7 @@ void Engine::IssueCmd (const char *fmt, ...)
g_engfuncs.pfnServerCommand (string);
}
void ConVarWrapper::RegisterVariable (const char *variable, const char *value, VarType varType, ConVar *self)
void ConVarWrapper::RegisterVariable(const char *variable, const char *value, VarType varType, bool regMissing, ConVar *self)
{
// this function adds globally defined variable to registration stack
@ -462,6 +462,7 @@ void ConVarWrapper::RegisterVariable (const char *variable, const char *value, V
pair.reg.name = const_cast <char *> (variable);
pair.reg.string = const_cast <char *> (value);
pair.regMissing = regMissing;
int engineFlags = FCVAR_EXTDLL;
@ -501,13 +502,17 @@ void ConVarWrapper::PushRegisteredConVarsToEngine (bool gameVars)
{
ptr->self->m_eptr = g_engfuncs.pfnCVarGetPointer (ptr->reg.name);
// ensure game cvar exists
InternalAssert (ptr->self->m_eptr != NULL);
if (ptr->regMissing && ptr->self->m_eptr == NULL)
{
g_engfuncs.pfnCVarRegister (&ptr->reg);
ptr->self->m_eptr = g_engfuncs.pfnCVarGetPointer (ptr->reg.name);
}
InternalAssert (ptr->self->m_eptr != NULL); // ensure game var exists
}
}
}
ConVar::ConVar (const char *name, const char *initval, VarType type) : m_eptr (NULL)
ConVar::ConVar (const char *name, const char *initval, VarType type, bool regMissing) : m_eptr (NULL)
{
ConVarWrapper::GetReference ().RegisterVariable (name, initval, type, this);
ConVarWrapper::GetReference ().RegisterVariable (name, initval, type, regMissing, this);
}

View file

@ -12,12 +12,7 @@
ConVar yb_display_menu_text ("yb_display_menu_text", "1");
ConVar mp_roundtime ("mp_roundtime", NULL, VT_NOREGISTER);
#ifndef XASH_CSDM
ConVar mp_freezetime ("mp_freezetime", NULL, VT_NOREGISTER);
#else
ConVar mp_freezetime ("mp_freezetime", "0", VT_NOSERVER);
#endif
ConVar mp_freezetime ("mp_freezetime", NULL, VT_NOREGISTER, true);
uint16 FixedUnsigned16 (float value, float scale)
{
@ -424,7 +419,6 @@ int GetWeaponPenetrationPower (int id)
return 0;
}
bool IsValidPlayer (edict_t *ent)
{
if (engine.IsNullEntity (ent))
@ -716,7 +710,7 @@ bool FindNearestPlayer (void **pvHolder, edict_t *to, float searchDistance, bool
// team, live status, search distance etc. if needBot is true, then pvHolder, will
// be filled with bot pointer, else with edict pointer(!).
edict_t *survive = NULL; // pointer to temporaly & survive entity
edict_t *survive = NULL; // pointer to temporally & survive entity
float nearestPlayer = 4096.0f; // nearest player
int toTeam = engine.GetTeam (to);