From: Mario Date: Sun, 9 Mar 2014 21:04:17 +0000 (+1100) Subject: Fix sending race scores to bots & player names not showing in CTS X-Git-Tag: xonotic-v0.8.0~164^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4e958c53e676791062a0533835535e46c7b725ae;p=xonotic%2Fxonotic-data.pk3dir.git Fix sending race scores to bots & player names not showing in CTS --- diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 413eaaf54..5deba45c4 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -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; diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 0dbe7d118..8cc7d322c 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -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); + }); + } } }