[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.hFri Mar 19 21:32:49 2004
+++ freebooters-0.1/combatant.h Wed May 12 14:32:49 2004
@@ -1,4 +1,4 @@
-#include
+#include
#include
#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
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include
#include
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
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
diff -ru freebooters-0.1.orig/menu.cc freebooters-0.1/menu.cc
--- freebooters-0.1.orig/menu.ccFri Apr 9 01:06:42 2004
+++ freebooters-0.1/menu.cc Tue May 11 21:40:40 2004
@@ -19,9 +19,9 @@
*
*/
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
#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
#include
#include
-#include
-#include
+#include
+#include
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(round(floatx)),static_cast(round(floaty)));
+
Sprite::move_to(static_cast(rint(floatx)),static_cast(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
+#include
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.ccWed May 12 14:33:57 2004
@@ -20,10 +20,10 @@
*
*/
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include "sdl_setup.h"
#include
#include
diff -ru freebooters-0.1.orig/seabattle.h freebooters-0.1/seabattle.h
--- freebooters-0.1.orig/seabattle.hFri Mar 19 21:32:49 2004
+++ freebooters-0.1/seabattle.h Wed May 12 14:32:08 2004
@@ -1,9 +1,9 @@
#include
#include
#include
-#include
-#include
-#include
+#include
+#include
+#include
#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.ccWed May 12 17:22:39 2004
@@ -68,14 +68,14 @@
// calculate cannonball flight altitude
if (i->airtime<=(i->firepower/2)){
-
i->h=static_cast(round((float)i->airtime/(float)i->firepower*2.0*8.0));
+
i->h=static_cast(rint((float)i->airtime/(float)i->firepower*2.0*8.0));
} else {
-
i->h=static_cast(round(8.0-float)i->airtime/(float)i->firepower*2.0)-1.0)*8.0)));
+
i->h=static_cast(rint(8.0-float)i->airtime/(float)i->firepo