From 9cf8f81c7b6ef48b1711e4d3858c1d3129bf1f7c Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 22 Aug 2015 14:06:23 +0200 Subject: [PATCH] Optimize code --- qcsrc/server/bot/havocbot/havocbot.qc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 7b7c64743..303601275 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -910,6 +910,7 @@ void havocbot_chooseenemy() bool scan_transparent = false; bool scan_secondary_targets = false; + bool have_secondary_targets = false; while(true) { scan_secondary_targets = false; @@ -918,7 +919,10 @@ void havocbot_chooseenemy() if(!scan_secondary_targets) { if(head.classname == "misc_breakablemodel") + { + have_secondary_targets = true; continue; + } } else { @@ -940,9 +944,10 @@ void havocbot_chooseenemy() } } - if(!best && !scan_secondary_targets) + if(!best && have_secondary_targets && !scan_secondary_targets) { scan_secondary_targets = true; + // restart the loop head = head2; bestrating = 100000000; } -- 2.39.2