Cvars: Remove global forward

This commit is contained in:
Arkshine 2015-01-20 18:03:34 +01:00
parent cdc7d550eb
commit 0db5963641
6 changed files with 10 additions and 15 deletions

View File

@ -329,7 +329,6 @@ extern int FF_PluginEnd;
extern int FF_InconsistentFile;
extern int FF_ClientAuthorized;
extern int FF_ChangeLevel;
extern int FF_CvarChanged;
extern bool g_coloredmenus;

View File

@ -15,20 +15,13 @@ CvarManager g_CvarManager;
DETOUR_DECL_STATIC2(Cvar_DirectSet, void, struct cvar_s*, var, const char*, value)
{
static bool calledFromCallback = false;
if (!calledFromCallback && var && value)
// Sanity checks against bogus pointers.
if (var && value)
{
// Make sure old and new values are different to not trigger callbacks.
if (strcmp(var->string, value) != 0)
{
calledFromCallback = true;
if (executeForwards(FF_CvarChanged, reinterpret_cast<cell>(var), var->string, value, var->name) > 0)
{
//return;
}
calledFromCallback = false;
}
}

View File

@ -142,7 +142,6 @@ int FF_PluginEnd = -1;
int FF_InconsistentFile = -1;
int FF_ClientAuthorized = -1;
int FF_ChangeLevel = -1;
int FF_CvarChanged = -1;
bool ColoredMenus(String & ModName)
{
@ -503,7 +502,6 @@ int C_Spawn(edict_t *pent)
FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE);
FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE);
FF_ChangeLevel = registerForward("server_changelevel", ET_STOP, FP_STRING, FP_DONE);
FF_CvarChanged = registerForward("OnCvarChanged", ET_STOP, FP_CELL, FP_STRING, FP_STRING, FP_STRING, FP_DONE);
#if defined BINLOG_ENABLED
if (!g_BinLog.Open())

View File

@ -421,6 +421,7 @@
</ItemGroup>
<ItemGroup>
<None Include="..\..\plugins\include\cellstack.inc" />
<None Include="..\..\plugins\include\cvars.inc" />
<None Include="..\..\plugins\include\datapack.inc" />
<None Include="..\..\plugins\include\textparse_ini.inc" />
<None Include="..\..\plugins\include\textparse_smc.inc" />

View File

@ -453,6 +453,9 @@
<None Include="..\..\plugins\include\textparse_smc.inc">
<Filter>Pawn Includes</Filter>
</None>
<None Include="..\..\plugins\include\cvars.inc">
<Filter>Pawn Includes</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Object Include="..\Jit\helpers-x86.obj">

View File

@ -19,5 +19,6 @@
* @param oldValue String containing the value of the cvar before it was changed
* @param newValue String containing the new value of the cvar
* @param cvarName String containing the name of the cvar
*
* public OnCvarChanged(cvarHandle, const oldValue[], const newValue[], const cvarName[]);
*/
forward OnCvarChanged(cvarHandle, const oldValue[], const newValue[], const cvarName[]);