summaryrefslogtreecommitdiff
path: root/games/assaultcube
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2019-07-05 08:01:31 +0000
committernia <nia@pkgsrc.org>2019-07-05 08:01:31 +0000
commit23738b807ca1d206de5480904aca941b48e2fd16 (patch)
tree5e3a994e9cc255364474fd982b0693db2b0a7e57 /games/assaultcube
parent0199cfa023e2c610972716949479019359a22dc3 (diff)
downloadpkgsrc-23738b807ca1d206de5480904aca941b48e2fd16.tar.gz
assaultcube: Backport gcc6 fixes from upstream.
This compiled successfully on NetBSD-current with gcc7, so it seems this mainly helps other OSes.
Diffstat (limited to 'games/assaultcube')
-rw-r--r--games/assaultcube/Makefile4
-rw-r--r--games/assaultcube/distinfo16
-rw-r--r--games/assaultcube/patches/patch-source_src_bot_bot__waypoint.cpp48
-rw-r--r--games/assaultcube/patches/patch-source_src_command.cpp22
-rw-r--r--games/assaultcube/patches/patch-source_src_command.h21
-rw-r--r--games/assaultcube/patches/patch-source_src_crypto.cpp22
-rw-r--r--games/assaultcube/patches/patch-source_src_editing.cpp36
-rw-r--r--games/assaultcube/patches/patch-source_src_entity.h22
-rw-r--r--games/assaultcube/patches/patch-source_src_main.cpp29
-rw-r--r--games/assaultcube/patches/patch-source_src_platform.h36
-rw-r--r--games/assaultcube/patches/patch-source_src_protos.h23
-rw-r--r--games/assaultcube/patches/patch-source_src_rendercubes.cpp35
-rw-r--r--games/assaultcube/patches/patch-source_src_rendertext.cpp31
-rw-r--r--games/assaultcube/patches/patch-source_src_tools.h23
-rw-r--r--games/assaultcube/patches/patch-source_src_world.cpp26
-rw-r--r--games/assaultcube/patches/patch-source_src_worldrender.cpp26
16 files changed, 417 insertions, 3 deletions
diff --git a/games/assaultcube/Makefile b/games/assaultcube/Makefile
index a5d367018e1..389629598c0 100644
--- a/games/assaultcube/Makefile
+++ b/games/assaultcube/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2019/07/01 04:08:09 ryoon Exp $
+# $NetBSD: Makefile,v 1.3 2019/07/05 08:01:31 nia Exp $
PKGNAME= assaultcube-1.2.0.2
-PKGREVISION= 1
+PKGREVISION= 2
DISTNAME= AssaultCube_v${PKGVERSION_NOREV}
CATEGORIES= games
MASTER_SITES= ${MASTER_SITE_GITHUB:=assaultcube/}
diff --git a/games/assaultcube/distinfo b/games/assaultcube/distinfo
index 7a3f879a4d3..f84312b64cd 100644
--- a/games/assaultcube/distinfo
+++ b/games/assaultcube/distinfo
@@ -1,7 +1,21 @@
-$NetBSD: distinfo,v 1.1 2019/06/30 21:44:30 nia Exp $
+$NetBSD: distinfo,v 1.2 2019/07/05 08:01:31 nia Exp $
SHA1 (AssaultCube_v1.2.0.2.tar.bz2) = 16b5239c1e2129ba980aee2b96ee52c6128e5821
RMD160 (AssaultCube_v1.2.0.2.tar.bz2) = 861c5d59e8313b7dd8548605f08d6829dca76326
SHA512 (AssaultCube_v1.2.0.2.tar.bz2) = e2a0d3380db6d2ac2773ea90703fd572504729b9214a6c105f39aefa4c06ff48720634c6601efdad8b9b3b22dec9bc3a9ea7e094839042bc3ff5cfdd88eac976
Size (AssaultCube_v1.2.0.2.tar.bz2) = 48181347 bytes
SHA1 (patch-source_src_Makefile) = 8825c40bf869166708a1f9277b1f77901137771d
+SHA1 (patch-source_src_bot_bot__waypoint.cpp) = 5ded14f79b69ee6ec6c2e9628452a1d6db0d406e
+SHA1 (patch-source_src_command.cpp) = 9bf2127eff468fd213bf66d345daab982b1c0722
+SHA1 (patch-source_src_command.h) = 300f62adb527224c420ed2a6ce3044660fdb4e7a
+SHA1 (patch-source_src_crypto.cpp) = fff2b1cf9cac8c4dd9999fc99ed5ce3200f331fc
+SHA1 (patch-source_src_editing.cpp) = 7bf829a47233358fe14341691e84c9bd5ff880b7
+SHA1 (patch-source_src_entity.h) = ab67abee7df1587eb01877a9aea64a1b28a940ea
+SHA1 (patch-source_src_main.cpp) = 4b3dc7617cb36054ed6de111e8994d22d2e0267b
+SHA1 (patch-source_src_platform.h) = 82530eef173f161ed33cee368c0afd6ccd5644a7
+SHA1 (patch-source_src_protos.h) = 0944251480debf25e8dc25463307c223ffebbfbb
+SHA1 (patch-source_src_rendercubes.cpp) = 740f5dc169a5e0b331437fd157238a5323a0c866
+SHA1 (patch-source_src_rendertext.cpp) = 3082ca174416c21157ef56fb4d09f3ae3653a47d
+SHA1 (patch-source_src_tools.h) = a6c0ca4a28b51fc437ed69fe3e7ea48f07c711cb
+SHA1 (patch-source_src_world.cpp) = 2b48cddb24109c018dc70a3e94417c43178ae101
+SHA1 (patch-source_src_worldrender.cpp) = fb7341ad70fcb242982a5f02d7ab0fe3759245d0
diff --git a/games/assaultcube/patches/patch-source_src_bot_bot__waypoint.cpp b/games/assaultcube/patches/patch-source_src_bot_bot__waypoint.cpp
new file mode 100644
index 00000000000..e30055a9478
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_bot_bot__waypoint.cpp
@@ -0,0 +1,48 @@
+$NetBSD: patch-source_src_bot_bot__waypoint.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/bot/bot_waypoint.cpp.orig 2013-11-10 18:50:03.000000000 +0000
++++ source/src/bot/bot_waypoint.cpp
+@@ -1221,7 +1221,7 @@ void CWaypointClass::CalcCost(node_s *pN
+ flCost += (1.0f-flFraction)*0.5f;
+ }
+
+- if ((abs(a) > 4) || (abs(b) > 4)) continue;
++ if ((iabs(a) > 4) || (iabs(b) > 4)) continue;
+
+ vec from = to;
+ to.z -= (JUMP_HEIGHT - 1.0f);
+@@ -1249,7 +1249,7 @@ void CWaypointClass::CalcCost(node_s *pN
+ flCost += (1.0f-flFraction)*0.5f;
+ }
+
+- if ((abs(a) > 4) || (abs(b) > 4)) continue;
++ if ((iabs(a) > 4) || (iabs(b) > 4)) continue;
+
+ vec from = to;
+ to.z -= (JUMP_HEIGHT - 1.0f);
+@@ -1671,12 +1671,12 @@ node_s *CWaypointClass::GetNearestTrigge
+ void CWaypointClass::GetNodeIndexes(const vec &v_origin, short *i, short *j)
+ {
+ // Function code by cheesy and PMB
+- //*i = abs((int)((int)(v_origin.x + (2*ssize)) / SECTOR_SIZE));
+- //*j = abs((int)((int)(v_origin.y + (2*ssize)) / SECTOR_SIZE));
++ //*i = iabs((int)((int)(v_origin.x + (2*ssize)) / SECTOR_SIZE));
++ //*j = iabs((int)((int)(v_origin.y + (2*ssize)) / SECTOR_SIZE));
+ //*i = (int)((v_origin.x) / ssize * MAX_MAP_GRIDS);
+ //*j = (int)((v_origin.y) / ssize * MAX_MAP_GRIDS);
+- *i = abs((int)((v_origin.x) / MAX_MAP_GRIDS));
+- *j = abs((int)((v_origin.y) / MAX_MAP_GRIDS));
++ *i = iabs((int)((v_origin.x) / MAX_MAP_GRIDS));
++ *j = iabs((int)((v_origin.y) / MAX_MAP_GRIDS));
+
+ if (*i > MAX_MAP_GRIDS - 1)
+ *i = MAX_MAP_GRIDS - 1;
diff --git a/games/assaultcube/patches/patch-source_src_command.cpp b/games/assaultcube/patches/patch-source_src_command.cpp
new file mode 100644
index 00000000000..6523fbfdefd
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_command.cpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-source_src_command.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/command.cpp.orig 2013-11-09 18:48:58.000000000 +0000
++++ source/src/command.cpp
+@@ -497,7 +497,7 @@ char *executeret(const char *p)
+ if(lc<=seer_t1.length())
+ {
+ int dt = seer_t1[seer_index] - seer_t1[lc];
+- if(abs(dt)<2)
++ if(iabs(dt)<2)
+ {
+ conoutf("SCRIPT EXECUTION warning [%d:%s]", &p, p);
+ seer_t2.add(seer_t1[seer_index]);
diff --git a/games/assaultcube/patches/patch-source_src_command.h b/games/assaultcube/patches/patch-source_src_command.h
new file mode 100644
index 00000000000..81446d84bca
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_command.h
@@ -0,0 +1,21 @@
+$NetBSD: patch-source_src_command.h,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/command.h.orig 2013-10-22 18:57:19.000000000 +0000
++++ source/src/command.h
+@@ -86,6 +86,7 @@ enum { IEXC_CORE = 0, IEXC_CFG, IEXC_PRO
+ #define VARNP(name, global, min, cur, max) int global = variable(#name, min, cur, max, &global, NULL, true)
+ #define VARF(name, min, cur, max, body) extern int name; void var_##name() { body; } int name = variable(#name, min, cur, max, &name, var_##name, false)
+ #define VARFP(name, min, cur, max, body) extern int name; void var_##name() { body; } int name = variable(#name, min, cur, max, &name, var_##name, true)
++#define VARNFP(name, global, min, cur, max, body) extern int global; void var_##name() { body; } int global = variable(#name, min, cur, max, &global, var_##name, true)
+
+ #define FVARP(name, min, cur, max) float name = fvariable(#name, min, cur, max, &name, NULL, true)
+ #define FVAR(name, min, cur, max) float name = fvariable(#name, min, cur, max, &name, NULL, false)
diff --git a/games/assaultcube/patches/patch-source_src_crypto.cpp b/games/assaultcube/patches/patch-source_src_crypto.cpp
new file mode 100644
index 00000000000..90de2b690a8
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_crypto.cpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-source_src_crypto.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/crypto.cpp.orig 2013-10-09 08:27:37.000000000 +0000
++++ source/src/crypto.cpp
+@@ -763,7 +763,7 @@ bool hashstring(const char *str, char *r
+ const char *genpwdhash(const char *name, const char *pwd, int salt)
+ {
+ static string temp;
+- formatstring(temp)("%s %d %s %s %d", pwd, salt, name, pwd, abs(PROTOCOL_VERSION));
++ formatstring(temp)("%s %d %s %s %d", pwd, salt, name, pwd, iabs(PROTOCOL_VERSION));
+ tiger::hashval hash;
+ tiger::hash((uchar *)temp, (int)strlen(temp), hash);
+ formatstring(temp)("%llx %llx %llx", hash.chunks[0], hash.chunks[1], hash.chunks[2]);
diff --git a/games/assaultcube/patches/patch-source_src_editing.cpp b/games/assaultcube/patches/patch-source_src_editing.cpp
new file mode 100644
index 00000000000..4be732480a2
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_editing.cpp
@@ -0,0 +1,36 @@
+$NetBSD: patch-source_src_editing.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/editing.cpp.orig 2013-10-22 18:57:16.000000000 +0000
++++ source/src/editing.cpp
+@@ -126,11 +126,11 @@ void checkselections()
+ void makesel(bool isnew)
+ {
+ block &cursel = sels.last(); //RR 10/12/12 - FIXEME, error checking should happen with "isnew", not here checking if it really is new.
+- if(isnew || sels.length() == 0) addselection(min(lastx, cx), min(lasty, cy), abs(lastx-cx)+1, abs(lasty-cy)+1, max(lasth, ch));
++ if(isnew || sels.length() == 0) addselection(min(lastx, cx), min(lasty, cy), iabs(lastx-cx)+1, iabs(lasty-cy)+1, max(lasth, ch));
+ else
+ {
+ cursel.x = min(lastx, cx); cursel.y = min(lasty, cy);
+- cursel.xs = abs(lastx-cx)+1; cursel.ys = abs(lasty-cy)+1;
++ cursel.xs = iabs(lastx-cx)+1; cursel.ys = iabs(lasty-cy)+1;
+ cursel.h = max(lasth, ch);
+ correctsel(cursel);
+ }
+@@ -645,7 +645,7 @@ void movemap(int xo, int yo, int zo) //
+ }
+ if(xo || yo)
+ {
+- block b = { max(-xo, 0), max(-yo, 0), ssize - abs(xo), ssize - abs(yo) }, *cp = blockcopy(b);
++ block b = { max(-xo, 0), max(-yo, 0), ssize - iabs(xo), ssize - iabs(yo) }, *cp = blockcopy(b);
+ cp->x = max(xo, 0);
+ cp->y = max(yo, 0);
+ blockpaste(*cp);
diff --git a/games/assaultcube/patches/patch-source_src_entity.h b/games/assaultcube/patches/patch-source_src_entity.h
new file mode 100644
index 00000000000..48bc2e2f8b9
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_entity.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-source_src_entity.h,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/entity.h.orig 2013-10-22 18:57:16.000000000 +0000
++++ source/src/entity.h
+@@ -540,7 +540,7 @@ public:
+ {
+ const int maxskin[2] = { 4, 6 };
+ t = team_base(t < 0 ? team : t);
+- nextskin[t] = abs(s) % maxskin[t];
++ nextskin[t] = iabs(s) % maxskin[t];
+ }
+ };
+
diff --git a/games/assaultcube/patches/patch-source_src_main.cpp b/games/assaultcube/patches/patch-source_src_main.cpp
new file mode 100644
index 00000000000..202ba8cce76
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_main.cpp
@@ -0,0 +1,29 @@
+$NetBSD: patch-source_src_main.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/main.cpp.orig 2013-10-29 09:33:15.000000000 +0000
++++ source/src/main.cpp
+@@ -513,11 +513,11 @@ void setresdata(char *s, enet_uint32 c)
+ COMMANDF(screenres, "ii", (int *w, int *h) { screenres(*w, *h); });
+
+ static int curgamma = 100;
+-VARFP(gamma, 30, 100, 300,
++VARNFP(gamma, vgamma, 30, 100, 300,
+ {
+- if(gamma == curgamma) return;
+- curgamma = gamma;
+- float f = gamma/100.0f;
++ if(vgamma == curgamma) return;
++ curgamma = vgamma;
++ float f = vgamma/100.0f;
+ if(SDL_SetGamma(f,f,f)==-1) conoutf("Could not set gamma: %s", SDL_GetError());
+ });
+
diff --git a/games/assaultcube/patches/patch-source_src_platform.h b/games/assaultcube/patches/patch-source_src_platform.h
new file mode 100644
index 00000000000..906736c75dc
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_platform.h
@@ -0,0 +1,36 @@
+$NetBSD: patch-source_src_platform.h,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/platform.h.orig 2013-10-22 18:57:19.000000000 +0000
++++ source/src/platform.h
+@@ -2,14 +2,6 @@
+ #ifdef _FORTIFY_SOURCE
+ #undef _FORTIFY_SOURCE
+ #endif
+-
+- #define gamma __gamma
+-#endif
+-
+-#include <math.h>
+-
+-#ifdef __GNUC__
+- #undef gamma
+ #endif
+
+ #include <string.h>
+@@ -19,6 +11,7 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <limits.h>
++#include <math.h>
+ #ifdef __GNUC__
+ #include <new>
+ #include <signal.h>
diff --git a/games/assaultcube/patches/patch-source_src_protos.h b/games/assaultcube/patches/patch-source_src_protos.h
new file mode 100644
index 00000000000..47bf9aeff8b
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_protos.h
@@ -0,0 +1,23 @@
+$NetBSD: patch-source_src_protos.h,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/protos.h.orig 2013-11-09 18:48:58.000000000 +0000
++++ source/src/protos.h
+@@ -1029,7 +1029,8 @@ struct servercommandline
+ {
+ demo_interm = true;
+ }
+- else if(ai > 0) maxdemos = ai; break;
++ else if(ai > 0) maxdemos = ai;
++ break;
+ }
+ case 'W': demopath = a; break;
+ case 'r': maprot = a; break;
diff --git a/games/assaultcube/patches/patch-source_src_rendercubes.cpp b/games/assaultcube/patches/patch-source_src_rendercubes.cpp
new file mode 100644
index 00000000000..bc52fea5c80
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_rendercubes.cpp
@@ -0,0 +1,35 @@
+$NetBSD: patch-source_src_rendercubes.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/rendercubes.cpp.orig 2013-10-22 18:57:16.000000000 +0000
++++ source/src/rendercubes.cpp
+@@ -202,9 +202,9 @@ void render_flat(int wtex, int x, int y,
+ else // continue strip
+ {
+ int lighterr = lighterror*2;
+- if((abs(ol1r-l3->r)<lighterr && abs(ol2r-l4->r)<lighterr // skip vertices if light values are close enough
+- && abs(ol1g-l3->g)<lighterr && abs(ol2g-l4->g)<lighterr
+- && abs(ol1b-l3->b)<lighterr && abs(ol2b-l4->b)<lighterr) || !wtex)
++ if((iabs(ol1r-l3->r)<lighterr && iabs(ol2r-l4->r)<lighterr // skip vertices if light values are close enough
++ && iabs(ol1g-l3->g)<lighterr && iabs(ol2g-l4->g)<lighterr
++ && iabs(ol1b-l3->b)<lighterr && iabs(ol2b-l4->b)<lighterr) || !wtex)
+ {
+ verts.setsize(verts.length()-2);
+ nquads--;
+@@ -361,7 +361,7 @@ void render_square(int wtex, float floor
+ {
+ int lighterr = lighterror*2;
+ if((!hf && !ohf)
+- && ((abs(ol1r-l2->r)<lighterr && abs(ol1g-l2->g)<lighterr && abs(ol1b-l2->b)<lighterr) || !wtex)) // skip vertices if light values are close enough
++ && ((iabs(ol1r-l2->r)<lighterr && iabs(ol1g-l2->g)<lighterr && iabs(ol1b-l2->b)<lighterr) || !wtex)) // skip vertices if light values are close enough
+ {
+ verts.setsize(verts.length()-2);
+ nquads--;
diff --git a/games/assaultcube/patches/patch-source_src_rendertext.cpp b/games/assaultcube/patches/patch-source_src_rendertext.cpp
new file mode 100644
index 00000000000..860793c9cc0
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_rendertext.cpp
@@ -0,0 +1,31 @@
+$NetBSD: patch-source_src_rendertext.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/rendertext.cpp.orig 2013-10-22 18:57:16.000000000 +0000
++++ source/src/rendertext.cpp
+@@ -330,7 +330,7 @@ static void text_color(char c, char *sta
+ if(c=='r') c = stack[(sp > 0) ? --sp : sp]; // restore color
+ else if(c == 'b') { if(allowblinkingtext && !ignoreblinkingbit) stack[sp] *= -1; } // blinking text - only if allowed
+ else stack[sp] = c;
+- switch(abs(stack[sp]))
++ switch(iabs(stack[sp]))
+ {
+ case '0': color = bvec( 2, 255, 128 ); break; // green: player talk
+ case '1': color = bvec( 96, 160, 255 ); break; // blue: team chat
+@@ -380,7 +380,7 @@ static void text_color(char c, char *sta
+ //default: color = bvec( 255, 255, 255 ); break;
+ }
+ int b = (int) (sinf(lastmillis / 200.0f) * 115.0f);
+- b = stack[sp] > 0 ? 100 : min(abs(b), 100);
++ b = stack[sp] > 0 ? 100 : min(iabs(b), 100);
+ glColor4ub(color.x, color.y, color.z, (a * b) / 100);
+ }
+ }
diff --git a/games/assaultcube/patches/patch-source_src_tools.h b/games/assaultcube/patches/patch-source_src_tools.h
new file mode 100644
index 00000000000..1469709bc8f
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_tools.h
@@ -0,0 +1,23 @@
+$NetBSD: patch-source_src_tools.h,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/tools.h.orig 2013-10-22 18:57:19.000000000 +0000
++++ source/src/tools.h
+@@ -54,8 +54,7 @@ static inline T min(T a, T b)
+ {
+ return a < b ? a : b;
+ }
+-
+-static inline float round(float x) { return floor(x + 0.5f); }
++inline int iabs(int n) { return labs(n); }
+
+ #define clamp(a,b,c) (max(b, min(a, c)))
+ #define rnd(x) ((int)(randomMT()&0xFFFFFF)%(x))
diff --git a/games/assaultcube/patches/patch-source_src_world.cpp b/games/assaultcube/patches/patch-source_src_world.cpp
new file mode 100644
index 00000000000..82a95b4db7f
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_world.cpp
@@ -0,0 +1,26 @@
+$NetBSD: patch-source_src_world.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/world.cpp.orig 2013-10-22 18:57:19.000000000 +0000
++++ source/src/world.cpp
+@@ -79,9 +79,9 @@ void remip(const block &b, int level)
+ || o[i]->ceil!=o[3]->ceil
+ || o[i]->ftex!=o[3]->ftex
+ || o[i]->ctex!=o[3]->ctex
+- || abs(o[i+1]->r-o[0]->r)>lighterr // perfect mip even if light is not exactly equal
+- || abs(o[i+1]->g-o[0]->g)>lighterr
+- || abs(o[i+1]->b-o[0]->b)>lighterr
++ || iabs(o[i+1]->r-o[0]->r)>lighterr // perfect mip even if light is not exactly equal
++ || iabs(o[i+1]->g-o[0]->g)>lighterr
++ || iabs(o[i+1]->b-o[0]->b)>lighterr
+ || o[i]->utex!=o[3]->utex
+ || o[i]->wtex!=o[3]->wtex) goto c;
+ }
diff --git a/games/assaultcube/patches/patch-source_src_worldrender.cpp b/games/assaultcube/patches/patch-source_src_worldrender.cpp
new file mode 100644
index 00000000000..171bf97da2e
--- /dev/null
+++ b/games/assaultcube/patches/patch-source_src_worldrender.cpp
@@ -0,0 +1,26 @@
+$NetBSD: patch-source_src_worldrender.cpp,v 1.1 2019/07/05 08:01:31 nia Exp $
+
+[PATCH] fix some errors and warnings for GCC 6
+
+- do not use std::abs() because math.h includes one, that converts ints
+ to double. Use own iabs(), which directly uses labs() instead.
+- don't use the word "gamma" as name for variables
+- don't use a homebrew round() function
+
+https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
+
+--- source/src/worldrender.cpp.orig 2013-10-09 08:27:37.000000000 +0000
++++ source/src/worldrender.cpp
+@@ -270,10 +270,10 @@ void distlod(int &low, int &high, int an
+ void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float fov, float fovy, int w, int h)
+ {
+ loopi(LARGEST_FACTOR) stats[i] = 0;
+- min_lod = minimap || (player1->isspectating() && player1->spectatemode == SM_OVERVIEW) ? MAX_LOD : MIN_LOD+abs(pitch)/12;
++ min_lod = minimap || (player1->isspectating() && player1->spectatemode == SM_OVERVIEW) ? MAX_LOD : MIN_LOD+iabs(pitch)/12;
+ yaw = 360-yaw;
+ float widef = fov/75.0f;
+- int cdist = abs(yaw%90-45);
++ int cdist = iabs(yaw%90-45);
+ if(cdist<7) // hack to avoid popup at high fovs at 45 yaw
+ {
+ min_lod = max(min_lod, (int)(MIN_LOD+(10-cdist)/1.0f*widef)); // less if lod worked better