]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
target_checkpoints with duplicate targetname get same cp number(order) to be tolerant...
authorDes <xon@damianv.com.ar>
Thu, 10 Oct 2024 13:44:45 +0000 (10:44 -0300)
committerDes <xon@damianv.com.ar>
Thu, 10 Oct 2024 13:44:45 +0000 (10:44 -0300)
qcsrc/server/race.qc

index 078f9e1923a7bf300adb9ec879d790e59567693d..ee68144ae7a7c5ec2a7665440dcec300e44ac0f3 100644 (file)
@@ -713,7 +713,13 @@ void checkpoint_passed(entity this, entity player)
        {
                if(this.race_checkpoint == -2)
                {
-                       this.race_checkpoint = player.race_checkpoint;
+                       // duplicate targetname target_checkpoints get the same cp nr
+                       IL_EACH(g_race_targets, it.classname == "target_checkpoint" && it.targetname == this.targetname, {
+                               if(it.race_checkpoint >= 0)
+                                       this.race_checkpoint = it.race_checkpoint;
+                       });
+                       if(this.race_checkpoint == -2)
+                               this.race_checkpoint = player.race_checkpoint;
                }
 
                int cp_amount = 0, largest_cp_id = 0;