Hi

With this patch I can build and play xevil on sparc64. I don't
understand the intricacies of the C++ headers that allow defining
min/max macros to work on amd64 but not on sparc64. It doesn't matter
since we can just delete the macro min/max and use the STL one (not a
macro) and cast the types appropriately.

Still works on amd64 too.

diff --git games/xevil/Makefile games/xevil/Makefile
index 7aa1780b9e7..a93de58c013 100644
--- games/xevil/Makefile
+++ games/xevil/Makefile
@@ -9,7 +9,7 @@ COMMENT=        side-view, fast-action, kill everything type of 
game
 V=             2.02r2
 DISTNAME=      xevilsrc${V}
 PKGNAME=       xevil-${V}
-REVISION =     7
+REVISION =     8
 
 CATEGORIES=    games
 
diff --git games/xevil/patches/patch-cmn_game_cpp 
games/xevil/patches/patch-cmn_game_cpp
index fc02245f785..0d0d767fa2d 100644
--- games/xevil/patches/patch-cmn_game_cpp
+++ games/xevil/patches/patch-cmn_game_cpp
@@ -19,3 +19,21 @@ Index: cmn/game.cpp
  
  #include "utils.h"
  #include "coord.h"
+@@ -566,7 +567,7 @@ void GameObjects::level_reset(const Dim &worldDim,Game
+ 
+       // Don't allow objectWorldPercent values that are too small.
+       float objWPercent = (float)max(weapons[n]->objectWorldPercent,
+-                            OBJECT_WORLD_PERCENT_MIN);
++                            (float)OBJECT_WORLD_PERCENT_MIN);
+ 
+       maximums[weapons[n]->classId] = (int)ceil(areaFactor * objWPercent);
+       // A limit may be placed on how many times the object comes back 
+@@ -579,7 +580,7 @@ void GameObjects::level_reset(const Dim &worldDim,Game
+       // Check not already set.
+       assert(maximums[oItems[n]->classId] == 0);
+       float objWPercent = (float)max(oItems[n]->objectWorldPercent,
+-                            OBJECT_WORLD_PERCENT_MIN);
++                            (float)OBJECT_WORLD_PERCENT_MIN);
+ 
+       maximums[oItems[n]->classId] = (int)ceil(areaFactor * objWPercent);
+       levelMaxTimes[oItems[n]->classId] = oItems[n]->levelMaxTimes;
diff --git games/xevil/patches/patch-cmn_utils_h 
games/xevil/patches/patch-cmn_utils_h
index 934c82e8c92..920edbc1b9b 100644
--- games/xevil/patches/patch-cmn_utils_h
+++ games/xevil/patches/patch-cmn_utils_h
@@ -1,10 +1,26 @@
 $OpenBSD: patch-cmn_utils_h,v 1.1 2017/05/02 23:26:32 espie Exp $
+Don't #define min and max, conflicts with STL non-macro definitions.
+
 If you're going to wrap C++ functions, you need both const correct wrappers.
 
 Index: cmn/utils.h
 --- cmn/utils.h.orig
 +++ cmn/utils.h
-@@ -237,13 +237,22 @@ class Utils {
+@@ -98,13 +98,6 @@ extern "C" {
+ #define MSEC_PER_CLOCK (1.0e3 / CLOCKS_PER_SEC) 
+ #endif
+ 
+-#ifndef max
+-#define max(a,b)               (a<b ? b : a)
+-#endif
+-#ifndef min
+-#define min(a,b)               (a>b ? b : a)
+-#endif
+-
+ #if X11
+ typedef char Boolean;
+ #endif
+@@ -237,13 +230,22 @@ class Utils {
    /* EFFECTS: Wrapper for C library strcmp().  Return 0 if strings are the
       same. */
  

Reply via email to