mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-21 00:47:40 +00:00
Minor fixes for Mac and MinGW.
Eliminate a format-string warning by using less template magic: https://stackoverflow.com/questions/12573968/how-to-use-gccs-printf-format-attribute-with-c11-variadic-templates Fix one `%Ld` in `rogueviz.cpp` that should have been `%lld`. Rename `savepng.c` into `savepng.cpp` so that we don't have to care about the system's C compiler; it builds fine using the same C++ options as HyperRogue itself. Figure out how to get `-DCAP_PNG` and `-DCAP_ROGUEVIZ` working on Mac, and document them. Assume that roughly the same things should also work on MinGW. Consistency on `STDSIZE`, even though it doesn't suffice for C++17 conformance. It *almost* suffices; the one place where Clang still complains even with `-std=c++17 -DSTDSIZE -Wno-sign-compare` is here: ./fieldpattern.cpp:757:51: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing] ex.primes.emplace_back(primeinfo{nextprime, size(fp.matrices) / S7, (bool) fp.wsquare}); ^~~~~~~~~~~~~~~~~~~~~~ So, we fix that up too, in this patch.
This commit is contained in:
16
hyper.h
16
hyper.h
@@ -6,6 +6,8 @@
|
||||
#define VERNUM 10402
|
||||
#define VERNUM_HEX 0xA0B2
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace hr {
|
||||
|
||||
using namespace std;
|
||||
@@ -368,7 +370,7 @@ string its(int i);
|
||||
int hrand(int i);
|
||||
|
||||
#ifndef STDSIZE
|
||||
template<class T> int size(const T& x) {return int(x.size()); }
|
||||
template<class T> int size(const T& x) {return x.size(); }
|
||||
#endif
|
||||
|
||||
// initialize the achievement system.
|
||||
@@ -3432,7 +3434,15 @@ int score_default(int id);
|
||||
void handle_event(SDL_Event& ev);
|
||||
|
||||
#ifndef XPRINTF
|
||||
template<class...T> void Xprintf(const char *fmt, T... t) { printf(fmt, t...); }
|
||||
#ifdef __GNUC__
|
||||
__attribute__((__format__ (__printf__, 1, 2)))
|
||||
#endif
|
||||
void Xprintf(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
||||
void pop_game();
|
||||
@@ -3502,4 +3512,4 @@ void gdpush(int t);
|
||||
|
||||
extern int fontscale;
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user