Refined logic a bit
This commit is contained in:
parent
69592a5656
commit
0e3d4a596b
@ -192,8 +192,11 @@ namespace Components
|
|||||||
|
|
||||||
void Dvar::ResetDvarsValue()
|
void Dvar::ResetDvarsValue()
|
||||||
{
|
{
|
||||||
Command::Execute("exec archivedvars.cfg");
|
if (!Utils::IO::FileExists(Dvar::ArchiveDvarPath))
|
||||||
// Cleanup
|
return
|
||||||
|
|
||||||
|
Command::Execute("exec archivedvars.cfg", true);
|
||||||
|
// Clean up
|
||||||
Utils::IO::RemoveFile(Dvar::ArchiveDvarPath);
|
Utils::IO::RemoveFile(Dvar::ArchiveDvarPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,8 +367,8 @@ namespace Components
|
|||||||
// Hook Dvar_SetFromStringByName inside CG_SetClientDvarFromServer so we can reset dvars when the player leaves the server
|
// Hook Dvar_SetFromStringByName inside CG_SetClientDvarFromServer so we can reset dvars when the player leaves the server
|
||||||
Utils::Hook(0x59386A, Dvar::DvarSetFromStringByNameStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x59386A, Dvar::DvarSetFromStringByNameStub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
// If the game closed abruptly the file would have not been deleted
|
// If the game closed abruptly the dvars would have not been restored
|
||||||
Utils::IO::RemoveFile(Dvar::ArchiveDvarPath);
|
Dvar::ResetDvarsValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dvar::~Dvar()
|
Dvar::~Dvar()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user