Merge pull request #378 from powerlord/fix-convar
Fix ConVar .IntValue, .BoolValue, and .FloatValue assignments (Bug 6405)
This commit is contained in:
commit
653dd36020
@ -364,13 +364,13 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[0] >= 3 && params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
ReplicateConVar(pConVar);
|
ReplicateConVar(pConVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should we notify clients? */
|
/* Should we notify clients? */
|
||||||
if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
|
if (params[0] >= 4 && params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
|
||||||
{
|
{
|
||||||
NotifyConVar(pConVar);
|
NotifyConVar(pConVar);
|
||||||
}
|
}
|
||||||
@ -413,13 +413,13 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[0] >= 3 && params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
ReplicateConVar(pConVar);
|
ReplicateConVar(pConVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should we notify clients? */
|
/* Should we notify clients? */
|
||||||
if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
|
if (params[0] >= 4 && params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
|
||||||
{
|
{
|
||||||
NotifyConVar(pConVar);
|
NotifyConVar(pConVar);
|
||||||
}
|
}
|
||||||
@ -464,13 +464,13 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[0] >= 3 && params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
ReplicateConVar(pConVar);
|
ReplicateConVar(pConVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should we notify clients? */
|
/* Should we notify clients? */
|
||||||
if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
|
if (params[0] >= 4 && params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
|
||||||
{
|
{
|
||||||
NotifyConVar(pConVar);
|
NotifyConVar(pConVar);
|
||||||
}
|
}
|
||||||
@ -1243,45 +1243,6 @@ static cell_t RemoveCommandListener(IPluginContext *pContext, const cell_t *para
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t ConVar_BoolValue_set(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
static cell_t new_params[5] = {
|
|
||||||
4,
|
|
||||||
params[1],
|
|
||||||
params[2],
|
|
||||||
0, /* Default replicate setting. */
|
|
||||||
0, /* Default replicate setting. */
|
|
||||||
};
|
|
||||||
|
|
||||||
return sm_SetConVarNum(pContext, new_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t ConVar_IntValue_set(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
static cell_t new_params[5] = {
|
|
||||||
4,
|
|
||||||
params[1],
|
|
||||||
params[2],
|
|
||||||
0, /* Default replicate setting. */
|
|
||||||
0, /* Default replicate setting. */
|
|
||||||
};
|
|
||||||
|
|
||||||
return sm_SetConVarNum(pContext, new_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t ConVar_FloatValue_set(IPluginContext *pContext, const cell_t *params)
|
|
||||||
{
|
|
||||||
static cell_t new_params[5] = {
|
|
||||||
4,
|
|
||||||
params[1],
|
|
||||||
params[2],
|
|
||||||
0, /* Default replicate setting. */
|
|
||||||
0, /* Default replicate setting. */
|
|
||||||
};
|
|
||||||
|
|
||||||
return sm_SetConVarFloat(pContext, new_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell_t ConVar_ReplicateToClient(IPluginContext *pContext, const cell_t *params)
|
static cell_t ConVar_ReplicateToClient(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
// Old version is (client, handle, value).
|
// Old version is (client, handle, value).
|
||||||
@ -1384,11 +1345,11 @@ REGISTER_NATIVES(consoleNatives)
|
|||||||
|
|
||||||
// Transitional syntax support.
|
// Transitional syntax support.
|
||||||
{"ConVar.BoolValue.get", sm_GetConVarBool},
|
{"ConVar.BoolValue.get", sm_GetConVarBool},
|
||||||
{"ConVar.BoolValue.set", ConVar_BoolValue_set},
|
{"ConVar.BoolValue.set", sm_SetConVarNum},
|
||||||
{"ConVar.FloatValue.get", sm_GetConVarFloat},
|
{"ConVar.FloatValue.get", sm_GetConVarFloat},
|
||||||
{"ConVar.FloatValue.set", ConVar_FloatValue_set},
|
{"ConVar.FloatValue.set", sm_SetConVarFloat},
|
||||||
{"ConVar.IntValue.get", sm_GetConVarInt},
|
{"ConVar.IntValue.get", sm_GetConVarInt},
|
||||||
{"ConVar.IntValue.set", ConVar_IntValue_set},
|
{"ConVar.IntValue.set", sm_SetConVarNum},
|
||||||
{"ConVar.Flags.get", sm_GetConVarFlags},
|
{"ConVar.Flags.get", sm_GetConVarFlags},
|
||||||
{"ConVar.Flags.set", sm_SetConVarFlags},
|
{"ConVar.Flags.set", sm_SetConVarFlags},
|
||||||
{"ConVar.SetBool", sm_SetConVarNum},
|
{"ConVar.SetBool", sm_SetConVarNum},
|
||||||
|
Loading…
Reference in New Issue
Block a user