From 0adf64a82f9a373271bebca82d4db9e233173ae7 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 5 Jan 2019 08:58:21 +0100 Subject: [PATCH] Cleaned up func_buyzones' Game_CreateBuyZones to not use findchain. --- Source/Server/func_buyzone.cpp | 40 ++++++++------------------- Source/Server/func_hostage_rescue.cpp | 3 +- Source/Server/info_hostage_rescue.cpp | 4 --- 3 files changed, 14 insertions(+), 33 deletions(-) diff --git a/Source/Server/func_buyzone.cpp b/Source/Server/func_buyzone.cpp index 59e280df..21c4d91a 100755 --- a/Source/Server/func_buyzone.cpp +++ b/Source/Server/func_buyzone.cpp @@ -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; } } diff --git a/Source/Server/func_hostage_rescue.cpp b/Source/Server/func_hostage_rescue.cpp index c9719237..0d01f575 100644 --- a/Source/Server/func_hostage_rescue.cpp +++ b/Source/Server/func_hostage_rescue.cpp @@ -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; } diff --git a/Source/Server/info_hostage_rescue.cpp b/Source/Server/info_hostage_rescue.cpp index 73d98bee..50d7757d 100644 --- a/Source/Server/info_hostage_rescue.cpp +++ b/Source/Server/info_hostage_rescue.cpp @@ -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)); }