X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fspawnpoints.qc;h=bdb9cdab787a8c4f19f26ff222930b5368bbbdc8;hb=af376cc21c7130e4d62257778b6f08fb03056120;hp=f4dfe0432022927095c423f578b4599e58bfe27d;hpb=29fae4d9d59e5ec8afbdd6ef0ebcc5dcdc1bfa3f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index f4dfe0432..bdb9cdab7 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -4,6 +4,7 @@ #include "g_world.qh" #include "race.qh" #include "../common/constants.qh" +#include #include "../common/teams.qh" #include "../common/triggers/subs.qh" #include "../common/util.qh" @@ -63,7 +64,7 @@ void spawnpoint_use(entity this, entity actor, entity trigger) if(have_team_spawns > 0) { this.team = actor.team; - some_spawn_has_been_used = 1; + some_spawn_has_been_used = true; } //LOG_INFO("spawnpoint was used!\n"); } @@ -105,13 +106,14 @@ void relocate_spawnpoint(entity this) setthink(this, spawnpoint_think); this.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second this.team_saved = this.team; + IL_PUSH(g_saved_team, this); if (!this.cnt) this.cnt = 1; if (have_team_spawns != 0) if (this.team) have_team_spawns = 1; - have_team_spawns_forteam[this.team] = 1; + have_team_spawns_forteams |= BIT(this.team); if (autocvar_r_showbboxes) { @@ -317,7 +319,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp RandomSelection_Init(); for(spot = firstspot; spot; spot = spot.chain) - RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); + RandomSelection_AddEnt(spot, (bound(lower, spot.spawnpoint_score.y, upper) ** exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); return RandomSelection_chosen_ent; } @@ -334,7 +336,7 @@ entity SelectSpawnPoint(entity this, bool anypoint) float teamcheck; entity spot, firstspot; - spot = find (NULL, classname, "testplayerstart"); + spot = find(NULL, classname, "testplayerstart"); if (spot) return spot; @@ -342,11 +344,11 @@ entity SelectSpawnPoint(entity this, bool anypoint) teamcheck = -1; else if(have_team_spawns > 0) { - if(have_team_spawns_forteam[this.team] == 0) + if(!(have_team_spawns_forteams & BIT(this.team))) { // we request a spawn for a team, and we have team // spawns, but that team has no spawns? - if(have_team_spawns_forteam[0]) + if(have_team_spawns_forteams & BIT(0)) // try noteam spawns teamcheck = 0; else @@ -356,7 +358,7 @@ entity SelectSpawnPoint(entity this, bool anypoint) else teamcheck = this.team; // MUST be team } - else if(have_team_spawns == 0 && have_team_spawns_forteam[0]) + else if(have_team_spawns == 0 && (have_team_spawns_forteams & BIT(0))) teamcheck = 0; // MUST be noteam else teamcheck = -1;