-Cmds, Cvars and Aliases are now inserted at the right alphanumerical
position on creation.
-Fixed a bug in the serverlist which caused it to not mask entries properly.
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5225
d7cf8633-e32d-0410-b094-
e92efae38249
if (!a)
{
+ cmdalias_t *prev, *current;
+
a = Z_Malloc (sizeof(cmdalias_t));
- a->next = cmd_alias;
- cmd_alias = a;
+ strlcpy (a->name, s, sizeof (a->name));
+ // insert it at the right alphanumeric position
+ for( prev = NULL, current = cmd_alias ; current && strcmp( current->name, a->name ) < 0 ; prev = current, current = current->next )
+ ;
+ if( prev ) {
+ prev->next = a;
+ } else {
+ cmd_alias = a;
+ }
+ a->next = current;
}
- strlcpy (a->name, s, sizeof (a->name));
+
// copy the rest of the command line
cmd[0] = 0; // start out with a null string
void Cmd_AddCommand (const char *cmd_name, xcommand_t function)
{
cmd_function_t *cmd;
+ cmd_function_t *prev, *current;
// fail if the command is a variable name
if (Cvar_VariableString(cmd_name)[0])
cmd->name = cmd_name;
cmd->function = function;
cmd->next = cmd_functions;
- cmd_functions = cmd;
+
+// insert it at the right alphanumeric position
+ for( prev = NULL, current = cmd_functions ; current && strcmp( current->name, cmd->name ) < 0 ; prev = current, current = current->next )
+ ;
+ if( prev ) {
+ prev->next = cmd;
+ } else {
+ cmd_functions = cmd;
+ }
+ cmd->next = current;
}
/*
variable->integer = (int) variable->value;
// link the variable in
- variable->next = cvar_vars;
- cvar_vars = variable;
+// alphanumerical order
+ for( cvar = NULL, cvar2 = cvar_vars ; cvar2 && strcmp( cvar2->name, variable->name ) < 0 ; cvar = cvar2, cvar2 = cvar->next )
+ ;
+ if( cvar ) {
+ cvar->next = variable;
+ } else {
+ cvar_vars = variable;
+ }
+ variable->next = cvar2;
}
/*
case SLMO_NOTEQUAL:
return A != B;
case SLMO_GREATEREQUAL:
+ case SLMO_CONTAINS:
+ case SLMO_NOTCONTAIN:
return A >= B;
default:
Con_DPrint( "_ServerList_CompareInt: Bad op!\n" );
{
int i;
for( i = 0 ; i < 1024 ; i++ ) {
- memset( &serverlist_cache[serverlist_cachecount], 0, sizeof( serverlist_t ) );
+ memset( &serverlist_cache[serverlist_cachecount], 0, sizeof( serverlist_entry_t ) );
serverlist_cache[serverlist_cachecount].info.ping = rand() % 450 + 250;
dpsnprintf( serverlist_cache[serverlist_cachecount].info.name, 128, "Black's ServerList Test %i", i );
serverlist_cache[serverlist_cachecount].finished = true;
if( !SDL_GetWMInfo( &info ) )
return;
- //icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );
- icon = LoadIcon( NULL, IDI_ERROR );
+ icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );
SetClassLong( info.window, GCL_HICON, (LONG) icon );
}
#else