Cleaned up func_buyzones' Game_CreateBuyZones to not use findchain.

This commit is contained in:
Marco Cawthorne 2019-01-05 08:58:21 +01:00
parent 3f3438cc1c
commit 0adf64a82f
3 changed files with 14 additions and 33 deletions

View file

@ -77,41 +77,25 @@ Called by StartFrame if we somehow got no buy zones
=================
*/
void Game_CreateBuyZones( void ) {
entity eFind;
entity eOld;
entity a;
if ( autocvar_fcs_knifeonly == TRUE ) {
return;
}
if ( iBuyRestriction == BUY_T || iBuyRestriction == BUY_BOTH ) {
eFind = findchain( classname, "info_player_deathmatch" );
eOld = self;
while ( eFind ) {
entity eBuyZoneT = spawn();
setorigin( eBuyZoneT, eFind.origin );
self = eBuyZoneT;
spawnfunc_func_buyzone();
self.team = TEAM_T;
eFind = eFind.chain;
for (a = world; (a = find(a, classname, "info_player_deathmatch"));) {
func_buyzone zone = spawn(func_buyzone);
setorigin(zone, a.origin);
zone.team = TEAM_T;
}
self = eOld;
}
if ( iBuyRestriction == BUY_CT || iBuyRestriction == BUY_BOTH ) {
eFind = findchain( classname, "info_player_start" );
eOld = self;
while ( eFind ) {
entity eBuyZoneCT = spawn();
setorigin( eBuyZoneCT, eFind.origin );
self = eBuyZoneCT;
spawnfunc_func_buyzone();
self.team = TEAM_CT;
eFind = eFind.chain;
for (a = world; (a = find(a, classname, "info_player_start"));) {
func_buyzone zone = spawn(func_buyzone);
setorigin(zone, a.origin);
zone.team = TEAM_CT;
}
self = eOld;
}
}

View file

@ -14,11 +14,12 @@ class func_hostage_rescue
void func_hostage_rescue::touch(void)
{
if ((other.classname == "player" ) && ( other.team == TEAM_CT )) {
if ((other.classname == "player" ) && (other.team == TEAM_CT)) {
/* This will be cleared every frame inside SV_RunClientCommand */
other.fInHostageZone = TRUE;
} else if (other.classname == "hostage_entity") {
hostage_entity hosty = (hostage_entity)other;
if (solid == SOLID_NOT) {
return;
}

View file

@ -21,13 +21,9 @@ Called by StartFrame if we somehow got no rescue zones
void Game_CreateRescueZones(void)
{
entity a;
int count = 0;
for (a = world; (a = find(a, classname, "info_player_start"));) {
func_hostage_rescue zone = spawn(func_hostage_rescue);
setorigin(zone, a.origin);
count++;
}
print(sprintf("Game: Created %i func_hostage_rescue\n", count));
}