From: Rudolf Polzer Date: Sun, 18 Sep 2011 13:43:54 +0000 (+0200) Subject: bot_cmd sound: precache the sound when the command is queued X-Git-Tag: xonotic-v0.6.0~40^2~131 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9a7157eb97d7f8a505fcc29d92e7b36eb8d43ac;p=xonotic%2Fxonotic-data.pk3dir.git bot_cmd sound: precache the sound when the command is queued --- diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index e540a438d..485433e1d 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -21,6 +21,28 @@ void bot_queuecommand(entity bot, string cmdstring) } bufstr_set(bot.bot_cmdqueuebuf, bot.bot_cmdqueuebuf_end, cmdstring); + + // if the command was a "sound" command, precache the sound NOW + // this prevents lagging! + { + float sp; + string parm; + string cmdstring; + + sp = strstrofs(cmdstring, " ", 0); + if(sp < 0) + { + parm = ""; + } + else + { + parm = substring(cmdstring, sp + 1, -1); + cmdstring = substring(cmdstring, 0, sp); + } + if(cmdstring == "sound") + precache_sound(cmdstring); + } + bot.bot_cmdqueuebuf_end += 1; }