]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid code duplication in some Race code
authorterencehill <piuntn@gmail.com>
Fri, 26 Apr 2019 17:24:19 +0000 (19:24 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 26 Apr 2019 17:24:19 +0000 (19:24 +0200)
qcsrc/client/main.qc

index c22f0d40274e82188c1c3c0451c02d2f3b49dcd2..026db91f5edc84e519b6ceb71a41cd3a88c8e111 100644 (file)
@@ -308,7 +308,7 @@ bool SetTeam(entity o, int Team)
 
 void Playerchecker_Think(entity this)
 {
 
 void Playerchecker_Think(entity this)
 {
-    int i;
+       int i;
        entity e;
        for(i = 0; i < maxclients; ++i)
        {
        entity e;
        for(i = 0; i < maxclients; ++i)
        {
@@ -1121,17 +1121,12 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        break;
 
                case RACE_NET_PENALTY_RACE:
                        break;
 
                case RACE_NET_PENALTY_RACE:
-                       race_penaltyeventtime = time;
-                       race_penaltytime = ReadShort();
-                       //race_penaltyaccumulator += race_penaltytime;
-                       strcpy(race_penaltyreason, ReadString());
-                       break;
-
                case RACE_NET_PENALTY_QUALIFYING:
                        race_penaltyeventtime = time;
                        race_penaltytime = ReadShort();
                case RACE_NET_PENALTY_QUALIFYING:
                        race_penaltyeventtime = time;
                        race_penaltytime = ReadShort();
-                       race_penaltyaccumulator += race_penaltytime;
                        strcpy(race_penaltyreason, ReadString());
                        strcpy(race_penaltyreason, ReadString());
+                       if (b == RACE_NET_PENALTY_QUALIFYING)
+                               race_penaltyaccumulator += race_penaltytime;
                        break;
 
                case RACE_NET_SERVER_RECORD:
                        break;
 
                case RACE_NET_SERVER_RECORD:
@@ -1152,12 +1147,12 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        break;
                case RACE_NET_SERVER_RANKINGS:
                        float prevpos, del;
                        break;
                case RACE_NET_SERVER_RANKINGS:
                        float prevpos, del;
-            int pos = ReadShort();
+                       int pos = ReadShort();
                        prevpos = ReadShort();
                        del = ReadShort();
 
                        // move other rankings out of the way
                        prevpos = ReadShort();
                        del = ReadShort();
 
                        // move other rankings out of the way
-            int i;
+                       int i;
                        if (prevpos) {
                                int m = min(prevpos, RANKINGS_DISPLAY_CNT);
                                for (i=m-1; i>pos-1; --i) {
                        if (prevpos) {
                                int m = min(prevpos, RANKINGS_DISPLAY_CNT);
                                for (i=m-1; i>pos-1; --i) {