]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/common.qc
Merge branch 'master' into terencehill/screenshot_viewer
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / common.qc
index 83dcc1e5401cffaf49c8b864faa75436db18a594..13e667ad87123b72c7a282f3633d6940ec1abbd1 100644 (file)
@@ -63,6 +63,7 @@ entity GetIndexedEntity(float argc, float start_index)
        
        next_token = -1;
        index = start_index;
+       selection = world;
        
        if(argc > start_index)
        {
@@ -80,6 +81,8 @@ entity GetIndexedEntity(float argc, float start_index)
                                tmp_number = stof(argv(index));
                                ++index;
                        }
+                       else
+                               tmp_number = 0;
                }
                else // maybe it's ONLY a number?
                {
@@ -102,7 +105,7 @@ entity GetIndexedEntity(float argc, float start_index)
        }
        
        next_token = index;
-       print(strcat("start_index: ", ftos(start_index), ", next_token: ", ftos(next_token), ", edict: ", ftos(num_for_edict(selection)), ".\n"));
+       //print(strcat("start_index: ", ftos(start_index), ", next_token: ", ftos(next_token), ", edict: ", ftos(num_for_edict(selection)), ".\n"));
        return selection;
 }
 
@@ -123,6 +126,7 @@ entity GetFilteredEntity(string input)
        }
        else
        {
+               selection = world;
                FOR_EACH_CLIENT(tmp_player)
                        if (strdecolorize(tmp_player.netname) == strdecolorize(input))
                                selection = tmp_player;
@@ -137,7 +141,7 @@ float GetFilteredNumber(string input)
        entity selection = GetFilteredEntity(input);
        float output;
        
-       if(selection) { output = num_for_edict(selection); }
+       output = num_for_edict(selection);
 
        return output;
 }
@@ -298,7 +302,7 @@ void CommonCommand_cvar_purechanges(float request, entity caller)
        }
 }
 
-void CommonCommand_info(float request, entity caller, float argc) // legacy
+void CommonCommand_info(float request, entity caller, float argc) 
 {      
        switch(request)
        {
@@ -384,7 +388,7 @@ void CommonCommand_lsnewmaps(float request, entity caller)
        }
 }
 
-void CommonCommand_maplist(float request, entity caller)
+void CommonCommand_printmaplist(float request, entity caller)
 {
        switch(request)
        {
@@ -397,37 +401,13 @@ void CommonCommand_maplist(float request, entity caller)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " maplist"));
+                       print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " printmaplist"));
                        print_to(caller, "  No arguments required.");
                        return;
                }
        }
 }
 
-/*
-void GameCommand_rankings(float request) // this is OLD.... jeez.
-{
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       strunzone(rankings_reply);
-                       rankings_reply = strzone(getrankings());
-                       print(rankings_reply);
-                       return;
-               }
-                       
-               default:
-               case CMD_REQUEST_USAGE:
-               {
-                       print("\nUsage:^3 sv_cmd rankings");
-                       print("  No arguments required.");
-                       return;
-               }
-       }
-}
-*/
-
 void CommonCommand_rankings(float request, entity caller)
 {
        switch(request)
@@ -457,7 +437,8 @@ void CommonCommand_records(float request, entity caller)
                        float i;
                        
                        for(i = 0; i < 10; ++i)
-                               print_to(caller, records_reply[i]);
+                               if(records_reply[i] != "")
+                                       print_to(caller, records_reply[i]);
                                
                        return; // never fall through to usage
                }
@@ -637,6 +618,7 @@ void CommonCommand_who(float request, entity caller, float argc)
                        print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20s %-5s %-3s %-9s %-16s %s "), 
                                "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
                        
+                       total_listed_players = 0;
                        FOR_EACH_CLIENT(tmp_player)
                        {
                                is_bot = (clienttype(tmp_player) == CLIENTTYPE_BOT);
@@ -729,7 +711,7 @@ void CommonCommand_(float request, entity caller)
        COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
        COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
        COMMON_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, caller), "List maps which have no records or are seemingly unplayed yet") \
-       COMMON_COMMAND("maplist", CommonCommand_maplist(request, caller), "Display full server maplist reply") \
+       COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \
        COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
        COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
        COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
@@ -782,4 +764,4 @@ void CommonCommand_macro_write_aliases(float fh)
        #undef COMMON_COMMAND
        
        return;
-}
\ No newline at end of file
+}