From 029ca87f8cba3e321671d2e1b3c4c32976fab713 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 15 Jun 2011 17:20:15 +0900 Subject: [PATCH] Fix up waypoing queues. Now that List is gone, have to use Array. --- fbxa/bot_way.qc | 1 - fbxa/target.r | 1 - fbxa/waypoint.r | 11 ++++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fbxa/bot_way.qc b/fbxa/bot_way.qc index 0a25ca0..54a49d7 100644 --- a/fbxa/bot_way.qc +++ b/fbxa/bot_way.qc @@ -43,7 +43,6 @@ this notice in its entirety. */ #include -#include #include "libfrikbot.h" #include "editor.h" diff --git a/fbxa/target.r b/fbxa/target.r index 5fcbc2e..0f2e0fc 100644 --- a/fbxa/target.r +++ b/fbxa/target.r @@ -45,7 +45,6 @@ this notice in its entirety. #include "libfrikbot.h" #include "Array.h" #include "hash.h" -#include "List.h" @static hashtab_t target_tab; diff --git a/fbxa/waypoint.r b/fbxa/waypoint.r index ea2cc5a..dac7e1d 100644 --- a/fbxa/waypoint.r +++ b/fbxa/waypoint.r @@ -44,7 +44,6 @@ this notice in its entirety. #include "libfrikbot.h" #include "Array.h" -#include "List.h" #include "qfile.h" #include "qfs.h" #include "string.h" @@ -52,13 +51,13 @@ this notice in its entirety. Array *waypoint_array; @static entity waypoint_thinker; -@static List *waypoint_queue; +@static Array *waypoint_queue; @static void () waypoint_init = { waypoint_array = [[Array alloc] init]; if (!waypoint_queue) - waypoint_queue = [[List alloc] init]; + waypoint_queue = [[Array alloc] init]; if (!waypoint_thinker) { waypoint_thinker = spawn (); waypoint_thinker.classname = "waypoint_thinker"; @@ -552,18 +551,20 @@ tripping the runaway loop counter direct_route = FALSE; } } - if ((waypoint_thinker.@this = [waypoint_queue removeItemAtHead])) { + if ([waypoint_queue count] + && (waypoint_thinker.@this = [waypoint_queue lastObject])) { local id obj = waypoint_thinker.@this; local IMP imp = [obj methodForSelector: @selector (waypointThink)]; waypoint_thinker.think = (void ()()) imp; waypoint_thinker.nextthink = time; + [waypoint_queue removeLastObject]; } } -(id)queueForThink { if (waypoint_thinker.@this) { - [waypoint_queue addItemAtTail: self]; + [waypoint_queue addObject: self]; } else { local IMP imp = [self methodForSelector: @selector (waypointThink)]; waypoint_thinker.think = (void ()()) imp;