Enable hook detour on cvar with bounds regardless current value

This commit is contained in:
Arkshine 2015-12-11 10:32:48 +01:00
parent 4cea082303
commit cc9f679a85

View File

@ -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);
}