From: Mario Date: Thu, 24 Dec 2015 02:50:20 +0000 (+1000) Subject: Even more loops X-Git-Tag: xonotic-v0.8.2~1413 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c79bf0a725d8b1c024fd914455c7256f7c64df79;p=xonotic%2Fxonotic-data.pk3dir.git Even more loops --- diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 671014b80..fd9fe0a5d 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -507,17 +507,15 @@ void autoskill(float factor) { float bestbot; float bestplayer; - entity head; bestbot = -1; bestplayer = -1; - FOR_EACH_PLAYER(head) - { - if(IS_REAL_CLIENT(head)) - bestplayer = max(bestplayer, head.totalfrags - head.totalfrags_lastcheck); + FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + if(IS_REAL_CLIENT(it)) + bestplayer = max(bestplayer, it.totalfrags - it.totalfrags_lastcheck); else - bestbot = max(bestbot, head.totalfrags - head.totalfrags_lastcheck); - } + bestbot = max(bestbot, it.totalfrags - it.totalfrags_lastcheck); + )); LOG_TRACE("autoskill: best player got ", ftos(bestplayer), ", "); LOG_TRACE("best bot got ", ftos(bestbot), "; "); @@ -551,8 +549,7 @@ void autoskill(float factor) // don't reset counters, wait for them to accumulate } - FOR_EACH_PLAYER(head) - head.totalfrags_lastcheck = head.totalfrags; + FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.totalfrags_lastcheck = it.totalfrags)); } void bot_calculate_stepheightvec() @@ -571,13 +568,11 @@ float bot_fixcount() activerealplayers = bot_activerealplayers; realplayers = bot_realplayers; } else { - entity head; - FOR_EACH_REALCLIENT(head) - { - if(IS_PLAYER(head)) + FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA( + if(IS_PLAYER(it)) ++activerealplayers; ++realplayers; - } + )); } int bots;