| 514 | } |
| 515 | |
| 516 | void ConVarManager::HookConVarChange(ConVar *pConVar, IPluginFunction *pFunction) |
| 517 | { |
| 518 | ConVarInfo *pInfo; |
| 519 | IChangeableForward *pForward; |
| 520 | |
| 521 | /* Find the convar in the lookup trie */ |
| 522 | if (convar_cache_lookup(pConVar->GetName(), &pInfo)) |
| 523 | { |
| 524 | /* Get the forward */ |
| 525 | pForward = pInfo->pChangeForward; |
| 526 | |
| 527 | /* If forward does not exist, create it */ |
| 528 | if (!pForward) |
| 529 | { |
| 530 | pForward = forwardsys->CreateForwardEx(NULL, ET_Ignore, 3, CONVARCHANGE_PARAMS); |
| 531 | pInfo->pChangeForward = pForward; |
| 532 | } |
| 533 | |
| 534 | /* Add function to forward's list */ |
| 535 | pForward->AddFunction(pFunction); |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | void ConVarManager::UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFunction) |
| 540 | { |
no test coverage detected