Cvars: Add new description param in get_plugins_cvar

This commit is contained in:
Arkshine
2015-01-25 11:38:01 +01:00
parent cb0b9da51f
commit 8a241ed0fd
3 changed files with 29 additions and 11 deletions

View File

@ -234,6 +234,17 @@ cvar_t* CvarManager::CreateCvar(const char* name, const char* value, const char*
// Make sure that whether an existing or new cvar is set to the given value.
CVAR_DIRECTSET(var, value);
}
else
{
// In case a plugin has been recompiling with some changes
// after a change map occurred, we keep default data up to date.
info->description = helpText;
info->defaultval = value;
info->hasMin = hasMin;
info->minVal = min;
info->hasMax = hasMin;
info->maxVal = max;
}
// Detour is disabled on map change.
m_HookDetour->EnableDetour();

View File

@ -553,7 +553,7 @@ static cell AMX_NATIVE_CALL remove_cvar_flags(AMX *amx, cell *params)
return 0;
}
// get_plugins_cvar(id, name[], namelen, &flags=0, &plugin_id=0, &pcvar_handle=0)
// get_plugins_cvar(id, name[], namelen, &flags=0, &plugin_id=0, &pcvar_handle=0, description[]="", desc_len=0)
static cell AMX_NATIVE_CALL get_plugins_cvar(AMX *amx, cell *params)
{
CvarInfo* info = g_CvarManager.FindCvar(params[1]);
@ -565,6 +565,11 @@ static cell AMX_NATIVE_CALL get_plugins_cvar(AMX *amx, cell *params)
*get_amxaddr(amx, params[5]) = info->pluginId;
*get_amxaddr(amx, params[6]) = reinterpret_cast<cell>(info->var);
if (*params / sizeof(cell) >= 7)
{
set_amxstring(amx, params[7], info->description.chars(), params[8]);
}
return 1;
}