The replicate and notify parameters for SetConVarX and ResetConVar are now ignored on Orange Box.

- OB engine automatically replicates and fires server_cvar event notification for changes cvars.
- Added a note about this in comments for affected natives.
This commit is contained in:
Scott Ehlert 2008-11-12 23:14:49 -06:00
parent af2af91300
commit c1c5d2656c
2 changed files with 25 additions and 2 deletions

View File

@ -339,6 +339,7 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
pConVar->SetValue(params[2]);
#ifndef ORANGEBOX_BUILD
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -350,6 +351,7 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
{
NotifyConVar(pConVar);
}
#endif
return 1;
}
@ -386,6 +388,7 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
float value = sp_ctof(params[2]);
pConVar->SetValue(value);
#ifndef ORANGEBOX_BUILD
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -397,6 +400,7 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
{
NotifyConVar(pConVar);
}
#endif
return 1;
}
@ -435,6 +439,7 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
pConVar->SetValue(value);
#ifndef ORANGEBOX_BUILD
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -446,6 +451,7 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
{
NotifyConVar(pConVar);
}
#endif
return 1;
}
@ -464,17 +470,19 @@ static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
pConVar->Revert();
#ifndef ORANGEBOX_BUILD
/* Should we replicate it? */
if (params[2] && IsFlagSet(pConVar, FCVAR_REPLICATED))
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
ReplicateConVar(pConVar);
}
/* Should we notify clients? */
if (params[3] && IsFlagSet(pConVar, FCVAR_NOTIFY))
if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
{
NotifyConVar(pConVar);
}
#endif
return 1;
}

View File

@ -473,6 +473,9 @@ native bool:GetConVarBool(Handle:convar);
/**
* Sets the boolean value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
*
* @param convar Handle to the convar.
* @param value New boolean value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -497,6 +500,9 @@ native GetConVarInt(Handle:convar);
/**
* Sets the integer value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
*
* @param convar Handle to the convar.
* @param value New integer value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -521,6 +527,9 @@ native Float:GetConVarFloat(Handle:convar);
/**
* Sets the floating point value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
*
* @param convar Handle to the convar.
* @param value New floating point value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -547,6 +556,9 @@ native GetConVarString(Handle:convar, String:value[], maxlength);
/**
* Sets the string value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
*
* @param convar Handle to the convar.
* @param value New string value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -562,6 +574,9 @@ native SetConVarString(Handle:convar, const String:value[], bool:replicate=false
/**
* Resets the console variable to its default value.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
*
* @param convar Handle to the convar.
* @param replicate If set to true, the new convar value will be set on all clients.
* This will only work if the convar has the FCVAR_REPLICATED flag