[EMAIL PROTECTED] wrote: > $ gmake > g++ -g -O2 -Wall `sdl-config --cflags` -c -o nutship.o nutship.cc > nutship.cc: In member function `void NutShip::travel(int, int, int, int, > NutShip*)': > nutship.cc:226: error: `round' undeclared (first use this function)
I debugged this on a FreeBSD machine. It turned out that FreeBSD's libc does not support the C99 function round(). I fixed this by converting to rint(), changed a remaining usleep() to SDL_Delay() and fixed the improper SDL includes. Now it compiles fine and FreeBSD will be supported in the upcoming 0.1.1 release. In the meantime use the attached patch. > Oh, btw. thanks for making a "new" Pirates! You are doing a great job! Thanks. Cheers, Moritz
diff -ru freebooters-0.1.orig/combatant.h freebooters-0.1/combatant.h --- freebooters-0.1.orig/combatant.h Fri Mar 19 21:32:49 2004 +++ freebooters-0.1/combatant.h Wed May 12 14:32:49 2004 @@ -1,4 +1,4 @@ -#include <SDL/SDL_mixer.h> +#include <SDL_mixer.h> #include <iostream> #include "nutship.h" #include "player.h" diff -ru freebooters-0.1.orig/freebooters.cc freebooters-0.1/freebooters.cc --- freebooters-0.1.orig/freebooters.cc Thu Apr 8 21:22:42 2004 +++ freebooters-0.1/freebooters.cc Wed May 12 14:30:49 2004 @@ -21,10 +21,10 @@ */ #include <cstdlib> -#include <SDL/SDL.h> -#include <SDL/SDL_mixer.h> -#include <SDL/SDL_ttf.h> -#include <SDL/SDL_image.h> +#include <SDL.h> +#include <SDL_mixer.h> +#include <SDL_ttf.h> +#include <SDL_image.h> #include <sys/types.h> #include <sstream> diff -ru freebooters-0.1.orig/justbattle.cc freebooters-0.1/justbattle.cc --- freebooters-0.1.orig/justbattle.cc Fri Apr 9 11:14:52 2004 +++ freebooters-0.1/justbattle.cc Wed May 12 17:25:40 2004 @@ -20,9 +20,9 @@ */ #include <cstdlib> -#include <SDL/SDL.h> -#include <SDL/SDL_mixer.h> -#include <SDL/SDL_image.h> +#include <SDL.h> +#include <SDL_mixer.h> +#include <SDL_image.h> #include <iostream> #include <sstream> diff -ru freebooters-0.1.orig/menu.cc freebooters-0.1/menu.cc --- freebooters-0.1.orig/menu.cc Fri Apr 9 01:06:42 2004 +++ freebooters-0.1/menu.cc Tue May 11 21:40:40 2004 @@ -19,9 +19,9 @@ * */ -#include <SDL/SDL.h> -#include <SDL/SDL_ttf.h> -#include <SDL/SDL_image.h> +#include <SDL.h> +#include <SDL_ttf.h> +#include <SDL_image.h> #include <vector> #include <string> #include "menu.h" @@ -385,7 +385,7 @@ while ( ret.selected == "void" ) { - usleep(1000); + SDL_Delay(1000); if ( SDL_PollEvent(&event) ) { if (!currently_editing) diff -ru freebooters-0.1.orig/menu.h freebooters-0.1/menu.h --- freebooters-0.1.orig/menu.h Fri Apr 9 00:40:24 2004 +++ freebooters-0.1/menu.h Tue May 11 21:31:56 2004 @@ -4,8 +4,8 @@ #include <vector> #include <string> #include <map> -#include <SDL/SDL.h> -#include <SDL/SDL_ttf.h> +#include <SDL.h> +#include <SDL_ttf.h> class Tools; diff -ru freebooters-0.1.orig/nutship.cc freebooters-0.1/nutship.cc --- freebooters-0.1.orig/nutship.cc Thu Apr 8 21:29:00 2004 +++ freebooters-0.1/nutship.cc Wed May 12 14:59:51 2004 @@ -222,12 +222,12 @@ floaty=newy+incy; // Kollisionsabfrage, ob wir rausbouncen - if (round(floatx)<0) floatx=0; - if (round(floaty)<0) floaty=0; - if ((round(floatx)+rect.w)>max_x) floatx=max_x-rect.w; - if ((round(floaty)+rect.h)>max_y) floaty=max_y-rect.h; + if (rint(floatx)<0) floatx=0; + if (rint(floaty)<0) floaty=0; + if ((rint(floatx)+rect.w)>max_x) floatx=max_x-rect.w; + if ((rint(floaty)+rect.h)>max_y) floaty=max_y-rect.h; - Sprite::move_to(static_cast<int>(round(floatx)),static_cast<int>(round(floaty))); + Sprite::move_to(static_cast<int>(rint(floatx)),static_cast<int>(rint(floaty))); Sprite::rotate_baum(segelstellung-1); } diff -ru freebooters-0.1.orig/replacecol.cc freebooters-0.1/replacecol.cc --- freebooters-0.1.orig/replacecol.cc Thu Apr 8 21:30:02 2004 +++ freebooters-0.1/replacecol.cc Wed May 12 15:01:19 2004 @@ -20,7 +20,7 @@ * */ -#include <SDL/SDL.h> +#include <SDL.h> Uint32 getpixel(SDL_Surface *surface, int x, int y) { diff -ru freebooters-0.1.orig/sdl_setup.cc freebooters-0.1/sdl_setup.cc --- freebooters-0.1.orig/sdl_setup.cc Thu Apr 8 21:30:19 2004 +++ freebooters-0.1/sdl_setup.cc Wed May 12 14:33:57 2004 @@ -20,10 +20,10 @@ * */ -#include <SDL/SDL.h> -#include <SDL/SDL_mixer.h> -#include <SDL/SDL_ttf.h> -#include <SDL/SDL_image.h> +#include <SDL.h> +#include <SDL_mixer.h> +#include <SDL_ttf.h> +#include <SDL_image.h> #include "sdl_setup.h" #include <sys/time.h> #include <cstdlib> diff -ru freebooters-0.1.orig/seabattle.h freebooters-0.1/seabattle.h --- freebooters-0.1.orig/seabattle.h Fri Mar 19 21:32:49 2004 +++ freebooters-0.1/seabattle.h Wed May 12 14:32:08 2004 @@ -1,9 +1,9 @@ #include <string> #include <vector> #include <sstream> -#include <SDL/SDL_mixer.h> -#include <SDL/SDL_ttf.h> -#include <SDL/SDL_image.h> +#include <SDL_mixer.h> +#include <SDL_ttf.h> +#include <SDL_image.h> #include "shots.h" #define PI 3.14159265 diff -ru freebooters-0.1.orig/shots.cc freebooters-0.1/shots.cc --- freebooters-0.1.orig/shots.cc Thu Apr 8 21:31:56 2004 +++ freebooters-0.1/shots.cc Wed May 12 17:22:39 2004 @@ -68,14 +68,14 @@ // calculate cannonball flight altitude if (i->airtime<=(i->firepower/2)){ - i->h=static_cast<int>(round((float)i->airtime/(float)i->firepower*2.0*8.0)); + i->h=static_cast<int>(rint((float)i->airtime/(float)i->firepower*2.0*8.0)); } else { - i->h=static_cast<int>(round(8.0-((((float)i->airtime/(float)i->firepower*2.0)-1.0)*8.0))); + i->h=static_cast<int>(rint(8.0-((((float)i->airtime/(float)i->firepower*2.0)-1.0)*8.0))); } // calculate cannonball position - i->x=static_cast<int>(round((float)i->airtime*10.0*cos(i->origin_a*PI/180.0)))+i->origin_x+13; - i->y=static_cast<int>(round((float)i->airtime*10.0*sin(i->origin_a*PI/180.0)))+i->origin_y+13; + i->x=static_cast<int>(rint((float)i->airtime*10.0*cos(i->origin_a*PI/180.0)))+i->origin_x+13; + i->y=static_cast<int>(rint((float)i->airtime*10.0*sin(i->origin_a*PI/180.0)))+i->origin_y+13; if(i->x<639 && i->y<479 && i->x>0 && i->y>0 && i->h<1) { splashes.addSplash(i->x,i->y); diff -ru freebooters-0.1.orig/shots.h freebooters-0.1/shots.h --- freebooters-0.1.orig/shots.h Fri Mar 19 21:32:49 2004 +++ freebooters-0.1/shots.h Wed May 12 14:32:30 2004 @@ -1,6 +1,6 @@ #include <vector> -#include <SDL/SDL.h> -#include <SDL/SDL_image.h> +#include <SDL.h> +#include <SDL_image.h> #include "splash.h" #include "combatant.h" diff -ru freebooters-0.1.orig/splash.h freebooters-0.1/splash.h --- freebooters-0.1.orig/splash.h Fri Feb 27 00:02:17 2004 +++ freebooters-0.1/splash.h Wed May 12 14:31:45 2004 @@ -1,7 +1,7 @@ #include <vector> -#include <SDL/SDL.h> -#include <SDL/SDL_image.h> -#include <SDL/SDL_mixer.h> +#include <SDL.h> +#include <SDL_image.h> +#include <SDL_mixer.h> class Splash{ public: diff -ru freebooters-0.1.orig/sprite.cc freebooters-0.1/sprite.cc --- freebooters-0.1.orig/sprite.cc Thu Apr 8 21:32:35 2004 +++ freebooters-0.1/sprite.cc Wed May 12 15:00:21 2004 @@ -19,8 +19,8 @@ * */ -#include <SDL/SDL.h> -#include <SDL/SDL_image.h> +#include <SDL.h> +#include <SDL_image.h> #include <iostream> #include "replacecol.h" #include "sprite.h" diff -ru freebooters-0.1.orig/sprite.h freebooters-0.1/sprite.h --- freebooters-0.1.orig/sprite.h Fri Mar 19 21:32:49 2004 +++ freebooters-0.1/sprite.h Wed May 12 14:33:08 2004 @@ -1,7 +1,7 @@ #ifndef SPRITE_H #define SPRITE_H -#include <SDL/SDL.h> +#include <SDL.h> #include <string> #include <vector> diff -ru freebooters-0.1.orig/tools.cc freebooters-0.1/tools.cc --- freebooters-0.1.orig/tools.cc Thu Apr 8 21:32:51 2004 +++ freebooters-0.1/tools.cc Wed May 12 17:24:42 2004 @@ -23,10 +23,10 @@ #include "tools.h" #include <string> #include <iostream> -#include <SDL/SDL.h> -#include <SDL/SDL_image.h> -#include <SDL/SDL_ttf.h> -#include <SDL/SDL_mixer.h> +#include <SDL.h> +#include <SDL_image.h> +#include <SDL_ttf.h> +#include <SDL_mixer.h> #include "readdata.h" using namespace std; diff -ru freebooters-0.1.orig/tools.h freebooters-0.1/tools.h --- freebooters-0.1.orig/tools.h Sun Apr 4 00:35:17 2004 +++ freebooters-0.1/tools.h Tue May 11 21:33:22 2004 @@ -3,9 +3,9 @@ #include <string> #include <vector> -#include <SDL/SDL.h> -#include <SDL/SDL_ttf.h> -#include <SDL/SDL_mixer.h> +#include <SDL.h> +#include <SDL_ttf.h> +#include <SDL_mixer.h> class Tools