mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-27 07:15:37 +03:00
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)
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user