Skip to content

Commit

Permalink
Make sure we initialize cgame console commands only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangz committed Dec 8, 2015
1 parent 607ed43 commit e16819f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cgame/cg_consolecmds.cpp
Expand Up @@ -559,9 +559,14 @@ so it can perform tab completion
*/ */
void CG_InitConsoleCommands() void CG_InitConsoleCommands()
{ {
unsigned i; static bool initialized = false;


for ( i = 0; i < ARRAY_LEN( commands ); i++ ) if (initialized) {
return;
}
initialized = true;

for ( unsigned i = 0; i < ARRAY_LEN( commands ); i++ )
{ {
//Check that the commands are in increasing order so that it can be used by bsearch //Check that the commands are in increasing order so that it can be used by bsearch
if ( i != 0 && Q_stricmp(commands[i-1].cmd, commands[i].cmd) > 0 ) if ( i != 0 && Q_stricmp(commands[i-1].cmd, commands[i].cmd) > 0 )
Expand Down

0 comments on commit e16819f

Please sign in to comment.