]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix sending race scores to bots & player names not showing in CTS
authorMario <mario.mario@y7mail.com>
Sun, 9 Mar 2014 21:04:17 +0000 (08:04 +1100)
committerMario <mario.mario@y7mail.com>
Sun, 9 Mar 2014 21:04:17 +0000 (08:04 +1100)
qcsrc/client/shownames.qc
qcsrc/server/race.qc

index 413eaaf54714170958e354c59a6d5cf39c1bdffb..5deba45c41efe5b66636d4fdd5b65ebfb64c1111 100644 (file)
@@ -104,7 +104,7 @@ void Draw_ShowNames(entity ent)
                if(!ent.sameteam || (ent.sv_entnum == player_localentnum))
                        ent.alpha *= getplayeralpha(ent.sv_entnum-1);
 
-               if(ent.alpha < ALPHA_MIN_VISIBLE)
+               if(ent.alpha < ALPHA_MIN_VISIBLE && gametype != MAPINFO_TYPE_CTS)
                        return;
 
                float dist;
index 0dbe7d11832a3dc00f10d4918c56533410cc552f..8cc7d322c4e3a3fedb09346a9f9fe559fb67d137 100644 (file)
@@ -141,6 +141,9 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only
        if(recordholder == e.netname)
                recordholder = "";
 
+       if(!IS_REAL_CLIENT(e))
+               return;
+
        if(!spec)
                msg_entity = e;
        WRITESPECTATABLE_MSG_ONE({
@@ -183,6 +186,9 @@ void race_SendRankings(float pos, float prevpos, float del, float msg)
 
 void race_SendStatus(float id, entity e)
 {
+       if(!IS_REAL_CLIENT(e))
+               return;
+
        float msg;
        if (id == 0)
                msg = MSG_ONE;
@@ -399,18 +405,21 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                        recordholder = "";
                }
 
-               msg_entity = e;
-               if(g_race_qualifying)
+               if(IS_REAL_CLIENT(e))
                {
-                       WRITESPECTATABLE_MSG_ONE_VARNAME(dummy1, {
-                               WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                               WriteByte(MSG_ONE, TE_CSQC_RACE);
-                               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
-                               WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
-                               WriteInt24_t(MSG_ONE, t); // time to that intermediate
-                               WriteInt24_t(MSG_ONE, recordtime); // previously best time
-                               WriteString(MSG_ONE, recordholder); // record holder
-                       });
+                       msg_entity = e;
+                       if(g_race_qualifying)
+                       {
+                               WRITESPECTATABLE_MSG_ONE_VARNAME(dummy1, {
+                                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
+                                       WriteByte(MSG_ONE, TE_CSQC_RACE);
+                                       WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
+                                       WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
+                                       WriteInt24_t(MSG_ONE, t); // time to that intermediate
+                                       WriteInt24_t(MSG_ONE, recordtime); // previously best time
+                                       WriteString(MSG_ONE, recordholder); // record holder
+                               });
+                       }
                }
        }
        else // RACE! Not Qualifying
@@ -427,49 +436,55 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                else
                        lself = lother = othtime = 0;
 
-               msg_entity = e;
-               WRITESPECTATABLE_MSG_ONE_VARNAME(dummy2, {
-                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_RACE);
-                       WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE);
-                       WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
-                       if(e == oth)
-                       {
-                               WriteInt24_t(MSG_ONE, 0);
-                               WriteByte(MSG_ONE, 0);
-                               WriteString(MSG_ONE, "");
-                       }
-                       else
-                       {
-                               WriteInt24_t(MSG_ONE, TIME_ENCODE(time - race_checkpoint_lasttimes[cp]));
-                               WriteByte(MSG_ONE, lself - lother);
-                               WriteString(MSG_ONE, oth.netname); // record holder
-                       }
-               });
+               if(IS_REAL_CLIENT(e))
+               {
+                       msg_entity = e;
+                       WRITESPECTATABLE_MSG_ONE_VARNAME(dummy2, {
+                               WriteByte(MSG_ONE, SVC_TEMPENTITY);
+                               WriteByte(MSG_ONE, TE_CSQC_RACE);
+                               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE);
+                               WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
+                               if(e == oth)
+                               {
+                                       WriteInt24_t(MSG_ONE, 0);
+                                       WriteByte(MSG_ONE, 0);
+                                       WriteString(MSG_ONE, "");
+                               }
+                               else
+                               {
+                                       WriteInt24_t(MSG_ONE, TIME_ENCODE(time - race_checkpoint_lasttimes[cp]));
+                                       WriteByte(MSG_ONE, lself - lother);
+                                       WriteString(MSG_ONE, oth.netname); // record holder
+                               }
+                       });
+               }
 
                race_checkpoint_lastplayers[cp] = e;
                race_checkpoint_lasttimes[cp] = time;
                race_checkpoint_lastlaps[cp] = lself;
 
