On Fri, 1 Mar 2019 23:03:00 +0000
Stuart Henderson wrote:

> On 2019/03/01 23:49, Charlene Wendling wrote:
> > 
> > > http://build-failures.rhaalovely.net/powerpc/2019-02-04/games/spacehulk.log
> > > http://build-failures.rhaalovely.net/sparc64/2019-02-03/games/spacehulk.log
> > 
> > It was just a single missing header. While doing a checkup of the
> > port, i noticed that WANTLIB needed a major refresh as well. 
> > 
> > It builds and works fine on macppc [1] and amd64. 
> 
> Hmm, at some points in the code it's using srand (via setSeed) to try
> to set a specific seed from a save file, presumably to recreate game
> state. If that's correct then this should be patched to use
> srand_deterministic(), see rand(3) for an explanation.

Thanks! It's the case.

In WRKSRC/src/datastoring.cpp, DataStoring::LoadFromContent calls 
DataStoring::LoadGameManager, fetching the seed from the given
save file.

I've changed the patch accordingly. 

> 
> > Any comment? 
> > 
> > Charlène. 
> > 
> > [1] https://bsd.network/@julianaito/101677613297792800
> > 


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/spacehulk/Makefile,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 Makefile
--- Makefile    24 Oct 2018 14:28:04 -0000      1.19
+++ Makefile    1 Mar 2019 23:47:58 -0000
@@ -4,7 +4,7 @@ COMMENT=        total conversion of the Space H
 
 DISTNAME=      spacehulk-1.5-beta1
 PKGNAME=       spacehulk-1.5beta1
-REVISION =     9
+REVISION =     10
 CATEGORIES=    games x11
 
 HOMEPAGE=      http://r.vinot.free.fr/spacehulk/
@@ -12,10 +12,11 @@ HOMEPAGE=   http://r.vinot.free.fr/spacehu
 # GPL
 PERMIT_PACKAGE_CDROM=  Yes
 
-WANTLIB += GL ICE SM X11 X11-xcb Xau Xcursor Xdamage Xdmcp Xext Xfixes
-WANTLIB += Xft Xi Xinerama Xmu Xrandr Xrender Xt Xxf86vm c drm expat
-WANTLIB += fontconfig freetype glapi jpeg lcms m mng png pthread
-WANTLIB += ${COMPILER_LIBCXX} xcb xcb-dri2 xcb-glx z
+WANTLIB += ${COMPILER_LIBCXX} GL ICE SM X11 X11-xcb Xcursor Xdamage
+WANTLIB += Xext Xfixes Xft Xi Xinerama Xmu Xrandr Xrender Xt Xxf86vm
+WANTLIB += c drm expat fontconfig freetype glapi jpeg lcms m mng
+WANTLIB += png16 xcb xcb-dri2 xcb-dri3 xcb-glx xcb-present xcb-sync
+WANTLIB += xcb-xfixes xshmfence z
 
 COMPILER =             base-clang ports-gcc base-gcc
 
Index: patches/patch-src_rand_h
===================================================================
RCS file: patches/patch-src_rand_h
diff -N patches/patch-src_rand_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_rand_h    1 Mar 2019 23:47:58 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+ports-gcc fix: error: 'srand' was not declared in this scope
+Also, the seed value comes from savefiles, we need to use 
+the deterministic algorithm.
+Index: src/rand.h
+--- src/rand.h.orig
++++ src/rand.h
+@@ -1,12 +1,14 @@
+ #ifndef _RAND_H_
+ #define _RAND_H_
+ 
++#include <stdlib.h>
++
+ class Rand {
+ public:
+   static int seedvalue;
+   static int roll(int n, bool store=true);
+   static int simpleroll(int n);
+-  static void setSeed(int s) {seedvalue=s; srand(s);}
++  static void setSeed(int s) {seedvalue=s; srand_deterministic(s);}
+ };
+ 
+ #endif

Reply via email to