bot_qw.qc:

make all bots "lose" a player that disconnects
waypoint.r:
	make sure all waypoint data structs get initialized
This commit is contained in:
Bill Currie 2003-09-02 06:25:03 +00:00
parent 19fef1890c
commit 8b784f2ede
2 changed files with 29 additions and 8 deletions

View file

@ -227,7 +227,21 @@ void ()
ClientDisconnected =
{
local integer cl_no = ClientNumber (@self);
local Bot p = NIL;
p = players[cl_no];
players[cl_no] = NIL;
if (p) {
local entity e = p.ent;
local integer i;
for (i = 0; i < 32; i++) {
if (!players[i])
continue;
if (players[i].ent.enemy == e)
[players[i] lost:p:0];
}
}
[p dealloc];
};
// BotConnect and related functions. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

View file

@ -50,16 +50,23 @@ Array waypoint_array;
@static entity waypoint_thinker;
@static List waypoint_queue;
@static void () waypoint_init =
{
waypoint_array = [[Array alloc] init];
if (!waypoint_queue)
waypoint_queue = [[List alloc] init];
if (!waypoint_thinker) {
waypoint_thinker = spawn ();
waypoint_thinker.classname = "waypoint_thinker";
}
};
@implementation Waypoint
-(id)init
{
if (!waypoint_array) {
waypoint_array = [[Array alloc] init];
waypoint_queue = [[List alloc] init];
waypoint_thinker = spawn ();
waypoint_thinker.classname = "waypoint_thinker";
}
if (!waypoint_array)
waypoint_init ();
return [super init];
}
@ -179,7 +186,7 @@ Waypoint Loading from file
{
if (waypoint_array)
[waypoint_array free];
waypoint_array = [[Array alloc] init];
waypoint_init ();
}
+(Waypoint)waypointForNum:(integer)num
@ -193,7 +200,7 @@ Waypoint Loading from file
{
local integer i, tmp;
for (i = 0; i < 3; i++) {
for (i = 0; i < 4; i++) {
tmp = (integer)links[i];
links[i] = [Waypoint waypointForNum:tmp];
}