1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-30 15:39:54 +00:00

Fix a couple of issues in MSVC related to min and max.

MSVC apparently thinks that the result of arithmetic promotions
on an `unsigned:4` bitfield is `unsigned`, not `int`; which then
causes it to fail to deduce whether the `T` in `min<T>` should be
`unsigned` (the type of the LHS) or `int` (the type of the RHS).
Clang and GCC agree that the result of arithmetic promotions on
an `unsigned:4` bitfield should be `int`, so they don't see any
ambiguity here.
This commit is contained in:
Arthur O'Dwyer 2018-07-07 10:24:11 -07:00
parent eac2ce1168
commit f10f5a29b2
2 changed files with 2 additions and 1 deletions

View File

@ -1848,7 +1848,7 @@ void stunMonster(cell *c2) {
int newtime = ( int newtime = (
c2->monst == moFatGuard ? 2 : c2->monst == moFatGuard ? 2 :
c2->monst == moSkeleton && c2->land != laPalace && c2->land != laHalloween ? 7 : c2->monst == moSkeleton && c2->land != laPalace && c2->land != laHalloween ? 7 :
c2->monst == moTerraWarrior ? min(c2->stuntime + 8 - c2->hitpoints, 7) : c2->monst == moTerraWarrior ? min(int(c2->stuntime + 8 - c2->hitpoints), 7) :
isMetalBeast(c2->monst) ? 7 : isMetalBeast(c2->monst) ? 7 :
c2->monst == moTortoise ? 7 : c2->monst == moTortoise ? 7 :
c2->monst == moReptile ? 7 : c2->monst == moReptile ? 7 :

View File

@ -253,6 +253,7 @@
#if ISWINDOWS #if ISWINDOWS
#define hyper fake_hyper // avoid "hyper" typedef in <_mingw.h> #define hyper fake_hyper // avoid "hyper" typedef in <_mingw.h>
#define WIN32_LEAN_AND_MEAN // avoid "rad1" macro in <windows.h> #define WIN32_LEAN_AND_MEAN // avoid "rad1" macro in <windows.h>
#define NOMINMAX // avoid "min" and "max" macros in <windows.h>
#endif #endif
#include <stdio.h> #include <stdio.h>