From: Rudolf Polzer Date: Thu, 31 Mar 2011 19:59:05 +0000 (+0200) Subject: improve team spawn logic X-Git-Tag: xonotic-v0.5.0~305^2~10^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=999f7d64af64dd4e52b4fb8482faec0bad4bfc48;p=xonotic%2Fxonotic-data.pk3dir.git improve team spawn logic in a non-team match, ignore team spawns if there is at least one non-team spawn --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 1b10b6e25..a1047ea9d 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -132,9 +132,9 @@ vector Spawn_Score(entity spot, entity playerlist, float teamcheck, float anypoi prio = 0; // filter out spots for the wrong team - if(teamcheck) - if(spot.team != teamcheck) - return '-1 0 0'; + if(teamcheck >= 0) + if(spot.team != teamcheck) + return '-1 0 0'; if(race_spawns) if(spot.target == "") @@ -269,7 +269,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis spotlist = spot; /* - if(teamcheck) + if(teamcheck >= 0) if(spot.team != teamcheck) error("invalid spawn added"); @@ -283,7 +283,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis /* entity e; - if(teamcheck) + if(teamcheck >= 0) for(e = spotlist; e; e = e.chain) { print("seen ", etos(e), "\n"); @@ -325,10 +325,15 @@ entity SelectSpawnPoint (float anypoint) if (spot) return spot; - teamcheck = 0; - - if(!anypoint && have_team_spawns > 0) - teamcheck = self.team; + if(anypoint) + teamcheck = -1; + else if(have_team_spawns > 0) + teamcheck = self.team; // MUST be team + else if(have_team_spawns == 0 && have_noteam_spawns) + teamcheck = 0; // MUST be noteam + else + teamcheck = -1; + // if we get here, we either require team spawns but have none, or we require non-team spawns and have none; use any spawn then // get the list of players playerlist = findchain(classname, "player"); @@ -368,7 +373,7 @@ entity SelectSpawnPoint (float anypoint) print("spot mindistance: ", vtos(spot.spawnpoint_score), "\n"); entity e; - if(teamcheck) + if(teamcheck >= 0) for(e = firstspot; e; e = e.chain) if(e.team != teamcheck) error("invalid spawn found"); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index ff6658d29..d7179fafe 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -410,6 +410,7 @@ float TemporaryDB; float some_spawn_has_been_used; float have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found +float have_noteam_spawns; // 0 = no no-team spawns, 1 = no-team spawns exist // set when showing a kill countdown .entity killindicator; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 4cf479fa9..84dd07d94 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -236,6 +236,8 @@ void relocate_spawnpoint() if (have_team_spawns != 0) if (self.team) have_team_spawns = 1; + if (!self.team) + have_noteam_spawns = 1; if (autocvar_r_showbboxes) {