Only log changed convars for 'convar_differences'

This commit is contained in:
Kawe Mazidjatari 2022-08-13 12:53:08 +02:00
parent 4551f6d494
commit dbdfdc2b3a
3 changed files with 16 additions and 10 deletions

View File

@ -967,8 +967,8 @@ void ConVar_AppendFlags(ConCommandBase* var, char* buf, size_t bufsize)
if (var->IsFlagSet(info.flag))
{
char append[128];
snprintf(append, sizeof(append), " %s", info.desc);
strncat(buf, append, bufsize);
V_snprintf(append, sizeof(append), " %s", info.desc);
V_strncat(buf, append, bufsize);
}
}
}
@ -1008,11 +1008,11 @@ void ConVar_PrintDescription(ConCommandBase* pVar)
if (fabs((float)intVal - floatVal) < 0.000001)
{
snprintf(tempVal, sizeof(tempVal), "%d", intVal);
V_snprintf(tempVal, sizeof(tempVal), "%d", intVal);
}
else
{
snprintf(tempVal, sizeof(tempVal), "%f", floatVal);
V_snprintf(tempVal, sizeof(tempVal), "%f", floatVal);
}
}
else
@ -1024,7 +1024,7 @@ void ConVar_PrintDescription(ConCommandBase* pVar)
{
AppendPrintf(outstr, sizeof(outstr), "\"%s\" = \"%s\"", var->GetName(), value);
if (_stricmp(value, var->GetDefault()))
if (V_stricmp(value, var->GetDefault()))
{
AppendPrintf(outstr, sizeof(outstr), " ( def. \"%s\" )", var->GetDefault());
}

View File

@ -525,7 +525,7 @@ void CCvarUtilities::CvarHelp(const CCommand& args)
var = g_pCVar->FindCommandBase(search);
if (!var)
{
DevMsg(eDLL_T::ENGINE, "Help: no cvar or command named %s\n", search);
DevMsg(eDLL_T::ENGINE, "help: no cvar or command named %s\n", search);
return;
}
@ -540,6 +540,7 @@ void CCvarUtilities::CvarDifferences(const CCommand& args)
{
CCVarIteratorInternal* pFactory = g_pCVar->FactoryInternalIterator();
pFactory->SetFirst();
int i = 0;
while (pFactory->IsValid())
{
@ -550,13 +551,18 @@ void CCvarUtilities::CvarDifferences(const CCommand& args)
{
ConVar* pConVar = reinterpret_cast<ConVar*>(pCommandBase);
if (strcmp(pConVar->GetString(), "FCVAR_NEVER_AS_STRING") != NULL)
if (V_strcmp(pConVar->GetString(), "FCVAR_NEVER_AS_STRING") != NULL)
{
ConVar_PrintDescription(pConVar);
if (V_stricmp(pConVar->GetString(), pConVar->GetDefault()) != NULL)
{
ConVar_PrintDescription(pConVar);
i++;
}
}
}
pFactory->Next();
}
DevMsg(eDLL_T::ENGINE, "--------------\n%3i changed convars\n", i);
}
//-----------------------------------------------------------------------------

View File

@ -1,11 +1,11 @@
#pragma once
#define V_snprintf snprintf
#define V_strlower strlwr
#define V_strlower _strlwr
#define V_strlen strlen
#define V_strncat strncat
#define V_stricmp _stricmp
#define V_strnicmp strnicmp
#define V_strnicmp _strnicmp
#define V_strcmp strcmp
#define Q_snprintf V_snprintf