Fix up waypoing queues.

Now that List is gone, have to use Array.
This commit is contained in:
Bill Currie 2011-06-15 17:20:15 +09:00
parent a7ff8332c5
commit 029ca87f8c
3 changed files with 6 additions and 7 deletions

View file

@ -43,7 +43,6 @@ this notice in its entirety.
*/ */
#include <Array.h> #include <Array.h>
#include <List.h>
#include "libfrikbot.h" #include "libfrikbot.h"
#include "editor.h" #include "editor.h"

View file

@ -45,7 +45,6 @@ this notice in its entirety.
#include "libfrikbot.h" #include "libfrikbot.h"
#include "Array.h" #include "Array.h"
#include "hash.h" #include "hash.h"
#include "List.h"
@static hashtab_t target_tab; @static hashtab_t target_tab;

View file

@ -44,7 +44,6 @@ this notice in its entirety.
#include "libfrikbot.h" #include "libfrikbot.h"
#include "Array.h" #include "Array.h"
#include "List.h"
#include "qfile.h" #include "qfile.h"
#include "qfs.h" #include "qfs.h"
#include "string.h" #include "string.h"
@ -52,13 +51,13 @@ this notice in its entirety.
Array *waypoint_array; Array *waypoint_array;
@static entity waypoint_thinker; @static entity waypoint_thinker;
@static List *waypoint_queue; @static Array *waypoint_queue;
@static void () waypoint_init = @static void () waypoint_init =
{ {
waypoint_array = [[Array alloc] init]; waypoint_array = [[Array alloc] init];
if (!waypoint_queue) if (!waypoint_queue)
waypoint_queue = [[List alloc] init]; waypoint_queue = [[Array alloc] init];
if (!waypoint_thinker) { if (!waypoint_thinker) {
waypoint_thinker = spawn (); waypoint_thinker = spawn ();
waypoint_thinker.classname = "waypoint_thinker"; waypoint_thinker.classname = "waypoint_thinker";
@ -552,18 +551,20 @@ tripping the runaway loop counter
direct_route = FALSE; 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 id obj = waypoint_thinker.@this;
local IMP imp = [obj methodForSelector: @selector (waypointThink)]; local IMP imp = [obj methodForSelector: @selector (waypointThink)];
waypoint_thinker.think = (void ()()) imp; waypoint_thinker.think = (void ()()) imp;
waypoint_thinker.nextthink = time; waypoint_thinker.nextthink = time;
[waypoint_queue removeLastObject];
} }
} }
-(id)queueForThink -(id)queueForThink
{ {
if (waypoint_thinker.@this) { if (waypoint_thinker.@this) {
[waypoint_queue addItemAtTail: self]; [waypoint_queue addObject: self];
} else { } else {
local IMP imp = [self methodForSelector: @selector (waypointThink)]; local IMP imp = [self methodForSelector: @selector (waypointThink)];
waypoint_thinker.think = (void ()()) imp; waypoint_thinker.think = (void ()()) imp;