X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fgetreplies.qc;h=b768ccb7e8510355d99068660661fd901dd96054;hb=e0012447bfce1b551df3dc01b043655aa93dafad;hp=d2233029d8eee619902f4dc55175825e687c7783;hpb=317ec3eb27ada1c4668876e9499136125acb7984;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index d2233029d..b768ccb7e 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -1,13 +1,19 @@ -#include "../../common/command/command.qh" +#include "getreplies.qh" + +#include +#include + +#include #include "getreplies.qh" #include "../race.qh" -#include "../../common/constants.qh" -#include "../../common/mapinfo.qh" -#include "../../common/util.qh" +#include +#include +#include +#include -#include "../../common/monsters/all.qh" +#include // ========================================================= // Reply messages for common commands, re-worked by Samual @@ -26,12 +32,13 @@ string getrecords(int page) // 50 records per page string s = ""; MUTATOR_CALLHOOK(GetRecords, page, s); - s = ret_string; + s = M_ARGV(1, string); MapInfo_ClearTemps(); - if (s == "" && page == 0) return "No records are available on this server.\n"; - else return s; + if (s == "" && page == 0) + return "No records are available on this server for the current game mode.\n"; + return s; } string getrankings() @@ -240,22 +247,24 @@ string getmaplist() return sprintf("^7Maps in list: %s\n", maplist); } - +const int LSMAPS_MAX = 250; string getlsmaps() { string lsmaps = "", col; - float i, newmaps = 0; + bool newmaps = false; + int added = 0; - for (i = 0; i < MapInfo_count; ++i) + for (int i = 0; i < MapInfo_count; ++i) { if ((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags())) { + ++added; + + if(added > LSMAPS_MAX) + continue; // we still get the added count, but skip the actual processing + // todo: Check by play count of maps for other game types? - if ( - (g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time")))) - || - (g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time")))) - ) + if((g_race || g_cts) && !race_readTime(MapInfo_Map_bspname, 1)) { newmaps = true; if (i % 2) col = "^4*"; else col = "^5*"; @@ -269,19 +278,22 @@ string getlsmaps() } } + if(added > LSMAPS_MAX) + lsmaps = sprintf("%s^7(%d not listed)", lsmaps, added - LSMAPS_MAX); + MapInfo_ClearTemps(); - return sprintf("^7Maps available (%d)%s: %s\n", tokenize_console(lsmaps), (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps); + return sprintf("^7Maps available (%d)%s: %s\n", added, (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps); } string getmonsterlist() { - string monsterlist = "", col; + string monsterlist = ""; - for (int i = MON_FIRST; i <= MON_LAST; ++i) + FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MON_FLAG_HIDDEN), { - if (i % 2) col = "^2"; else col = "^3"; - monsterlist = sprintf("%s%s%s ", monsterlist, col, (get_monsterinfo(i)).netname); - } + string col = ((i % 2) ? "^2" : "^3"); + monsterlist = sprintf("%s%s%s ", monsterlist, col, it.netname); + }); return sprintf("^7Monsters available: %s\n", monsterlist); }