From 86c9f84df820d1f943df6bf7277a3304d24f22e7 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 12 Dec 2018 02:49:23 +0100 Subject: [PATCH] now compiles in C++11 --- crystal.cpp | 17 +++++++++++------ hyper.h | 3 ++- rug.cpp | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/crystal.cpp b/crystal.cpp index 9c844d88..d997635d 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -147,7 +147,9 @@ struct crystal_structure { next_insert(a, prev[a][at], val); } - int errors = 0; + int errors; + + crystal_structure() { errors = 0; } bool may_next_insert(int a, int at, int val) { if(isize(next[a]) != dir) { @@ -407,9 +409,12 @@ struct hrmap_crystal : hrmap { } ldcoord get_coord(cell *c) { - auto b = sgc.emplace(c, ldc0); - ldcoord& res = b.first->second; - if(b.second) { + // in C++14? + // auto b = sgc.emplace(c, ldc0); + // ldcoord& res = b.first->second; + if(sgc.count(c)) return sgc[c]; + ldcoord& res = (sgc[c] = ldc0); + { // if(b.second) { if(BITRUNCATED && c->master->c7 != c) { for(int i=0; itype; i+=2) res = res + told(hcoords[c->cmove(i)->master]); @@ -486,8 +491,8 @@ void create_step(heptagon *h, int d) { } array, MAX_EDGE> distlimit_table = {{ - {SEE_ALL,SEE_ALL}, {SEE_ALL,SEE_ALL}, {SEE_ALL,SEE_ALL}, {SEE_ALL,SEE_ALL}, {15, 10}, - {6, 4}, {5, 3}, {4, 3}, {4, 3}, {3, 2}, {3, 2}, {3, 2}, {3, 2}, {3, 2} + {{SEE_ALL,SEE_ALL}}, {{SEE_ALL,SEE_ALL}}, {{SEE_ALL,SEE_ALL}}, {{SEE_ALL,SEE_ALL}}, {{15, 10}}, + {{6, 4}}, {{5, 3}}, {{4, 3}}, {{4, 3}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}} }}; color_t colorize(cell *c) { diff --git a/hyper.h b/hyper.h index 8855bc68..153b4e46 100644 --- a/hyper.h +++ b/hyper.h @@ -4334,7 +4334,8 @@ inline void special_log(char c) { putchar(c); } struct logger : hstream { int indentation; - bool doindent = false; + bool doindent; + logger() { doindent = false; } virtual void write_char(char c) { if(doindent) { doindent = false; for(int i=0; i stats = {0,0,0}; + array stats = {{0,0,0}}; map > code_to_point; for(auto p: points) if(p->valid)