ufoai: fix gcc6 build

This commit is contained in:
Jürgen Buchmüller 2017-01-25 16:32:33 +01:00
parent dc90e0ed6a
commit 96808434c5
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,39 @@
With gcc6 this logic error needs to be fixed. I think
the intention here was to continue, if FS_CheckFile() fails.
--- src/client/battlescape/events/e_main.cpp 2014-06-05 06:18:39.000000000 +0200
+++ src/client/battlescape/events/e_main.cpp 2017-01-25 16:18:47.764221448 +0100
@@ -221,7 +221,7 @@
return sound;
for (int i = 1; i <= 99; i++) {
- if (!FS_CheckFile("sounds/%s%02i", sound, i) == -1)
+ if (!FS_CheckFile("sounds/%s%02i", sound, i))
continue;
sound[length] = '\0';
Q_strcat(sound, size, "%02i", rand() % i + 1);
With gcc6 the checks for narrowing integer types are very strict.
Explicitly cast the flag combinations to int.
--- src/client/battlescape/cl_particle.cpp 2014-06-05 06:18:39.000000000 +0200
+++ src/client/battlescape/cl_particle.cpp 2017-01-25 16:23:44.737146135 +0100
@@ -144,12 +144,17 @@
V_UNTYPED, V_UNTYPED, V_UNTYPED,
V_VECS, V_VECS,
V_VECS, V_VECS,
- PTL_ONLY_ONE_TYPE | V_FLOAT, PTL_ONLY_ONE_TYPE | V_FLOAT, PTL_ONLY_ONE_TYPE | V_FLOAT,
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_FLOAT),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_FLOAT),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_FLOAT),
V_VECS, V_VECS,
0, 0, 0,
0,
- PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING)
};
CASSERT(lengthof(pc_types) == PC_NUM_PTLCMDS);

View File

@ -0,0 +1,15 @@
--- src/client/renderer/r_program.h 2014-06-05 06:18:39.000000000 +0200
+++ src/client/renderer/r_program.h 2017-01-25 16:15:42.467269009 +0100
@@ -30,8 +30,12 @@
char name[MAX_QPATH];
} r_shader_t;
+#if !defined(GL_UNIFORM)
#define GL_UNIFORM 1
+#endif
+#if !defined(GL_ATTRIBUTE)
#define GL_ATTRIBUTE 2
+#endif
/* program variables */
typedef struct r_progvar_s {
GLint type;