From 40b2cb66e146583c97fdd6f513d21e5fd85dc381 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 17 Jun 2017 16:17:27 +0200 Subject: [PATCH] Turn another array of bools into an int --- qcsrc/server/defs.qh | 6 +++--- qcsrc/server/spawnpoints.qc | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 11b915027..ca7430de3 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -220,9 +220,9 @@ float TemporaryDB; .float team_saved; -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_team_spawns_forteam[17]; // 0 = this team has no spawns, 1 = this team has spawns; team 0 is the "no-team" +bool some_spawn_has_been_used; +int have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found +int have_team_spawns_forteams; // if Xth bit is 1 then team X has spawns else it has no spawns; team 0 is the "no-team" // set when showing a kill countdown .entity killindicator; diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 3d62c149c..bdb9cdab7 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -64,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"); } @@ -113,7 +113,7 @@ void relocate_spawnpoint(entity this) 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) { @@ -344,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 @@ -358,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; -- 2.39.2