From: Rudolf Polzer Date: Mon, 24 Sep 2012 09:55:00 +0000 (+0200) Subject: more bot fixes :) X-Git-Tag: xonotic-v0.7.0~217 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=90f566a9f86ebddd3410a4127e9c04f37e410634;p=xonotic%2Fxonotic-data.pk3dir.git more bot fixes :) --- diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index b06d578d1..3e1cae313 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -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) diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index ef7170563..a1c00d040 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -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) diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 269b69fc8..b2bf9d9b9 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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");