X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fgetreplies.qc;h=415d20f9cf34b3a14d3a4a615d8cb37d11d6498e;hb=43820f59de0be2bb0254bd6c235cce4c5858c672;hp=3640c817283545f2ca27058cce0bfc840f54beba;hpb=687a42edc07762ab7b176c6d2af5d0f7cec97147;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 3640c8172..415d20f9c 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -14,6 +14,8 @@ string getrecords(float page) // 50 records per page { float rec = 0, r, i; string h, s; + + s = ""; if (g_ctf) { @@ -23,7 +25,7 @@ string getrecords(float page) // 50 records per page { r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time"))); - if (r == 0) + if not(r) continue; // TODO: uid2name @@ -42,7 +44,7 @@ string getrecords(float page) // 50 records per page { r = race_readTime(MapInfo_Map_bspname, 1); - if (r == 0) + if not(r) continue; h = race_readName(MapInfo_Map_bspname, 1); @@ -60,7 +62,7 @@ string getrecords(float page) // 50 records per page { r = race_readTime(MapInfo_Map_bspname, 1); - if (r == 0) + if not(r) continue; h = race_readName(MapInfo_Map_bspname, 1); @@ -72,7 +74,7 @@ string getrecords(float page) // 50 records per page MapInfo_ClearTemps(); - if (s == "" && page == 0) + if(s == "" && page == 0) return "No records are available on this server.\n"; else return s; @@ -85,6 +87,7 @@ string getrankings() map = GetMapname(); + s = ""; for (i = 1; i <= RANKINGS_CNT; ++i) { t = race_readTime(map, i); @@ -93,7 +96,7 @@ string getrankings() continue; n = race_readName(map, i); - p = race_placeName(i); + p = count_ordinal(i); s = strcat(s, strpad(8, p), " ", strpad(-8, TIME_ENCODED_TOSTRING(t)), " ", n, "\n"); } @@ -107,7 +110,7 @@ string getrankings() string getladder() { - float i, j, k, uidcnt, thiscnt; + float i, j, k, uidcnt = 0, thiscnt; string s, temp_s, rr, myuid, thisuid; if(g_cts) @@ -237,7 +240,7 @@ string getladder() s = strcat(s, " ^7Total ^3|"); for(i = 1; i <= LADDER_CNT; ++i) - { s = strcat(s, " ^7", race_placeName(i), " ^3|"); } + { s = strcat(s, " ^7", count_ordinal(i), " ^3|"); } s = strcat(s, " ^7Speed awards ^3| ^7Name"); s = strcat(s, "\n^3----+--------"); @@ -260,7 +263,7 @@ string getladder() if(argv(LADDER_CNT+1) == "") // total is 0, skip continue; - s = strcat(s, strpad(4, race_placeName(i+1)), "^3| ^7"); // pos + s = strcat(s, strpad(4, count_ordinal(i+1)), "^3| ^7"); // pos s = strcat(s, strpad(7, argv(LADDER_CNT+1)), "^3| ^7"); // total for(j = 1; j <= min(9, LADDER_CNT); ++j) @@ -281,4 +284,59 @@ string getladder() return "No ladder on this server!\n"; else return strcat("Top ", ftos(LADDER_SIZE), " ladder rankings:\n", s); -} \ No newline at end of file +} + +string getmaplist() +{ + string maplist = "", col; + float i, argc; + + argc = tokenize_console(autocvar_g_maplist); + for(i = 0; i < argc; ++i) + { + if(MapInfo_CheckMap(argv(i))) + { + if(mod(i, 2)) { col = "^2"; } + else { col = "^3"; } + maplist = sprintf("%s%s%s ", maplist, col, argv(i)); + } + } + + MapInfo_ClearTemps(); + return sprintf("^7Maps in list: %s\n", maplist); +} + + +string getlsmaps() +{ + string lsmaps = "", col; + float i, newmaps = 0; + + for(i = 0; i < MapInfo_count; ++i) + { + if((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags())) + { + // 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")))) + ) + { + newmaps = TRUE; + if(mod(i, 2)) { col = "^4*"; } + else { col = "^5*"; } + } + else + { + if(mod(i, 2)) { col = "^2"; } + else { col = "^3"; } + } + + lsmaps = sprintf("%s%s%s ", lsmaps, col, MapInfo_Map_bspname); + } + } + + MapInfo_ClearTemps(); + return sprintf("^7Maps available%s: %s\n", (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps); +}