X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=a20c31dd63e18ee5d133bf46dc62b970b1414e8d;hp=a0d5252989007663e1a95dbea3ab8263316de098;hb=4fc59bbd7e2d4f25ba21952ed50ae754295a7faa;hpb=94e835a6d26832fbf3478d208f23ec4d35449839 diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index a0d5252989..a20c31dd63 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -578,9 +578,19 @@ void GetCvars_handleFloatOnce(string thisname, float f, .float field, string nam stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n")); } } -string W_FixWeaponOrder_ForceComplete(string s); -string W_FixWeaponOrder_AllowIncomplete(string s); float w_getbestweapon(entity e); +string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo) +{ + string o; + o = W_FixWeaponOrder_ForceComplete(wo); + if(self.weaponorder_byimpulse) + { + strunzone(self.weaponorder_byimpulse); + self.weaponorder_byimpulse = string_null; + } + self.weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o)); + return o; +} void GetCvars(float f) { string s; @@ -597,7 +607,7 @@ void GetCvars(float f) GetCvars_handleFloat(s, f, cvar_cl_shownames, "cl_shownames"); GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion"); GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap"); - GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete); + GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[2], "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete); @@ -1720,7 +1730,6 @@ void precache() #define INITPRIO_FIRST 0 #define INITPRIO_GAMETYPE 0 #define INITPRIO_GAMETYPE_FALLBACK 1 -#define INITPRIO_CVARS 5 #define INITPRIO_FINDTARGET 10 #define INITPRIO_DROPTOFLOOR 20 #define INITPRIO_SETLOCATION 90 @@ -2272,10 +2281,9 @@ const float LADDER_CNT = 10; // position X still gives LADDER_FIRSTPOINT/X point const float LADDER_SIZE = 30; // ladder shows the top X players string top_uids[LADDER_SIZE]; float top_scores[LADDER_SIZE]; -float UIDCNT; string getladder() { - float i, j, k; + float i, j, k, uidcnt; string s, temp_s; s = ""; @@ -2296,17 +2304,17 @@ string getladder() for (i = 0; i <= LADDER_CNT; ++i) { // i = 0 because it is the speed award if(i == 0) // speed award { - if(stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed"))) == 0); - break; + if(stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, rr, "speed/speed"))) == 0) + continue; - myuid = db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp")); + myuid = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, rr, "speed/crypto_idfp")); } else // normal record, if it exists (else break) { - if(race_readTime(GetMapname(), i) == 0) - break; + if(race_readTime(MapInfo_Map_bspname, i) == 0) + continue; - myuid = race_readUID(GetMapname(), i); + myuid = race_readUID(MapInfo_Map_bspname, i); } // string s contains: @@ -2319,8 +2327,8 @@ string getladder() temp_s = db_get(TemporaryDB, strcat("ladder", myuid)); if (temp_s == "") { - db_put(TemporaryDB, strcat("uid", ftos(UIDCNT)), myuid); - ++UIDCNT; + db_put(TemporaryDB, strcat("uid", ftos(uidcnt)), myuid); + ++uidcnt; for (j = 0; j <= LADDER_CNT + 1; ++j) { if(j != LADDER_CNT + 1) @@ -2373,7 +2381,7 @@ string getladder() float thiscnt; string thisuid; - for (i = 0; i <= UIDCNT; ++i) // for each known uid + for (i = 0; i <= uidcnt; ++i) // for each known uid { thisuid = db_get(TemporaryDB, strcat("uid", ftos(i))); temp_s = db_get(TemporaryDB, strcat("ladder", thisuid)); @@ -2428,10 +2436,16 @@ string getladder() continue; s = strcat(s, strpad(4, race_placeName(i+1)), "^3| ^7"); // pos s = strcat(s, strpad(7, argv(LADDER_CNT+1)), "^3| ^7"); // total - for (j = 1; j <= LADDER_CNT; ++j) + for (j = 1; j <= min(9, LADDER_CNT); ++j) { s = strcat(s, strpad(4, argv(j)), "^3| ^7"); // 1st, 2nd, 3rd etc cnt } + if(LADDER_CNT > 9) + for (j = 10; j <= LADDER_CNT; ++j) + { + s = strcat(s, strpad(4, argv(j)), " ^3| ^7"); // 1st, 2nd, 3rd etc cnt + } + s = strcat(s, strpad(13, argv(0)), "^3| ^7"); // speed award cnt s = strcat(s, uid2name(top_uids[i]), "\n"); // name }