Get fbxa compiling with -Wall

This commit is contained in:
Bill Currie 2010-12-16 21:24:53 +09:00
parent c7072560e8
commit a8fab74a2c
9 changed files with 45 additions and 30 deletions

1
fbxa/.gitignore vendored
View file

@ -1,6 +1,7 @@
*.a *.a
*.dat *.dat
*.qfo *.qfo
*.o
*.sym *.sym
.deps .deps
ChangeLog ChangeLog

View file

@ -1,6 +1,6 @@
QFCC=qfcc QFCC=qfcc
#QCFLAGS=-z -qq -g -Werror #QCFLAGS=-z -qq -g -Werror
QCFLAGS=-qq -g -Werror QCFLAGS=-qq -g -Werror -Wall
QCPPFLAGS= QCPPFLAGS=
libdir=$(shell pkg-config qfcc --variable=libdir) libdir=$(shell pkg-config qfcc --variable=libdir)
includedir=$(shell pkg-config qfcc --variable=includedir) includedir=$(shell pkg-config qfcc --variable=includedir)

View file

@ -112,16 +112,19 @@ Sets bot's name and colors
{ {
local Bot ty; local Bot ty;
ty = [bot_array removeItemAt:0]; if ([bot_array count]) {
ty = [bot_array objectAtIndex:0];
[bot_array removeObjectAtIndex:0];
if (ty) if (ty)
[ty disconnect]; [ty disconnect];
}
} }
-(void)add -(void)add
{ {
if (!bot_array) if (!bot_array)
bot_array = [[Array alloc] init]; bot_array = [[Array alloc] init];
[bot_array addItem: self]; [bot_array addObject: self];
} }
/* /*

View file

@ -71,6 +71,8 @@ ClientDisconnected(); // FrikBot
-------------------------------------- --------------------------------------
*/ */
#include <Array.h>
#include "libfrikbot.h" #include "libfrikbot.h"
#include "cmd.h" #include "cmd.h"
#include "editor.h" #include "editor.h"
@ -478,7 +480,7 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
bot_count--; bot_count--;
SV_FreeClient (ent); SV_FreeClient (ent);
[bot_array removeItem:self]; [bot_array removeObject:self];
} }
-(void)frame -(void)frame
@ -501,12 +503,12 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
// FIXME: do teams properly // FIXME: do teams properly
} }
-(integer)ishuman - (integer) ishuman
{ {
return ishuman; return ishuman;
} }
-(void)releaseEditor - (void) releaseEditor
{ {
if (editor) if (editor)
[EditorState close_menu]; [EditorState close_menu];

View file

@ -42,9 +42,11 @@ this notice in its entirety.
*/ */
#include <Array.h>
#include <List.h>
#include "libfrikbot.h" #include "libfrikbot.h"
#include "Array.h" #include "editor.h"
#include "List.h"
integer bot_way_linker; integer bot_way_linker;
@ -54,7 +56,7 @@ integer bot_way_linker;
{ {
if (current_way == what) if (current_way == what)
current_way = NIL; current_way = NIL;
[waypoint_array removeItem:what]; [waypoint_array removeObject:what];
[what release]; [what release];
} }
@ -113,7 +115,7 @@ an object.
best = NIL; best = NIL;
count = [waypoint_array count]; count = [waypoint_array count];
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
t = [waypoint_array getItemAt:i]; t = [waypoint_array objectAtIndex:i];
tdst = vlen(t.origin - ent.origin); tdst = vlen(t.origin - ent.origin);
if ((tdst < dst) && (t.bot_bits & flag)) { if ((tdst < dst) && (t.bot_bits & flag)) {
if ((lastone == NIL) || ([lastone isLinkedTo:t])) { if ((lastone == NIL) || ([lastone isLinkedTo:t])) {

View file

@ -1,9 +1,11 @@
#include <string.h>
#include <PropertyList.h>
#include <qfile.h>
#include <qfs.h>
#include <Array.h>
#include "impulse_menu.h" #include "impulse_menu.h"
#include "libfrikbot.h" #include "libfrikbot.h"
#include "string.h"
#include "PropertyList.h"
#include "qfile.h"
#include "qfs.h"
#include "editor.h" #include "editor.h"
@interface TeleportMenu: ImpulseValueMenu @interface TeleportMenu: ImpulseValueMenu
@ -49,7 +51,7 @@
if ((imp = [super impulse:imp]) == 104) { if ((imp = [super impulse:imp]) == 104) {
imp = 0; imp = 0;
if (value) if (value)
way = (Waypoint) [waypoint_array getItemAt:value - 1]; way = (Waypoint) [waypoint_array objectAtIndex:value - 1];
value = 0; value = 0;
if (way) if (way)
setorigin (@self, way.origin - @self.view_ofs); setorigin (@self, way.origin - @self.view_ofs);
@ -697,7 +699,7 @@
{ {
local EditorState editor = ((Target) @self.@this).editor; local EditorState editor = ((Target) @self.@this).editor;
if (editor.test_bot) if (editor.test_bot)
[editor.test_bot getPath:[Target forEntity:@self], TRUE]; [editor.test_bot getPath:[Target forEntity:@self] :TRUE];
} }
+remove_test_bot +remove_test_bot
@ -808,7 +810,7 @@
player.current_way = editor.last_way = NIL; player.current_way = editor.last_way = NIL;
break; break;
case "delete waypoint": case "delete waypoint":
[waypoint_array removeItem:editor.last_way]; [waypoint_array removeObject:editor.last_way];
if (player.current_way == editor.last_way) if (player.current_way == editor.last_way)
player.current_way = NIL; player.current_way = NIL;
editor.last_way = NIL; editor.last_way = NIL;

View file

@ -51,6 +51,7 @@ typedef struct bot_data_t bot_data_t;
Waypoint chain; Waypoint chain;
} }
+(void)loadFile:(string)path;
+(void)clearAll; +(void)clearAll;
+(Waypoint)waypointForNum:(integer)num; +(Waypoint)waypointForNum:(integer)num;
+(void)fixWaypoints; +(void)fixWaypoints;
@ -139,6 +140,7 @@ typedef struct bot_data_t bot_data_t;
- (void) disconnect; - (void) disconnect;
- (void) updateClient; - (void) updateClient;
- (void) releaseEditor;
@end @end
@interface Bot (Misc) @interface Bot (Misc)

View file

@ -222,7 +222,7 @@ Finds the closest, fisible, waypoint to e
} }
count = [waypoint_array count]; count = [waypoint_array count];
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
t = [waypoint_array getItemAt:i]; t = [waypoint_array objectAtIndex:i];
// real players cut through ignore types // real players cut through ignore types
if (dst < 20) if (dst < 20)
return best; return best;

View file

@ -69,7 +69,10 @@ Array waypoint_array;
-(integer)id -(integer)id
{ {
return [waypoint_array findItem:self] + 1; integer index = [waypoint_array indexOfObject:self];
if (index != NotFound)
return index + 1;
return 0;
} }
-(id)init -(id)init
@ -82,7 +85,7 @@ Array waypoint_array;
-(id)initAt:(vector)org -(id)initAt:(vector)org
{ {
[self init]; [self init];
[waypoint_array addItem: self]; [waypoint_array addObject: self];
[self release]; [self release];
origin = org; origin = org;
search_time = time; search_time = time;
@ -230,7 +233,7 @@ Waypoint Loading from file
} }
plist_data = Qreadstring (file, Qfilesize (file)); plist_data = Qreadstring (file, Qfilesize (file));
Qclose (file); Qclose (file);
plist = [PLItem newFromString:plist_data]; plist = [PLItem fromString:plist_data];
str_free (plist_data); str_free (plist_data);
[Waypoint clearAll]; [Waypoint clearAll];
@ -238,10 +241,10 @@ Waypoint Loading from file
count = [(PLArray)plist numObjects]; count = [(PLArray)plist numObjects];
dprint (sprintf ("%i waypoints\n", count)); dprint (sprintf ("%i waypoints\n", count));
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
local PLItem way = [plist getObjectAtIndex:i]; local PLDictionary way = (PLDictionary) [(PLArray) plist getObjectAtIndex:i];
local PLString s = (PLString) [way getObjectForKey:"origin"]; local PLString s = (PLString) [way getObjectForKey:"origin"];
local vector org = stov (sprintf ("'%s'", [s string])); local vector org = stov (sprintf ("'%s'", [s string]));
local PLItem links = [way getObjectForKey:"link"]; local PLArray links = (PLArray) [way getObjectForKey:"link"];
//FIXME compiler/vm "bug" makes passing pointers to locals dangerous //FIXME compiler/vm "bug" makes passing pointers to locals dangerous
s = (PLString) [way getObjectForKey:"flags"]; s = (PLString) [way getObjectForKey:"flags"];
@ -274,7 +277,7 @@ Waypoint Loading from file
{ {
if (!num) if (!num)
return NIL; return NIL;
return [waypoint_array getItemAt:num - 1]; return [waypoint_array objectAtIndex:num - 1];
} }
-(void)fix -(void)fix
@ -325,8 +328,8 @@ Waypoint Loading from file
-(void)plitem:(PLItem)list -(void)plitem:(PLItem)list
{ {
local PLItem way = [PLItem newDictionary]; local PLDictionary way = (PLDictionary) [PLItem newDictionary];
local PLItem l = [PLItem newArray]; local PLArray l = (PLArray) [PLItem newArray];
local integer i; local integer i;
[way addKey:"origin" value:[PLItem newString:sprintf ("%g %g %g", [way addKey:"origin" value:[PLItem newString:sprintf ("%g %g %g",
@ -341,7 +344,7 @@ Waypoint Loading from file
} }
[way addKey:"link" value:l]; [way addKey:"link" value:l];
[way addKey:"flags" value:[PLItem newString:itos (flags)]]; [way addKey:"flags" value:[PLItem newString:itos (flags)]];
[list addObject:way]; [(PLArray) list addObject:way];
} }
+(PLItem) plist +(PLItem) plist
@ -386,7 +389,7 @@ Waypoint Loading from file
count = [waypoint_array count]; count = [waypoint_array count];
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
w = [waypoint_array getItemAt:i]; w = [waypoint_array objectAtIndex:i];
dif = w.origin - org; dif = w.origin - org;
dist = dif * dif; // dist squared, really dist = dif * dif; // dist squared, really
if (dist < rad) { if (dist < rad) {