Skip to content

Added the ability to add callbacks to ConVar that will be called when ConVar is changed. #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Changed to raise an exception if ConCommand already exists when creat…
…ing ConVar.
  • Loading branch information
CookStar committed Oct 4, 2021
commit 080d8cad384ace6658b128f508a46f6778755276
5 changes: 5 additions & 0 deletions src/core/modules/cvars/cvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ boost::shared_ptr<ConVar> ConVarExt::__init__(const char* name, const char* valu
ConVar *pConVar = g_pCVar->FindVar(name);
if (!pConVar)
{
// Find if the command already exists
ConCommand* pConCommand = g_pCVar->FindCommand(name);
if (pConCommand)
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "ConCommand already exists.")

ConVar* pConVar = new ConVar(strdup(name), strdup(value), flags,
strdup(description), !min_value.is_none(), fMin, !max_value.is_none(), fMax);

Expand Down