Merge pull request #318 from Arkshine/fix-cvar-bounds-and-hook
Enable hook detour on cvar with bounds regardless current value
This commit is contained in:
commit
8bb8aaa0db
@ -392,6 +392,12 @@ void CvarManager::SetCvarMin(CvarInfo* info, bool set, float value, int pluginId
|
||||
|
||||
if (set)
|
||||
{
|
||||
// Detour is disabled on map change.
|
||||
if (m_HookDetour)
|
||||
{
|
||||
m_HookDetour->EnableDetour();
|
||||
}
|
||||
|
||||
info->bound.minVal = value;
|
||||
|
||||
// Current value is already in the allowed range.
|
||||
@ -400,12 +406,6 @@ void CvarManager::SetCvarMin(CvarInfo* info, bool set, float value, int pluginId
|
||||
return;
|
||||
}
|
||||
|
||||
// Detour is disabled on map change.
|
||||
if (m_HookDetour)
|
||||
{
|
||||
m_HookDetour->EnableDetour();
|
||||
}
|
||||
|
||||
// Update if needed.
|
||||
CVAR_SET_FLOAT(info->var->name, value);
|
||||
}
|
||||
@ -418,6 +418,12 @@ void CvarManager::SetCvarMax(CvarInfo* info, bool set, float value, int pluginId
|
||||
|
||||
if (set)
|
||||
{
|
||||
// Detour is disabled on map change.
|
||||
if (m_HookDetour)
|
||||
{
|
||||
m_HookDetour->EnableDetour();
|
||||
}
|
||||
|
||||
info->bound.maxVal = value;
|
||||
|
||||
// Current value is already in the allowed range.
|
||||
@ -426,12 +432,6 @@ void CvarManager::SetCvarMax(CvarInfo* info, bool set, float value, int pluginId
|
||||
return;
|
||||
}
|
||||
|
||||
// Detour is disabled on map change.
|
||||
if (m_HookDetour)
|
||||
{
|
||||
m_HookDetour->EnableDetour();
|
||||
}
|
||||
|
||||
// Update if needed.
|
||||
CVAR_SET_FLOAT(info->var->name, value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user