From f6a061a6b48a605ff5c11058b4b1cc2462c5f607 Mon Sep 17 00:00:00 2001 From: Morosophos Date: Mon, 12 Oct 2020 18:06:16 +0300 Subject: [PATCH] Add g_cts_cptimes_onlyself cvar (needed for XDWC) --- qcsrc/server/race.qc | 29 +++++++++++++++++++++-------- qcsrc/server/race.qh | 1 + 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index bc07efd58..047f74f61 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -215,11 +215,19 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only return; int cp = e.race_checkpoint; - float recordtime = race_checkpoint_records[cp]; - float myrecordtime = e.race_checkpoint_record[cp]; - string recordholder = race_checkpoint_recordholders[cp]; - if(recordholder == e.netname) + float myrecordtime = e.race_checkpoint_record[cp]; + float recordtime; + string recordholder; + if (autocvar_g_cts_cptimes_onlyself) { + recordtime = myrecordtime; + recordholder = ""; + } else { + recordtime = race_checkpoint_records[cp]; + + recordholder = race_checkpoint_recordholders[cp]; + if(recordholder == e.netname) recordholder = ""; + } if(!IS_REAL_CLIENT(e)) return; @@ -474,12 +482,17 @@ void race_SendTime(entity e, float cp, float t, float tvalid) if(tvalid) { - recordtime = race_checkpoint_records[cp]; - float myrecordtime = e.race_checkpoint_record[cp]; - recordholder = strcat1(race_checkpoint_recordholders[cp]); // make a tempstring copy, as we'll possibly strunzone it! - if(recordholder == e.netname) + float myrecordtime = e.race_checkpoint_record[cp]; + if (autocvar_g_cts_cptimes_onlyself) { + recordtime = myrecordtime; + recordholder = ""; + } else { + recordtime = race_checkpoint_records[cp]; + recordholder = strcat1(race_checkpoint_recordholders[cp]); // make a tempstring copy, as we'll possibly strunzone it + if(recordholder == e.netname) recordholder = ""; + } if(t != 0) { if(cp == race_timed_checkpoint) diff --git a/qcsrc/server/race.qh b/qcsrc/server/race.qh index 9dd37a89e..45a7e211e 100644 --- a/qcsrc/server/race.qh +++ b/qcsrc/server/race.qh @@ -8,6 +8,7 @@ float race_teams; const float ST_RACE_LAPS = 1; int autocvar_g_cts_send_rankings_cnt = 15; +bool autocvar_g_cts_cptimes_onlyself = false; bool g_race_qualifying; -- 2.39.2