mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-28 13:43:20 +00:00
Fix bugs and C++ compilance
- use 'noexcept' for constexpr - allocate dynamic array - enable CAP_TEXTURE on CAP_ROGUEVIZ
This commit is contained in:
parent
99e3b25560
commit
5e8839f3a9
2
Makefile
2
Makefile
@ -128,7 +128,7 @@ endif
|
|||||||
ifeq (${HYPERROGUE_USE_ROGUEVIZ},1)
|
ifeq (${HYPERROGUE_USE_ROGUEVIZ},1)
|
||||||
# Enable RogueViz. RogueViz requires C++17.
|
# Enable RogueViz. RogueViz requires C++17.
|
||||||
CXXFLAGS_STD = -std=c++17
|
CXXFLAGS_STD = -std=c++17
|
||||||
CXXFLAGS_EARLY += -DCAP_ROGUEVIZ=1
|
CXXFLAGS_EARLY += -DCAP_ROGUEVIZ=1 -DCAP_TEXTURE=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ namespace hr {
|
|||||||
static constexpr ld A_PI = M_PI;
|
static constexpr ld A_PI = M_PI;
|
||||||
static constexpr ld TAU = 2 * A_PI;
|
static constexpr ld TAU = 2 * A_PI;
|
||||||
static constexpr ld degree = A_PI / 180;
|
static constexpr ld degree = A_PI / 180;
|
||||||
static constexpr ld golden_phi = (sqrt(5)+1)/2;
|
static constexpr ld golden_phi = noexcept((sqrt(5)+1)/2);
|
||||||
static constexpr ld log_golden_phi = log(golden_phi);
|
static constexpr ld log_golden_phi = noexcept(log(golden_phi));
|
||||||
|
|
||||||
constexpr ld operator"" _deg(long double deg) { return deg * A_PI / 180; }
|
constexpr ld operator"" _deg(long double deg) { return deg * A_PI / 180; }
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,7 +139,7 @@ void cellcoords() {
|
|||||||
// needs cellcoords/rvcoords/origcoords
|
// needs cellcoords/rvcoords/origcoords
|
||||||
void build_disttable() {
|
void build_disttable() {
|
||||||
indenter_finish im("build_disttable");
|
indenter_finish im("build_disttable");
|
||||||
int tab[N];
|
std::vector<int> tab(N);
|
||||||
for(int i=0; i<N; i++) tab[i] = N;
|
for(int i=0; i<N; i++) tab[i] = N;
|
||||||
disttable0.clear();
|
disttable0.clear();
|
||||||
disttable1.clear();
|
disttable1.clear();
|
||||||
@ -269,7 +269,7 @@ void writestats() {
|
|||||||
ld placement_loglik = loglik_placement();
|
ld placement_loglik = loglik_placement();
|
||||||
|
|
||||||
for(int u=0; u<MAXDIST; u++) if(tally[u]) {
|
for(int u=0; u<MAXDIST; u++) if(tally[u]) {
|
||||||
println(hlog, format("* %4d: %8d / %12Ld = %lf %.10" PLDF " %.10" PLDF,
|
println(hlog, format("* %4d: %8d / %12lld = %lf %.10" PLDF " %.10" PLDF,
|
||||||
u, edgetally[u], tally[u], double(edgetally[u]) / tally[u],
|
u, edgetally[u], tally[u], double(edgetally[u]) / tally[u],
|
||||||
saved_logistic.yes(u), current_logistic.yes(u)));
|
saved_logistic.yes(u), current_logistic.yes(u)));
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ void build_disttable_approx() {
|
|||||||
for(int k=0; k<threads; k++)
|
for(int k=0; k<threads; k++)
|
||||||
v.emplace_back([&,k] () {
|
v.emplace_back([&,k] () {
|
||||||
auto& dt = results[k];
|
auto& dt = results[k];
|
||||||
int tab[N];
|
std::vector<int> tab(N);
|
||||||
for(int i=0; i<N; i++) tab[i] = N;
|
for(int i=0; i<N; i++) tab[i] = N;
|
||||||
auto p = k ? nullptr : new progressbar(N/threads, "build_disttable_approx");
|
auto p = k ? nullptr : new progressbar(N/threads, "build_disttable_approx");
|
||||||
for(int i=k; i<N; i+=threads) {
|
for(int i=k; i<N; i+=threads) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user