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:
Vincent Herbet 2015-12-11 14:45:59 +01:00
commit 8bb8aaa0db

View File

@ -392,6 +392,12 @@ void CvarManager::SetCvarMin(CvarInfo* info, bool set, float value, int pluginId
if (set) if (set)
{ {
// Detour is disabled on map change.
if (m_HookDetour)
{
m_HookDetour->EnableDetour();
}
info->bound.minVal = value; info->bound.minVal = value;
// Current value is already in the allowed range. // Current value is already in the allowed range.
@ -400,12 +406,6 @@ void CvarManager::SetCvarMin(CvarInfo* info, bool set, float value, int pluginId
return; return;
} }
// Detour is disabled on map change.
if (m_HookDetour)
{
m_HookDetour->EnableDetour();
}
// Update if needed. // Update if needed.
CVAR_SET_FLOAT(info->var->name, value); CVAR_SET_FLOAT(info->var->name, value);
} }
@ -418,6 +418,12 @@ void CvarManager::SetCvarMax(CvarInfo* info, bool set, float value, int pluginId
if (set) if (set)
{ {
// Detour is disabled on map change.
if (m_HookDetour)
{
m_HookDetour->EnableDetour();
}
info->bound.maxVal = value; info->bound.maxVal = value;
// Current value is already in the allowed range. // Current value is already in the allowed range.
@ -426,12 +432,6 @@ void CvarManager::SetCvarMax(CvarInfo* info, bool set, float value, int pluginId
return; return;
} }
// Detour is disabled on map change.
if (m_HookDetour)
{
m_HookDetour->EnableDetour();
}
// Update if needed. // Update if needed.
CVAR_SET_FLOAT(info->var->name, value); CVAR_SET_FLOAT(info->var->name, value);
} }