--- Makefile.orig 2003-01-01 23:36:19.000000000 -0500 +++ Makefile 2003-01-01 23:39:32.000000000 -0500 @@ -1,8 +1,9 @@ CFLAGS=-g +LDFLAGS= PROGRAMS=combat ROBOTS=cylon tracker target -CC=g++ -g +CC=g++ all: $(PROGRAMS) $(ROBOTS) @@ -10,29 +11,29 @@ rm -f $(PROGRAMS) $(ROBOTS) *.o core combat: combat.o - $(CC) $(CFLAGS) -o $@ combat.o -lm + $(CC) -o $@ $(LDFLAGS) combat.o -lm combat.o: combat.c $(CC) $(CFLAGS) -c combat.c robots.o: robots.C robots.h - g++ -c robots.C + $(CC) $(CFLAGS) -c robots.C cylon: cylon.o robots.o - g++ -static -o $@ cylon.o robots.o + $(CC) -o $@ $(LDFLAGS) cylon.o robots.o cylon.o: cylon.c robots.h - g++ -c cylon.c + $(CC) $(CFLAGS) -c cylon.c tracker: tracker.o robots.o - g++ -static -o $@ tracker.o robots.o + $(CC) -o $@ $(LDFLAGS) tracker.o robots.o tracker.o: tracker.c robots.h - g++ -c tracker.c + $(CC) $(CFLAGS) -c tracker.c target: target.o robots.o - g++ -static -o $@ target.o robots.o + $(CC) -o $@ $(LDFLAGS) target.o robots.o target.o: target.c robots.h - g++ -c target.c + $(CC) $(CFLAGS) -c target.c --- combat.c.orig 2003-01-01 23:32:55.000000000 -0500 +++ combat.c 2003-01-01 23:34:06.000000000 -0500 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -96,7 +97,7 @@ Robot *robots=NULL; int nrobots=0; -plot(int x, int y, char c) +void plot(int x, int y, char c) { int h = int(x)*79/10000; int v = 34-int(y)*(31-nrobots)/10000; @@ -472,7 +473,7 @@ } -Between(double x1, double y1, double x2, double y2, double x0, double y0) +int Between(double x1, double y1, double x2, double y2, double x0, double y0) { double tx,ty; /* is (x0,y0) between (x1,y1) - (x2,y2)? */ --- cylon.c.orig 2003-01-01 23:32:49.000000000 -0500 +++ cylon.c 2003-01-01 23:40:13.000000000 -0500 @@ -1,6 +1,6 @@ #include "robots.h" -Distance(int x1, int y1, int x2, int y2) +int Distance(int x1, int y1, int x2, int y2) { int dx = x1-x2; int dy = y1-y2; @@ -8,7 +8,7 @@ return sqrt(dx*dx + dy*dy); } -Goto(int x, int y) +void Goto(int x, int y) { int dir = atan2(y-loc_y(),x-loc_x()); int dist = Distance(x,y,loc_x(),loc_y()); @@ -37,8 +37,9 @@ drive(dir,0); } -main() +int main() { while (1) Goto(rand(9000)+500,rand(9000)+500); + return 0; } --- robots.C.orig 2003-01-01 23:34:39.000000000 -0500 +++ robots.C 2003-01-01 23:35:18.000000000 -0500 @@ -6,6 +6,7 @@ #include #include #include +#include #include "robots.h" --- tracker.c.orig 2003-01-01 23:35:27.000000000 -0500 +++ tracker.c 2003-01-01 23:35:46.000000000 -0500 @@ -18,7 +18,7 @@ // Shoot at a target if its in range (<= 7000 units) *and* its far // enough away that we will only be slightly damaged (>200 units) by the // resulting explosion. -inline shoot(int dir,int range) +void inline shoot(int dir,int range) { if (range <= 7000 && range > 200) { printlog("cannon(%d,%d)",dir,range); @@ -26,7 +26,7 @@ } } -main() +int main() { int sdir=0; /* current scan direction */ int dir=0; /* current movement direction */ @@ -74,4 +74,6 @@ else sdir -= 20; /* increment the scan */ } + + return 0; }