]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
playerstats: properly handle different ways of match ending
authorRudolf Polzer <divverent@alientrap.org>
Fri, 14 Jan 2011 22:27:48 +0000 (23:27 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 14 Jan 2011 22:27:48 +0000 (23:27 +0100)
qcsrc/server/g_world.qc
qcsrc/server/playerstats.qc
qcsrc/server/playerstats.qh

index b01d8515b8194f43915942dd80a97dfe6ea7a55b..67fb91fc2b91c45a64c57bcbb999c66bfea8c370 100644 (file)
@@ -1523,11 +1523,6 @@ void DumpStats(float final)
                fputs(file, ":end\n");
                fclose(file);
        }
-
-       // send statistics
-       FOR_EACH_CLIENT(e)
-               PlayerStats_AddGlobalInfo(e);
-       PlayerStats_Shutdown();
 }
 
 void FixIntermissionClient(entity e)
@@ -1595,7 +1590,13 @@ void NextLevel()
        VoteReset();
 
        DumpStats(TRUE);
-       PlayerStats_EndMatch();
+
+       // send statistics
+       entity e;
+       PlayerStats_EndMatch(1);
+       FOR_EACH_CLIENT(e)
+               PlayerStats_AddGlobalInfo(e);
+       PlayerStats_Shutdown();
 
        if(autocvar_sv_eventlog)
                GameLogEcho(":gameover");
@@ -2941,6 +2942,7 @@ void SV_Shutdown()
                print("Saving persistent data...\n");
                Ban_SaveBans();
 
+               PlayerStats_EndMatch(0);
                FOR_EACH_CLIENT(e)
                        PlayerStats_AddGlobalInfo(e);
                PlayerStats_Shutdown();
index a8efa82c8ebfb1808cfb2d8e4302fb9028ae4359..2d1e2191203deb48ab93572a7f9b40f9b537ee6f 100644 (file)
@@ -179,13 +179,16 @@ void PlayerStats_AddGlobalInfo(entity p)
        p.playerstats_id = string_null;
 }
 
-void PlayerStats_EndMatch()
+void PlayerStats_EndMatch(float finished)
 {
        entity p;
        FOR_EACH_PLAYER(p)
        {
                PlayerScore_PlayerStats(p);
-               PlayerStats_Event(p, PLAYERSTATS_WINS, p.winning);
-               PlayerStats_Event(p, PLAYERSTATS_MATCHES, 1);
+               if(finished)
+               {
+                       PlayerStats_Event(p, PLAYERSTATS_WINS, p.winning);
+                       PlayerStats_Event(p, PLAYERSTATS_MATCHES, 1);
+               }
        }
 }
index 1dea13ce7e268bd73dad398c4fffbd59297df2c2..5f765e211263bd13b450a36027b1d25f0b4572a6 100644 (file)
@@ -30,4 +30,4 @@ void PlayerStats_Sent_URI_Get_Callback(float id, float status, string data);
 void PlayerStats_AddGlobalInfo(entity p);
 
 // call this at the end of the match
-void PlayerStats_EndMatch()
+void PlayerStats_EndMatch(float finished);