From 381253469697897648d7e3ab1eef259c972d9fe2 Mon Sep 17 00:00:00 2001 From: mand1nga Date: Mon, 27 Jul 2009 16:04:06 +0000 Subject: [PATCH] Fixed a bug that was making bots stop executing commands if an inexistent command was given git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7276 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/bots_scripting.qc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/qcsrc/server/bots_scripting.qc b/data/qcsrc/server/bots_scripting.qc index c542e1df3..3c211f321 100755 --- a/data/qcsrc/server/bots_scripting.qc +++ b/data/qcsrc/server/bots_scripting.qc @@ -1063,11 +1063,10 @@ void bot_setcurrentcommand() self.bot_cmd_current = spawn(); self.bot_cmd_current.classname = "bot_cmd"; self.bot_cmd_current.is_bot_cmd = 1; - self.bot_cmd_current.bot_cmd_index = 1; } bot_cmd = self.bot_cmd_current; - if(bot_cmd.bot_cmd_index != self.bot_cmd_execution_index) + if(bot_cmd.bot_cmd_index != self.bot_cmd_execution_index || self.bot_cmd_execution_index == 0) { if(bot_havecommand(self, self.bot_cmd_execution_index)) { @@ -1079,7 +1078,12 @@ void bot_setcurrentcommand() bot_cmd.bot_cmd_index = self.bot_cmd_execution_index; } else + { + // Invalid command, remove from queue bot_cmd = world; + bot_dequeuecommand(self, self.bot_cmd_execution_index); + self.bot_cmd_execution_index++; + } } else bot_cmd = world; -- 2.39.2