mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-08-30 17:27:57 +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:
18
complex.cpp
18
complex.cpp
@@ -1172,10 +1172,10 @@ EX namespace whirlpool {
|
||||
EX namespace mirror {
|
||||
|
||||
#if HDR
|
||||
static const int SPINSINGLE = 1;
|
||||
static const int SPINMULTI = 2;
|
||||
static const int GO = 4;
|
||||
static const int ATTACK = 8;
|
||||
static constexpr int SPINSINGLE = 1;
|
||||
static constexpr int SPINMULTI = 2;
|
||||
static constexpr int GO = 4;
|
||||
static constexpr int ATTACK = 8;
|
||||
#endif
|
||||
|
||||
EX bool build(cell *c) {
|
||||
@@ -1633,8 +1633,8 @@ EX namespace mirror {
|
||||
return cw;
|
||||
}
|
||||
|
||||
static const int CACHESIZE = 1<<12; // must be a power of 2
|
||||
static const int CACHEMASK = CACHESIZE-1;
|
||||
static constexpr int CACHESIZE = 1<<12; // must be a power of 2
|
||||
static constexpr int CACHEMASK = CACHESIZE-1;
|
||||
|
||||
pair<cell*, cellwalker> cache[CACHESIZE];
|
||||
int nextcache;
|
||||
@@ -3369,7 +3369,7 @@ namespace prairie {
|
||||
|
||||
EX namespace ca {
|
||||
EX ld prob = .2;
|
||||
static const int MAX_NEIGHBOR = 60; /* may be larger than MAX_EDGE due to mineadj */
|
||||
static constexpr int MAX_NEIGHBOR = 60; /* may be larger than MAX_EDGE due to mineadj */
|
||||
string carule[MAX_NEIGHBOR][2];
|
||||
|
||||
EX eWall wlive = waFloorA;
|
||||
@@ -3542,8 +3542,8 @@ int windcodes5676[] = {152,138,172,172,141,158,157,124,119,130,125,143,190,206,2
|
||||
EX namespace windmap {
|
||||
|
||||
#if HDR
|
||||
static const int NOWINDBELOW = 8;
|
||||
static const int NOWINDFROM = 120;
|
||||
static constexpr int NOWINDBELOW = 8;
|
||||
static constexpr int NOWINDFROM = 120;
|
||||
#endif
|
||||
|
||||
map<int, int> getid;
|
||||
|
Reference in New Issue
Block a user