View | Details | Raw Unified | Return to bug 208754 | Differences between
and this patch

Collapse All | Expand All

(-)assaultcube/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	assaultcube
4
PORTNAME=	assaultcube
5
PORTVERSION=	1.2.0.2
5
PORTVERSION=	1.2.0.2
6
PORTREVISION=	4
6
PORTREVISION=	5
7
CATEGORIES=	games
7
CATEGORIES=	games
8
MASTER_SITES=	SF/actiongame/AssaultCube%20Version%20${PORTVERSION}
8
MASTER_SITES=	SF/actiongame/AssaultCube%20Version%20${PORTVERSION}
9
DISTNAME=	AssaultCube_v${PORTVERSION}
9
DISTNAME=	AssaultCube_v${PORTVERSION}
(-)assaultcube/files/patch-fixes-for-GCC-and-Clang.diff (+259 lines)
Line 0 Link Here
1
# Origin: https://github.com/assaultcube/AC/commit/6e4b23734f115888ce73907a85739ec833a333fd
2
# Subject: fix clang warnings
3
# Origin: https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4
4
# Subject: fix some errors and warnings for GCC 6
5
6
--- source/src/bot/bot_waypoint.cpp.orig	2013-11-10 18:50:03 UTC
7
+++ source/src/bot/bot_waypoint.cpp
8
@@ -848,7 +848,7 @@ void CWaypointClass::DeleteWaypoint(vec 
9
 
10
      if (!pWP)
11
      {
12
-          conoutf("Error: CouldnĀ“t find near waypoint");
13
+          conoutf("Error: Couldn't find near waypoint");
14
           return;
15
      }
16
 
17
@@ -1221,7 +1221,7 @@ void CWaypointClass::CalcCost(node_s *pN
18
                     flCost += (1.0f-flFraction)*0.5f;
19
                }
20
 
21
-               if ((abs(a) > 4) || (abs(b) > 4)) continue;
22
+               if ((iabs(a) > 4) || (iabs(b) > 4)) continue;
23
 
24
                vec from = to;
25
                to.z -= (JUMP_HEIGHT - 1.0f);
26
@@ -1249,7 +1249,7 @@ void CWaypointClass::CalcCost(node_s *pN
27
                     flCost += (1.0f-flFraction)*0.5f;
28
                }
29
 
30
-               if ((abs(a) > 4) || (abs(b) > 4)) continue;
31
+               if ((iabs(a) > 4) || (iabs(b) > 4)) continue;
32
 
33
                vec from = to;
34
                to.z -= (JUMP_HEIGHT - 1.0f);
35
@@ -1671,12 +1671,12 @@ node_s *CWaypointClass::GetNearestTrigge
36
 void CWaypointClass::GetNodeIndexes(const vec &v_origin, short *i, short *j)
37
 {
38
      // Function code by cheesy and PMB
39
-     //*i = abs((int)((int)(v_origin.x + (2*ssize)) / SECTOR_SIZE));
40
-     //*j = abs((int)((int)(v_origin.y + (2*ssize)) / SECTOR_SIZE));
41
+     //*i = iabs((int)((int)(v_origin.x + (2*ssize)) / SECTOR_SIZE));
42
+     //*j = iabs((int)((int)(v_origin.y + (2*ssize)) / SECTOR_SIZE));
43
      //*i = (int)((v_origin.x) / ssize * MAX_MAP_GRIDS);
44
      //*j = (int)((v_origin.y) / ssize * MAX_MAP_GRIDS);
45
-     *i = abs((int)((v_origin.x) / MAX_MAP_GRIDS));
46
-     *j = abs((int)((v_origin.y) / MAX_MAP_GRIDS));
47
+     *i = iabs((int)((v_origin.x) / MAX_MAP_GRIDS));
48
+     *j = iabs((int)((v_origin.y) / MAX_MAP_GRIDS));
49
 
50
      if (*i > MAX_MAP_GRIDS - 1)
51
           *i = MAX_MAP_GRIDS - 1;
52
--- source/src/command.cpp.orig	2013-11-09 18:48:58 UTC
53
+++ source/src/command.cpp
54
@@ -497,7 +497,7 @@ char *executeret(const char *p)         
55
             if(lc<=seer_t1.length())
56
             {
57
                 int dt = seer_t1[seer_index] - seer_t1[lc];
58
-                if(abs(dt)<2)
59
+                if(iabs(dt)<2)
60
                 {
61
                     conoutf("SCRIPT EXECUTION warning [%d:%s]", &p, p);
62
                     seer_t2.add(seer_t1[seer_index]);
63
--- source/src/command.h.orig	2013-10-22 18:57:19 UTC
64
+++ source/src/command.h
65
@@ -86,6 +86,7 @@ enum { IEXC_CORE = 0, IEXC_CFG, IEXC_PRO
66
 #define VARNP(name, global, min, cur, max) int global = variable(#name, min, cur, max, &global, NULL, true)
67
 #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)
68
 #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)
69
+#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)
70
 
71
 #define FVARP(name, min, cur, max) float name = fvariable(#name, min, cur, max, &name, NULL, true)
72
 #define FVAR(name, min, cur, max)  float name = fvariable(#name, min, cur, max, &name, NULL, false)
73
--- source/src/crypto.cpp.orig	2013-10-09 08:27:37 UTC
74
+++ source/src/crypto.cpp
75
@@ -763,7 +763,7 @@ bool hashstring(const char *str, char *r
76
 const char *genpwdhash(const char *name, const char *pwd, int salt)
77
 {
78
     static string temp;
79
-    formatstring(temp)("%s %d %s %s %d", pwd, salt, name, pwd, abs(PROTOCOL_VERSION));
80
+    formatstring(temp)("%s %d %s %s %d", pwd, salt, name, pwd, iabs(PROTOCOL_VERSION));
81
     tiger::hashval hash;
82
     tiger::hash((uchar *)temp, (int)strlen(temp), hash);
83
     formatstring(temp)("%llx %llx %llx", hash.chunks[0], hash.chunks[1], hash.chunks[2]);
84
--- source/src/editing.cpp.orig	2013-10-22 18:57:16 UTC
85
+++ source/src/editing.cpp
86
@@ -126,11 +126,11 @@ void checkselections()
87
 void makesel(bool isnew)
88
 {
89
     block &cursel = sels.last(); //RR 10/12/12 - FIXEME, error checking should happen with "isnew", not here checking if it really is new.
90
-    if(isnew || sels.length() == 0) addselection(min(lastx, cx), min(lasty, cy), abs(lastx-cx)+1, abs(lasty-cy)+1, max(lasth, ch));
91
+    if(isnew || sels.length() == 0) addselection(min(lastx, cx), min(lasty, cy), iabs(lastx-cx)+1, iabs(lasty-cy)+1, max(lasth, ch));
92
     else
93
     {
94
         cursel.x = min(lastx, cx); cursel.y = min(lasty, cy);
95
-        cursel.xs = abs(lastx-cx)+1; cursel.ys = abs(lasty-cy)+1;
96
+        cursel.xs = iabs(lastx-cx)+1; cursel.ys = iabs(lasty-cy)+1;
97
         cursel.h = max(lasth, ch);
98
         correctsel(cursel);
99
     }
100
@@ -645,7 +645,7 @@ void movemap(int xo, int yo, int zo) // 
101
     }
102
     if(xo || yo)
103
     {
104
-        block b = { max(-xo, 0), max(-yo, 0), ssize - abs(xo), ssize - abs(yo) }, *cp = blockcopy(b);
105
+        block b = { max(-xo, 0), max(-yo, 0), ssize - iabs(xo), ssize - iabs(yo) }, *cp = blockcopy(b);
106
         cp->x = max(xo, 0);
107
         cp->y = max(yo, 0);
108
         blockpaste(*cp);
109
--- source/src/entity.h.orig	2013-10-22 18:57:16 UTC
110
+++ source/src/entity.h
111
@@ -540,7 +540,7 @@ public:
112
     {
113
         const int maxskin[2] = { 4, 6 };
114
         t = team_base(t < 0 ? team : t);
115
-        nextskin[t] = abs(s) % maxskin[t];
116
+        nextskin[t] = iabs(s) % maxskin[t];
117
     }
118
 };
119
 
120
--- source/src/main.cpp.orig	2013-10-29 09:33:15 UTC
121
+++ source/src/main.cpp
122
@@ -513,11 +513,11 @@ void setresdata(char *s, enet_uint32 c)
123
 COMMANDF(screenres, "ii", (int *w, int *h) { screenres(*w, *h); });
124
 
125
 static int curgamma = 100;
126
-VARFP(gamma, 30, 100, 300,
127
+VARNFP(gamma, vgamma, 30, 100, 300,
128
 {
129
-    if(gamma == curgamma) return;
130
-    curgamma = gamma;
131
-    float f = gamma/100.0f;
132
+    if(vgamma == curgamma) return;
133
+    curgamma = vgamma;
134
+    float f = vgamma/100.0f;
135
     if(SDL_SetGamma(f,f,f)==-1) conoutf("Could not set gamma: %s", SDL_GetError());
136
 });
137
 
138
--- source/src/platform.h.orig	2013-10-22 18:57:19 UTC
139
+++ source/src/platform.h
140
@@ -2,14 +2,6 @@
141
     #ifdef _FORTIFY_SOURCE
142
         #undef _FORTIFY_SOURCE
143
     #endif
144
-
145
-    #define gamma __gamma
146
-#endif
147
-
148
-#include <math.h>
149
-
150
-#ifdef __GNUC__
151
-    #undef gamma
152
 #endif
153
 
154
 #include <string.h>
155
@@ -19,6 +11,7 @@
156
 #include <ctype.h>
157
 #include <time.h>
158
 #include <limits.h>
159
+#include <math.h>
160
 #ifdef __GNUC__
161
     #include <new>
162
     #include <signal.h>
163
--- source/src/rendercubes.cpp.orig	2013-10-22 18:57:16 UTC
164
+++ source/src/rendercubes.cpp
165
@@ -202,9 +202,9 @@ void render_flat(int wtex, int x, int y,
166
     else        // continue strip
167
     {
168
         int lighterr = lighterror*2;
169
-        if((abs(ol1r-l3->r)<lighterr && abs(ol2r-l4->r)<lighterr        // skip vertices if light values are close enough
170
-        &&  abs(ol1g-l3->g)<lighterr && abs(ol2g-l4->g)<lighterr
171
-        &&  abs(ol1b-l3->b)<lighterr && abs(ol2b-l4->b)<lighterr) || !wtex)
172
+        if((iabs(ol1r-l3->r)<lighterr && iabs(ol2r-l4->r)<lighterr        // skip vertices if light values are close enough
173
+        &&  iabs(ol1g-l3->g)<lighterr && iabs(ol2g-l4->g)<lighterr
174
+        &&  iabs(ol1b-l3->b)<lighterr && iabs(ol2b-l4->b)<lighterr) || !wtex)
175
         {
176
             verts.setsize(verts.length()-2);
177
             nquads--;
178
@@ -361,7 +361,7 @@ void render_square(int wtex, float floor
179
     {
180
         int lighterr = lighterror*2;
181
         if((!hf && !ohf)
182
-        && ((abs(ol1r-l2->r)<lighterr && abs(ol1g-l2->g)<lighterr && abs(ol1b-l2->b)<lighterr) || !wtex))       // skip vertices if light values are close enough
183
+        && ((iabs(ol1r-l2->r)<lighterr && iabs(ol1g-l2->g)<lighterr && iabs(ol1b-l2->b)<lighterr) || !wtex))       // skip vertices if light values are close enough
184
         {
185
             verts.setsize(verts.length()-2);
186
             nquads--;
187
--- source/src/rendertext.cpp.orig	2013-10-22 18:57:16 UTC
188
+++ source/src/rendertext.cpp
189
@@ -330,7 +330,7 @@ static void text_color(char c, char *sta
190
         if(c=='r') c = stack[(sp > 0) ? --sp : sp]; // restore color
191
         else if(c == 'b') { if(allowblinkingtext && !ignoreblinkingbit) stack[sp] *= -1; } // blinking text - only if allowed
192
         else stack[sp] = c;
193
-        switch(abs(stack[sp]))
194
+        switch(iabs(stack[sp]))
195
         {
196
             case '0': color = bvec( 2,  255,  128 ); break;   // green: player talk
197
             case '1': color = bvec( 96,  160, 255 ); break;   // blue: team chat
198
@@ -380,7 +380,7 @@ static void text_color(char c, char *sta
199
             //default: color = bvec( 255, 255, 255 ); break;
200
         }
201
         int b = (int) (sinf(lastmillis / 200.0f) * 115.0f);
202
-        b = stack[sp] > 0 ? 100 : min(abs(b), 100);
203
+        b = stack[sp] > 0 ? 100 : min(iabs(b), 100);
204
         glColor4ub(color.x, color.y, color.z, (a * b) / 100);
205
     }
206
 }
207
--- source/src/tools.h.orig	2013-10-22 18:57:19 UTC
208
+++ source/src/tools.h
209
@@ -54,8 +54,7 @@ static inline T min(T a, T b)
210
 {
211
     return a < b ? a : b;
212
 }
213
-
214
-static inline float round(float x) { return floor(x + 0.5f); }
215
+inline int iabs(int n) { return labs(n); }
216
 
217
 #define clamp(a,b,c) (max(b, min(a, c)))
218
 #define rnd(x) ((int)(randomMT()&0xFFFFFF)%(x))
219
--- source/src/world.cpp.orig	2013-10-22 18:57:19 UTC
220
+++ source/src/world.cpp
221
@@ -79,9 +79,9 @@ void remip(const block &b, int level)
222
                 || o[i]->ceil!=o[3]->ceil
223
                 || o[i]->ftex!=o[3]->ftex
224
                 || o[i]->ctex!=o[3]->ctex
225
-                || abs(o[i+1]->r-o[0]->r)>lighterr          // perfect mip even if light is not exactly equal
226
-                || abs(o[i+1]->g-o[0]->g)>lighterr
227
-                || abs(o[i+1]->b-o[0]->b)>lighterr
228
+                || iabs(o[i+1]->r-o[0]->r)>lighterr          // perfect mip even if light is not exactly equal
229
+                || iabs(o[i+1]->g-o[0]->g)>lighterr
230
+                || iabs(o[i+1]->b-o[0]->b)>lighterr
231
                 || o[i]->utex!=o[3]->utex
232
                 || o[i]->wtex!=o[3]->wtex) goto c;
233
             }
234
--- source/src/worldrender.cpp.orig	2013-10-09 08:27:37 UTC
235
+++ source/src/worldrender.cpp
236
@@ -270,10 +270,10 @@ void distlod(int &low, int &high, int an
237
 void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float fov, float fovy, int w, int h)
238
 {
239
     loopi(LARGEST_FACTOR) stats[i] = 0;
240
-    min_lod = minimap || (player1->isspectating() && player1->spectatemode == SM_OVERVIEW) ? MAX_LOD : MIN_LOD+abs(pitch)/12;
241
+    min_lod = minimap || (player1->isspectating() && player1->spectatemode == SM_OVERVIEW) ? MAX_LOD : MIN_LOD+iabs(pitch)/12;
242
     yaw = 360-yaw;
243
     float widef = fov/75.0f;
244
-    int cdist = abs(yaw%90-45);
245
+    int cdist = iabs(yaw%90-45);
246
     if(cdist<7)    // hack to avoid popup at high fovs at 45 yaw
247
     {
248
         min_lod = max(min_lod, (int)(MIN_LOD+(10-cdist)/1.0f*widef)); // less if lod worked better
249
--- source/src/zip.cpp.orig	2013-10-22 18:57:19 UTC
250
+++ source/src/zip.cpp
251
@@ -550,7 +550,7 @@ struct zipstream : stream
252
 bool extractzipfile(ziparchive *a, zipfile *f, const char *name)
253
 {
254
     zipstream *s = new zipstream;
255
-    FILE *target;
256
+    FILE *target = NULL;
257
     defformatstring(fname)("%s", findfile(name, "wb"));
258
     preparedir(fname);
259
     bool error = false;
(-)assaultcube/files/patch-source_src_bot_bot_waypoint.cpp (-11 lines)
Lines 1-11 Link Here
1
--- source/src/bot/bot_waypoint.cpp.orig	2013-11-10 18:50:03 UTC
2
+++ source/src/bot/bot_waypoint.cpp
3
@@ -848,7 +848,7 @@
4
 
5
      if (!pWP)
6
      {
7
-          conoutf("Error: CouldnĀ“t find near waypoint");
8
+          conoutf("Error: Couldn't find near waypoint");
9
           return;
10
      }
11
 

Return to bug 208754