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
*.dat
*.qfo
*.o
*.sym
.deps
ChangeLog

View file

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

View file

@ -112,16 +112,19 @@ Sets bot's name and colors
{
local Bot ty;
ty = [bot_array removeItemAt:0];
if (ty)
[ty disconnect];
if ([bot_array count]) {
ty = [bot_array objectAtIndex:0];
[bot_array removeObjectAtIndex:0];
if (ty)
[ty disconnect];
}
}
-(void)add
{
if (!bot_array)
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 "cmd.h"
#include "editor.h"
@ -478,7 +480,7 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
bot_count--;
SV_FreeClient (ent);
[bot_array removeItem:self];
[bot_array removeObject:self];
}
-(void)frame
@ -501,12 +503,12 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
// FIXME: do teams properly
}
-(integer)ishuman
- (integer) ishuman
{
return ishuman;
}
-(void)releaseEditor
- (void) releaseEditor
{
if (editor)
[EditorState close_menu];

View file

@ -42,9 +42,11 @@ this notice in its entirety.
*/
#include <Array.h>
#include <List.h>
#include "libfrikbot.h"
#include "Array.h"
#include "List.h"
#include "editor.h"
integer bot_way_linker;
@ -54,7 +56,7 @@ integer bot_way_linker;
{
if (current_way == what)
current_way = NIL;
[waypoint_array removeItem:what];
[waypoint_array removeObject:what];
[what release];
}
@ -113,7 +115,7 @@ an object.
best = NIL;
count = [waypoint_array count];
for (i = 0; i < count; i++) {
t = [waypoint_array getItemAt:i];
t = [waypoint_array objectAtIndex:i];
tdst = vlen(t.origin - ent.origin);
if ((tdst < dst) && (t.bot_bits & flag)) {
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 "libfrikbot.h"
#include "string.h"
#include "PropertyList.h"
#include "qfile.h"
#include "qfs.h"
#include "editor.h"
@interface TeleportMenu: ImpulseValueMenu
@ -49,7 +51,7 @@
if ((imp = [super impulse:imp]) == 104) {
imp = 0;
if (value)
way = (Waypoint) [waypoint_array getItemAt:value - 1];
way = (Waypoint) [waypoint_array objectAtIndex:value - 1];
value = 0;
if (way)
setorigin (@self, way.origin - @self.view_ofs);
@ -697,7 +699,7 @@
{
local EditorState editor = ((Target) @self.@this).editor;
if (editor.test_bot)
[editor.test_bot getPath:[Target forEntity:@self], TRUE];
[editor.test_bot getPath:[Target forEntity:@self] :TRUE];
}
+remove_test_bot
@ -808,7 +810,7 @@
player.current_way = editor.last_way = NIL;
break;
case "delete waypoint":
[waypoint_array removeItem:editor.last_way];
[waypoint_array removeObject:editor.last_way];
if (player.current_way == editor.last_way)
player.current_way = NIL;
editor.last_way = NIL;

View file

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

View file

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

View file

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