From: Mario Date: Thu, 24 Dec 2015 02:53:13 +0000 (+1000) Subject: Loops X-Git-Tag: xonotic-v0.8.2~1412 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4d33f4a27b31e4ca38ac9e2067c83f53e2f2b6a1;p=xonotic%2Fxonotic-data.pk3dir.git Loops --- diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index fd9fe0a5d..8d21757c2 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -132,7 +132,6 @@ void bot_setnameandstuff() {SELFPARAM(); string readfile, s; float file, tokens, prio; - entity p; string bot_name, bot_model, bot_skin, bot_shirt, bot_pants; string name, prefix, suffix; @@ -169,15 +168,13 @@ void bot_setnameandstuff() continue; s = argv(0); prio = 1; - FOR_EACH_CLIENT(p) - { - if(IS_BOT_CLIENT(p)) - if(s == p.cleanname) + FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA( + if(s == it.cleanname) { prio = 0; break; } - } + )); RandomSelection_Add(world, 0, readfile, 1, prio); } readfile = RandomSelection_chosen_string; @@ -237,16 +234,13 @@ void bot_setnameandstuff() name = bot_name; // number bots with identical names - float i; - i = 0; - FOR_EACH_CLIENT(p) - { - if(IS_BOT_CLIENT(p)) - if(p.cleanname == name) - ++i; - } - if (i) - self.netname = self.netname_freeme = strzone(strcat(prefix, name, "(", ftos(i), ")", suffix)); + int j = 0; + FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA( + if(it.cleanname == name) + ++j; + )); + if (j) + self.netname = self.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix)); else self.netname = self.netname_freeme = strzone(strcat(prefix, name, suffix));