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");
{
bot.bot_cmdqueuebuf = buf_create();
bot.bot_cmdqueuebuf_allocated = TRUE;
+ bot.bot_cmdqueuebuf_start = 0;
+ bot.bot_cmdqueuebuf_end = 0;
}
bufstr_set(bot.bot_cmdqueuebuf, bot.bot_cmdqueuebuf_end, cmdstring);
{
parm = substring(cmdstr, sp + 1, -1);
cmdstr = substring(cmdstr, 0, sp);
+ if(cmdstr == "sound")
+ precache_sound(cmdstr);
}
- if(cmdstr == "sound")
- precache_sound(cmdstr);
}
bot.bot_cmdqueuebuf_end += 1;
entity find_bot_by_number(float number)
{
entity bot;
- float c;
+ float c = 0;
if(!number)
return world;
FOR_EACH_CLIENT(cl) if(cl.isbot)
{
- if(cl.bot_cmdqueuebuf_allocated)
- bot_clearqueue(cl);
+ cl.bot_cmd_execution_index = 0;
+ bot_clearqueue(cl);
// also, cancel all barriers
cl.bot_barrier = 0;
for(i = 0; i < cl.bot_places_count; ++i)