Merge pull request #345 from diamante0018/develop
[VisionFile] Fix ill-defined loop
This commit is contained in:
commit
22d57a675e
@ -9,22 +9,14 @@ namespace Components
|
|||||||
|
|
||||||
void VisionFile::ApplyExemptDvar(const std::string& dvarName, const char* buffer, const std::string& fileName)
|
void VisionFile::ApplyExemptDvar(const std::string& dvarName, const char* buffer, const std::string& fileName)
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; i < std::extent_v<decltype(DvarExceptions)>; ++i)
|
for (std::size_t i = 0; i < ARRAYSIZE(DvarExceptions); ++i)
|
||||||
{
|
{
|
||||||
if (dvarName == DvarExceptions[i])
|
if (dvarName == DvarExceptions[i])
|
||||||
{
|
{
|
||||||
const auto* dvar = Game::Dvar_FindVar(dvarName.data());
|
const auto* dvar = Game::Dvar_FindVar(dvarName.data());
|
||||||
|
|
||||||
assert(dvar != nullptr);
|
|
||||||
|
|
||||||
const auto* currentVal = Game::Dvar_DisplayableValue(dvar);
|
|
||||||
const auto* parsedValue = Game::Com_ParseOnLine(&buffer);
|
const auto* parsedValue = Game::Com_ParseOnLine(&buffer);
|
||||||
|
|
||||||
if (std::strcmp(parsedValue, currentVal) == 0)
|
assert(dvar != nullptr);
|
||||||
{
|
|
||||||
// The dvar is already set to the value we want
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Game::Dvar_SetFromStringFromSource(dvar, parsedValue, Game::DvarSetSource::DVAR_SOURCE_INTERNAL);
|
Game::Dvar_SetFromStringFromSource(dvar, parsedValue, Game::DvarSetSource::DVAR_SOURCE_INTERNAL);
|
||||||
Logger::Print("Overriding '{}' from '{}'\n", dvarName, fileName);
|
Logger::Print("Overriding '{}' from '{}'\n", dvarName, fileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user