mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- sort CVAR output in config alphabetically instead of randomly dumping them in their internal order.
This commit is contained in:
parent
8f7e902875
commit
d54a7de284
1 changed files with 17 additions and 4 deletions
|
@ -1534,9 +1534,17 @@ void C_SetCVarsToDefaults (void)
|
|||
}
|
||||
}
|
||||
|
||||
static int cvarcmp(const void* a, const void* b)
|
||||
{
|
||||
FBaseCVar** A = (FBaseCVar**)a;
|
||||
FBaseCVar** B = (FBaseCVar**)b;
|
||||
return strcmp((*A)->GetName(), (*B)->GetName());
|
||||
}
|
||||
|
||||
void C_ArchiveCVars (FConfigFile *f, uint32_t filter)
|
||||
{
|
||||
FBaseCVar *cvar = CVars;
|
||||
TArray<FBaseCVar*> cvarlist;
|
||||
|
||||
while (cvar)
|
||||
{
|
||||
|
@ -1544,13 +1552,18 @@ void C_ArchiveCVars (FConfigFile *f, uint32_t filter)
|
|||
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_MOD|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
|
||||
== filter)
|
||||
{
|
||||
const char *const value = (cvar->Flags & CVAR_ISDEFAULT)
|
||||
? cvar->GetGenericRep(CVAR_String).String
|
||||
: cvar->SafeValue.GetChars();
|
||||
f->SetValueForKey(cvar->GetName(), value);
|
||||
cvarlist.Push(cvar);
|
||||
}
|
||||
cvar = cvar->m_Next;
|
||||
}
|
||||
qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp);
|
||||
for (auto cvar : cvarlist)
|
||||
{
|
||||
const char* const value = (cvar->Flags & CVAR_ISDEFAULT)
|
||||
? cvar->GetGenericRep(CVAR_String).String
|
||||
: cvar->SafeValue.GetChars();
|
||||
f->SetValueForKey(cvar->GetName(), value);
|
||||
}
|
||||
}
|
||||
|
||||
EXTERN_CVAR(Bool, sv_cheats);
|
||||
|
|
Loading…
Reference in a new issue