-Changed the SDL window icon back to DP's icon.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 5 May 2005 12:48:43 +0000 (12:48 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 5 May 2005 12:48:43 +0000 (12:48 +0000)
-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

cmd.c
cvar.c
netconn.c
vid_sdl.c

diff --git a/cmd.c b/cmd.c
index 89c5a8b..cd88630 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -355,11 +355,21 @@ static void Cmd_Alias_f (void)
 
        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
@@ -579,6 +589,7 @@ Cmd_AddCommand
 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])
@@ -601,7 +612,16 @@ void Cmd_AddCommand (const char *cmd_name, xcommand_t function)
        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;
 }
 
 /*
diff --git a/cvar.c b/cvar.c
index cdd4def..a8f6a27 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -329,8 +329,15 @@ void Cvar_RegisterVariable (cvar_t *variable)
        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;
 }
 
 /*
index 5f64acd..4e68c72 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -186,6 +186,8 @@ static qboolean _ServerList_CompareInt( int A, serverlist_maskop_t op, int B )
                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" );
@@ -332,7 +334,7 @@ static void _ServerList_Test(void)
 {
        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;
index c2ece59..826d8d9 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -346,8 +346,7 @@ static void VID_SetCaption()
        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