-               msg_entity = oth;
-               WRITESPECTATABLE_MSG_ONE_VARNAME(dummy3, {
-                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_RACE);
-                       WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT);
-                       WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
-                       if(e == oth)
-                       {
-                               WriteInt24_t(MSG_ONE, 0);
-                               WriteByte(MSG_ONE, 0);
-                               WriteString(MSG_ONE, "");
-                       }
-                       else
-                       {
-                               WriteInt24_t(MSG_ONE, TIME_ENCODE(time - othtime));
-                               WriteByte(MSG_ONE, lother - lself);
-                               WriteString(MSG_ONE, e.netname); // record holder
-                       }
-               });
+               if(IS_REAL_CLIENT(oth))
+               {
+                       msg_entity = oth;
+                       WRITESPECTATABLE_MSG_ONE_VARNAME(dummy3, {
+                               WriteByte(MSG_ONE, SVC_TEMPENTITY);
+                               WriteByte(MSG_ONE, TE_CSQC_RACE);
+                               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT);
+                               WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
+                               if(e == oth)
+                               {
+                                       WriteInt24_t(MSG_ONE, 0);
+                                       WriteByte(MSG_ONE, 0);
+                                       WriteString(MSG_ONE, "");
+                               }
+                               else
+                               {
+                                       WriteInt24_t(MSG_ONE, TIME_ENCODE(time - othtime));
+                                       WriteByte(MSG_ONE, lother - lself);
+                                       WriteString(MSG_ONE, e.netname); // record holder
+                               }
+                       });
+               }
        }
 }
 
@@ -481,6 +496,9 @@ void race_ClearTime(entity e)
        e.race_penalty_accumulator = 0;
        e.race_lastpenalty = world;
 
+       if(!IS_REAL_CLIENT(e))
+               return;
+
        msg_entity = e;
        WRITESPECTATABLE_MSG_ONE({
                WriteByte(MSG_ONE, SVC_TEMPENTITY);
@@ -1046,26 +1064,32 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason)
        if(g_race_qualifying)
        {
                pl.race_penalty_accumulator += penalty;
-               msg_entity = pl;
-               WRITESPECTATABLE_MSG_ONE({
-                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_RACE);
-                       WriteByte(MSG_ONE, RACE_NET_PENALTY_QUALIFYING);
-                       WriteShort(MSG_ONE, TIME_ENCODE(penalty));
-                       WriteString(MSG_ONE, reason);
-               });
+               if(IS_REAL_CLIENT(pl))
+               {
+                       msg_entity = pl;
+                       WRITESPECTATABLE_MSG_ONE({
+                               WriteByte(MSG_ONE, SVC_TEMPENTITY);
+                               WriteByte(MSG_ONE, TE_CSQC_RACE);
+                               WriteByte(MSG_ONE, RACE_NET_PENALTY_QUALIFYING);
+                               WriteShort(MSG_ONE, TIME_ENCODE(penalty));
+                               WriteString(MSG_ONE, reason);
+                       });
+               }
        }
        else
        {
                pl.race_penalty = time + penalty;
-               msg_entity = pl;
-               WRITESPECTATABLE_MSG_ONE_VARNAME(dummy, {
-                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_RACE);
-                       WriteByte(MSG_ONE, RACE_NET_PENALTY_RACE);
-                       WriteShort(MSG_ONE, TIME_ENCODE(penalty));
-                       WriteString(MSG_ONE, reason);
-               });
+               if(IS_REAL_CLIENT(pl))
+               {
+                       msg_entity = pl;
+                       WRITESPECTATABLE_MSG_ONE_VARNAME(dummy, {
+                               WriteByte(MSG_ONE, SVC_TEMPENTITY);
+                               WriteByte(MSG_ONE, TE_CSQC_RACE);
+                               WriteByte(MSG_ONE, RACE_NET_PENALTY_RACE);
+                               WriteShort(MSG_ONE, TIME_ENCODE(penalty));
+                               WriteString(MSG_ONE, reason);
+                       });
+               }
        }
 }