diff options
| author | oy <Tom_Adams@web.de> | 2011-12-29 23:36:53 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-12-29 23:36:53 +0100 |
| commit | b44ee3d9755ff35a6df1358dcfe85ce681bbe081 (patch) | |
| tree | a168de3012907094d550d22771b103c1f35b9fa8 /src/engine/shared/console.cpp | |
| parent | 72d5ef329b1a0ec07f8fb6c5e23011b7e1a45b61 (diff) | |
| download | zcatch-b44ee3d9755ff35a6df1358dcfe85ce681bbe081.tar.gz zcatch-b44ee3d9755ff35a6df1358dcfe85ce681bbe081.zip | |
reworked ban system
Diffstat (limited to 'src/engine/shared/console.cpp')
| -rw-r--r-- | src/engine/shared/console.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index de5116c1..1b98a158 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -658,7 +658,13 @@ void CConsole::AddCommandSorted(CCommand *pCommand) void CConsole::Register(const char *pName, const char *pParams, int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp) { - CCommand *pCommand = new(mem_alloc(sizeof(CCommand), sizeof(void*))) CCommand; + CCommand *pCommand = FindCommand(pName, Flags); + bool DoAdd = false; + if(pCommand == 0) + { + pCommand = new(mem_alloc(sizeof(CCommand), sizeof(void*))) CCommand; + DoAdd = true; + } pCommand->m_pfnCallback = pfnFunc; pCommand->m_pUserData = pUser; @@ -669,7 +675,8 @@ void CConsole::Register(const char *pName, const char *pParams, pCommand->m_Flags = Flags; pCommand->m_Temp = false; - AddCommandSorted(pCommand); + if(DoAdd) + AddCommandSorted(pCommand); } void CConsole::RegisterTemp(const char *pName, const char *pParams, int Flags, const char *pHelp) |