Hack in support for duel as a reported gametype to stats
authorMario <mario@smbclan.net>
Mon, 2 Jan 2017 14:06:02 +0000 (00:06 +1000)
committerMario <mario@smbclan.net>
Mon, 2 Jan 2017 14:06:02 +0000 (00:06 +1000)
qcsrc/common/playerstats.qc

index b879b63..74585a3 100644 (file)
@@ -257,6 +257,12 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that
        else { PlayerStats_GameReport_DelayMapVote = false; }
 }
 
        else { PlayerStats_GameReport_DelayMapVote = false; }
 }
 
+// this... is a hack, a temporary one until we get a proper duel gametype
+string PlayerStats_GetGametype()
+{
+       return ((IS_GAMETYPE(DEATHMATCH) && autocvar_g_maxplayers == 2) ? "duel" : GetGametype());
+}
+
 void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
 {
        string t, tn;
 void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
 {
        string t, tn;
@@ -313,7 +319,7 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
                        #ifdef WATERMARK
                        url_fputs(fh, sprintf("R %s\n", WATERMARK));
                        #endif
                        #ifdef WATERMARK
                        url_fputs(fh, sprintf("R %s\n", WATERMARK));
                        #endif
-                       url_fputs(fh, sprintf("G %s\n", GetGametype()));
+                       url_fputs(fh, sprintf("G %s\n", PlayerStats_GetGametype()));
                        url_fputs(fh, sprintf("O %s\n", modname));
                        url_fputs(fh, sprintf("M %s\n", GetMapname()));
                        url_fputs(fh, sprintf("I %s\n", matchid));
                        url_fputs(fh, sprintf("O %s\n", modname));
                        url_fputs(fh, sprintf("M %s\n", GetMapname()));
                        url_fputs(fh, sprintf("I %s\n", matchid));
@@ -556,7 +562,7 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
                     case "e":
                         LOG_TRACE("G: ", gt);
                         LOG_TRACE("e: ", data);
                     case "e":
                         LOG_TRACE("G: ", gt);
                         LOG_TRACE("e: ", data);
-                        if (gt == GetGametype()) {
+                        if (gt == PlayerStats_GetGametype()) {
                             handled = true;
                             float e = stof(data);
                             PlayerScore_Add(p, SP_ELO, +1 + e);
                             handled = true;
                             float e = stof(data);
                             PlayerScore_Add(p, SP_ELO, +1 + e);