X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fbot.qc;h=ed9070f9cdd60821538da821afdceab6a2405cab;hp=9c84a6b67d3b74f2e3a1a2ae9aec07559b8c4742;hb=c1389c740a4a144e46543e51296ad90ade3c365b;hpb=429e52163f53e75b848135f076b77c4eb43935ac;ds=inline diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 9c84a6b67..ed9070f9c 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -340,9 +340,8 @@ void bot_custom_weapon_priority_setup() void bot_endgame() { - entity e; - //dprint("bot_endgame\n"); - e = bot_list; + bot_relinkplayerlist(); + entity e = bot_list; while (e) { setcolor(e, e.bot_preferredcolors); @@ -399,7 +398,7 @@ void bot_clientdisconnect(entity this) this.playerskin_freeme = string_null; if(this.bot_cmd_current) delete(this.bot_cmd_current); - if(bot_waypoint_queue_owner==this) + if(bot_waypoint_queue_owner == this) bot_waypoint_queue_owner = NULL; } @@ -632,6 +631,39 @@ float bot_fixcount() return true; } +void bot_remove_from_bot_list(entity this) +{ + entity e = bot_list; + entity prev_bot = NULL; + while (e) + { + if(e == this) + { + if(!prev_bot) + bot_list = this.nextbot; + else + prev_bot.nextbot = this.nextbot; + if(bot_strategytoken == this) + { + bot_strategytoken = this.nextbot; + bot_strategytoken_taken = true; + } + this.nextbot = NULL; + break; + } + prev_bot = e; + e = e.nextbot; + } +} + +void bot_clear(entity this) +{ + bot_remove_from_bot_list(this); + if(bot_waypoint_queue_owner == this) + bot_waypoint_queue_owner = NULL; + this.aistatus &= ~AI_STATUS_STUCK; // otherwise bot_waypoint_queue_owner will be set again to this by navigation_unstuck +} + void bot_serverframe() { if (gameover)