]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix a possible bug with player stats when they are NOT enabled
authorRudolf Polzer <divVerent@xonotic.org>
Wed, 1 Dec 2010 08:02:53 +0000 (09:02 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Wed, 1 Dec 2010 08:02:53 +0000 (09:02 +0100)
qcsrc/server/g_world.qc
qcsrc/server/playerstats.qc
qcsrc/server/playerstats.qh

index 1b9596909d5e072b0662e40fa0c36260165073c1..29ebeb31530bd0a402059ede08517fbeaeb63c94 100644 (file)
@@ -2727,7 +2727,7 @@ void MapVote_Start()
                return;
 
        // wait for stats to be sent first
-       if(!playerstats_sent)
+       if(!playerstats_waitforme)
                return;
 
        MapInfo_Enumerate();
index 7da57f2c23102dc26ca4e73af96cce7387940e21..829fe5767c68d7abad6bb2f41f13b7b8ee9f29d6 100644 (file)
@@ -7,13 +7,14 @@ float playerstats_requested;
 void PlayerStats_Init()
 {
        string uri;
-       playerstats_sent = TRUE;
+       playerstats_db = -1;
+       playerstats_waitforme = TRUE;
        uri = cvar_string("g_playerstats_uri");
        if(uri == "")
                return;
        playerstats_db = db_create();
        if(playerstats_db >= 0)
-               playerstats_sent = FALSE; // must wait for it at match end
+               playerstats_waitforme = FALSE; // must wait for it at match end
        
        PlayerStats_AddEvent(PLAYERSTATS_ALIVETIME);
        PlayerStats_AddEvent(PLAYERSTATS_KILLS);
@@ -81,7 +82,7 @@ void PlayerStats_Event(entity e, string event_id, float value)
 void PlayerStats_Sent_URI_Get_Callback(float id, float status, string data)
 {
        if(playerstats_requested)
-               playerstats_sent = TRUE;
+               playerstats_waitforme = TRUE;
 }
 
 void PlayerStats_Shutdown()
@@ -126,12 +127,12 @@ void PlayerStats_Shutdown()
                if(crypto_uri_postbuf(uri, URI_GET_PLAYERSTATS_SENT, "text/plain", "\n", b, 0))
                        playerstats_requested = TRUE;
                else
-                       playerstats_sent = TRUE; // if posting fails, we must continue anyway
+                       playerstats_waitforme = TRUE; // if posting fails, we must continue anyway
 
                buf_del(b);
        }
        else
-               playerstats_sent = TRUE;
+               playerstats_waitforme = TRUE;
 
        db_close(playerstats_db);
        playerstats_db = -1;
index b7b425f29289c2abf6b166e53fd19676e8df4cdf..fea546a123d5e4719bbac67b2fd6d1739563f4a9 100644 (file)
@@ -3,7 +3,7 @@ string PLAYERSTATS_ALIVETIME = "alivetime";
 string PLAYERSTATS_KILLS     = "kills";
 
 // delay map switch until this is set
-float playerstats_sent;
+float playerstats_waitforme;
 
 // call at initialization
 void PlayerStats_Init();