]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
more bot fixes :)
authorRudolf Polzer <divverent@xonotic.org>
Mon, 24 Sep 2012 09:55:00 +0000 (11:55 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 24 Sep 2012 09:55:00 +0000 (11:55 +0200)
qcsrc/server/bot/bot.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/command/sv_cmd.qc

index b06d578d1813b096ea7a49e2475e3ce59dfea55c..3e1cae313ff6ecbc06c3629d699c911bb16abb42 100644 (file)
@@ -366,6 +366,7 @@ void bot_clientdisconnect()
 {
        if (clienttype(self) != CLIENTTYPE_BOT)
                return;
+       bot_clearqueue(self);
        if(self.cleanname)
                strunzone(self.cleanname);
        if(self.netname_freeme)
index ef7170563af8fcc9c6c0fb484103120f5b8f6ad2..a1c00d0409183fb32e5cea864b7ff3764a5d9c94 100644 (file)
@@ -6,7 +6,7 @@
 void bot_clearqueue(entity bot)
 {
        if(!bot.bot_cmdqueuebuf_allocated)
-               error("clearqueue but no queue allocated");
+               return;
        buf_del(bot.bot_cmdqueuebuf);
        bot.bot_cmdqueuebuf_allocated = FALSE;
        dprint("bot ", bot.netname, " queue cleared\n");
@@ -1197,8 +1197,7 @@ void bot_resetqueues()
        FOR_EACH_CLIENT(cl) if(cl.isbot)
        {
                cl.bot_cmd_execution_index = 0;
-               if(cl.bot_cmdqueuebuf_allocated)
-                       bot_clearqueue(cl);
+               bot_clearqueue(cl);
                // also, cancel all barriers
                cl.bot_barrier = 0;
                for(i = 0; i < cl.bot_places_count; ++i)
index 269b69fc873b98a0993c8ec79a56a996a4f4cf74..b2bf9d9b97aa6bb2a9b92433299234c351f01b28 100644 (file)
@@ -329,6 +329,17 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                bot_resetqueues();
                                return;
                        }
+                       else if(argv(1) == "setbots")
+                       {
+                               cvar_settemp("bot_vs_human", "0");
+                               cvar_settemp("minplayers", "0");
+                               cvar_settemp("bot_number", "0");
+                               bot_fixcount();
+                               cvar_settemp("bot_number", argv(2));
+                               if(!bot_fixcount())
+                                       print("Sorry, could not set requested bot count\n");
+                               return;
+                       }
                        else if(argv(1) == "load" && argc == 3)
                        {
                                float fh, i;
@@ -353,7 +364,10 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                                }
                                                else if(argv(2) == "setbots")
                                                {
+                                                       cvar_settemp("bot_vs_human", "0");
                                                        cvar_settemp("minplayers", "0");
+                                                       cvar_settemp("bot_number", "0");
+                                                       bot_fixcount();
                                                        cvar_settemp("bot_number", argv(3));
                                                        if(!bot_fixcount())
                                                                print("Sorry, could not set requested bot count\n");