[nexuiz-commits] r7258 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jul 25 00:28:52 EDT 2009


Author: mand1nga
Date: 2009-07-25 00:28:52 -0400 (Sat, 25 Jul 2009)
New Revision: 7258

Modified:
   trunk/data/qcsrc/server/bots_scripting.qc
Log:
Fixed a bug preventing the execution of the first command on the queue of every bot. Fixed desynchronization between the string buffer index and the (bot) cmd index/pointer when the string buffer was cleared. Sort some comments. Please test.

Modified: trunk/data/qcsrc/server/bots_scripting.qc
===================================================================
--- trunk/data/qcsrc/server/bots_scripting.qc	2009-07-25 03:07:59 UTC (rev 7257)
+++ trunk/data/qcsrc/server/bots_scripting.qc	2009-07-25 04:28:52 UTC (rev 7258)
@@ -9,7 +9,7 @@
 		error("readcommand but no queue allocated");
 	buf_del(bot.bot_cmdqueuebuf);
 	bot.bot_cmdqueuebuf_allocated = FALSE;
-	print("bot ", bot.netname, " queue cleared\n");
+	dprint("bot ", bot.netname, " queue cleared\n");
 }
 
 void bot_queuecommand(entity bot, string cmdstring)
@@ -17,8 +17,6 @@
 	if(!bot.bot_cmdqueuebuf_allocated)
 	{
 		bot.bot_cmdqueuebuf = buf_create();
-		bot.bot_cmdqueuebuf_start = 0;
-		bot.bot_cmdqueuebuf_end = 0;
 		bot.bot_cmdqueuebuf_allocated = TRUE;
 	}
 
@@ -115,7 +113,7 @@
 #define BOT_CMD_CONTINUE		2
 #define BOT_CMD_WAIT			3
 #define BOT_CMD_TURN			4
-#define BOT_CMD_MOVETO			5	// Not implemented yet
+#define BOT_CMD_MOVETO			5
 #define BOT_CMD_RESETGOAL		6	// Not implemented yet
 #define BOT_CMD_CC			7
 #define BOT_CMD_IF      		8
@@ -548,7 +546,7 @@
 	entity cl;
 
 	// 0 = no barrier, 1 = waiting, 2 = waiting finished
-	
+
 	if(self.bot_barrier == 0) // initialization
 	{
 		self.bot_barrier = 1;
@@ -1042,14 +1040,8 @@
 	return self.cmd_resetgoal();
 }
 
+//
 
-
-
-
-
-
-
-
 void bot_command_executed(float rm)
 {
 	entity cmd;
@@ -1066,15 +1058,12 @@
 {
 	bot_cmd = world;
 
-	if(self.bot_cmd_execution_index == 0)
-		self.bot_cmd_execution_index = 1;
-	
 	if(!self.bot_cmd_current)
 	{
 		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 = 0;
+		self.bot_cmd_current.bot_cmd_index = 1;
 	}
 
 	bot_cmd = self.bot_cmd_current;
@@ -1119,6 +1108,8 @@
 	bot_barriertime = time;
 }
 
+// Here we map commands to functions and deal with complex interactions between commands and execution states
+// NOTE: Of course you need to include your commands here too :)
 float bot_execute_commands_once()
 {
 	local float status, ispressingkey;
@@ -1277,8 +1268,6 @@
 }
 
 // This function should be (the only) called directly from the bot ai loop
-// It maps commands to functions and deal with complex interactions between commands and execution states
-// NOTE: Of course you need to include your commands here too :)
 float bot_execute_commands()
 {
 	float f;



More information about the nexuiz-commits mailing list