1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-03 11:17:56 +00:00

Change static const to static constexpr wherever possible

Since we require C++11, most of these consts can be constexpr.

Two `static const ld` remain non-compile-time-evaluable because
they depend on the runtime `log` function. One `static const cld`
remains non-compile-time because `std::complex<T>` doesn't become
constexpr until C++14.
This commit is contained in:
Arthur O'Dwyer
2023-08-23 09:44:37 -08:00
parent b70b339f52
commit 62629f3e70
48 changed files with 453 additions and 458 deletions

View File

@@ -22,7 +22,7 @@ struct usershapelayer {
extern int usershape_changes;
static const int USERLAYERS = 32;
static constexpr int USERLAYERS = 32;
struct usershape { usershapelayer d[USERLAYERS]; };
@@ -57,15 +57,15 @@ struct hpcshape {
#define GOLDBERG_BITS 5
#endif
static const int GOLDBERG_LIMIT = (1<<GOLDBERG_BITS);
static const int GOLDBERG_MASK = (GOLDBERG_LIMIT-1);
static constexpr int GOLDBERG_LIMIT = (1<<GOLDBERG_BITS);
static constexpr int GOLDBERG_MASK = (GOLDBERG_LIMIT-1);
#ifndef BADMODEL
#define BADMODEL 0
#endif
#ifndef WINGS
static const int WINGS = (BADMODEL ? 1 : 4);
static constexpr int WINGS = (BADMODEL ? 1 : 4);
#endif
typedef array<hpcshape, WINGS+1> hpcshape_animated;
@@ -571,7 +571,7 @@ EX void add_wall(int i, const vector<hyperpoint>& h) {
*/
#if HDR
static const ld hcrossf7 = 0.620672, hexf7 = 0.378077, tessf7 = 1.090550, hexhexdist7 = 0.566256;
static constexpr ld hcrossf7 = 0.620672, hexf7 = 0.378077, tessf7 = 1.090550, hexhexdist7 = 0.566256;
#endif
EX bool scale_used() { return (shmup::on && geometry == gNormal && BITRUNCATED) ? (cheater || autocheat) : true; }