conflict resolved

This commit is contained in:
Zeno Rogue 2021-07-12 09:55:25 +02:00
commit 7c9bea6e1b
24 changed files with 144 additions and 192 deletions

View File

@ -84,6 +84,7 @@ ifeq (${TOOLCHAIN},clang)
CXXFLAGS_EARLY += -march=native -fPIC CXXFLAGS_EARLY += -march=native -fPIC
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic
CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option
CXXFLAGS_EARLY += -Wno-invalid-offsetof -Wno-overloaded-virtua
endif endif
ifeq (${TOOLCHAIN},gcc) ifeq (${TOOLCHAIN},gcc)

View File

@ -2001,8 +2001,8 @@ EX void generate_mines() {
for(cell *c: currentmap->allcells()) for(cell *c: currentmap->allcells())
if(c->wall == waMineUnknown) if(c->wall == waMineUnknown)
candidates.push_back(c); candidates.push_back(c);
hrandom_shuffle(candidates);
bounded_mine_max = isize(candidates); bounded_mine_max = isize(candidates);
hrandom_shuffle(&candidates[0], bounded_mine_max);
bounded_mine_quantity = int(bounded_mine_max * bounded_mine_percentage + 0.5); bounded_mine_quantity = int(bounded_mine_max * bounded_mine_percentage + 0.5);
for(int i=0; i<bounded_mine_quantity; i++) candidates[i]->wall = waMineMine; for(int i=0; i<bounded_mine_quantity; i++) candidates[i]->wall = waMineMine;
} }

View File

@ -2510,9 +2510,9 @@ void celldrawer::add_map_effects() {
} }
void celldrawer::draw_gravity_particles() { void celldrawer::draw_gravity_particles() {
int u = (int)(size_t)(c); unsigned int u = (unsigned int)(size_t)(c);
u = ((u * 137) + (u % 1000) * 51) % 1000; u = ((u * 137) + (u % 1000) * 51) % 1000;
int tt = ticks + u; fractick(ticks, 900); int tt = ticks + u;
ld r0 = (tt % 900) / 1100.; ld r0 = (tt % 900) / 1100.;
ld r1 = (tt % 900 + 200) / 1100.; ld r1 = (tt % 900 + 200) / 1100.;

View File

@ -1847,7 +1847,7 @@ EX namespace hive {
} }
} }
hrandom_shuffle(&bugtomove[0], isize(bugtomove)); hrandom_shuffle(bugtomove);
sort(bugtomove.begin(), bugtomove.end()); sort(bugtomove.begin(), bugtomove.end());
int battlecount = 0; int battlecount = 0;
@ -3611,7 +3611,7 @@ EX namespace windmap {
vector<bool> inqueue(N, true); vector<bool> inqueue(N, true);
vector<int> tocheck; vector<int> tocheck;
for(int i=0; i<N; i++) tocheck.push_back(i); for(int i=0; i<N; i++) tocheck.push_back(i);
hrandom_shuffle(&tocheck[0], isize(tocheck)); hrandom_shuffle(tocheck);
for(int a=0; a<isize(tocheck); a++) { for(int a=0; a<isize(tocheck); a++) {
if(a >= 200*N) { printf("does not converge\n"); break; } if(a >= 200*N) { printf("does not converge\n"); break; }

View File

@ -852,7 +852,7 @@ EX void ambush(cell *c, int dogs) {
int v = valence(); int v = valence();
if(v > 4) { if(v > 4) {
for(cell *c: cl.lst) if(cl.getdist(c) == d) around.push_back(c); for(cell *c: cl.lst) if(cl.getdist(c) == d) around.push_back(c);
hrandom_shuffle(&around[0], isize(around)); hrandom_shuffle(around);
} }
else { else {
for(int tries=0; tries<10000; tries++) { for(int tries=0; tries<10000; tries++) {

View File

@ -27,9 +27,9 @@ struct supersaver {
virtual void load(const string& s) = 0; virtual void load(const string& s) = 0;
virtual bool dosave() = 0; virtual bool dosave() = 0;
virtual void reset() = 0; virtual void reset() = 0;
virtual ~supersaver() {}
virtual bool affects(void* v) { return false; } virtual bool affects(void* v) { return false; }
virtual void set_default() = 0; virtual void set_default() = 0;
virtual ~supersaver() = default;
}; };
typedef vector<shared_ptr<supersaver>> saverlist; typedef vector<shared_ptr<supersaver>> saverlist;
@ -56,7 +56,7 @@ struct setting {
return parameter_name + "|" + config_name + "|" + menu_item_name + "|" + help_text; return parameter_name + "|" + config_name + "|" + menu_item_name + "|" + help_text;
} }
virtual cld get_cld() = 0; virtual cld get_cld() = 0;
setting() { restrict = auto_restrict; is_editable = false; } explicit setting() { restrict = auto_restrict; is_editable = false; }
virtual void check_change() { virtual void check_change() {
cld val = get_cld(); cld val = get_cld();
if(val != last_value) { if(val != last_value) {
@ -68,7 +68,7 @@ struct setting {
setting *set_sets(const reaction_t& s) { sets = s; return this; } setting *set_sets(const reaction_t& s) { sets = s; return this; }
setting *set_extra(const reaction_t& r); setting *set_extra(const reaction_t& r);
setting *set_reaction(const reaction_t& r); setting *set_reaction(const reaction_t& r);
virtual ~setting() {} virtual ~setting() = default;
virtual void load_from(const string& s) { virtual void load_from(const string& s) {
println(hlog, "cannot load this parameter"); println(hlog, "cannot load this parameter");
exit(1); exit(1);
@ -100,7 +100,7 @@ struct list_setting : setting {
default_key = key; default_key = key;
return this; return this;
} }
virtual void show_edit_option(char key) override; void show_edit_option(char key) override;
}; };
template<class T> struct enum_setting : list_setting { template<class T> struct enum_setting : list_setting {
@ -108,10 +108,10 @@ template<class T> struct enum_setting : list_setting {
T dft; T dft;
int get_value() override { return (int) *value; } int get_value() override { return (int) *value; }
void set_value(int i) override { *value = (T) i; } void set_value(int i) override { *value = (T) i; }
virtual bool affects(void* v) override { return v == value; } bool affects(void* v) override { return v == value; }
virtual void add_as_saver() override; void add_as_saver() override;
virtual cld get_cld() override { return get_value(); } cld get_cld() override { return get_value(); }
virtual void load_from(const string& s) override { void load_from(const string& s) override {
*value = (T) parseint(s); *value = (T) parseint(s);
} }
}; };
@ -134,11 +134,10 @@ struct float_setting : public setting {
function<void(float_setting*)> modify_me; function<void(float_setting*)> modify_me;
float_setting *modif(const function<void(float_setting*)>& r) { modify_me = r; return this; } float_setting *modif(const function<void(float_setting*)>& r) { modify_me = r; return this; }
void add_as_saver() override; void add_as_saver() override;
virtual bool affects(void *v) override { return v == value; } bool affects(void *v) override { return v == value; }
virtual void show_edit_option(char key) override; void show_edit_option(char key) override;
virtual cld get_cld() override { return *value; } cld get_cld() override { return *value; }
void load_from(const string& s) override;
virtual void load_from(const string& s) override;
}; };
struct int_setting : public setting { struct int_setting : public setting {
@ -149,9 +148,9 @@ struct int_setting : public setting {
void add_as_saver() override; void add_as_saver() override;
function<void(int_setting*)> modify_me; function<void(int_setting*)> modify_me;
int_setting *modif(const function<void(int_setting*)>& r) { modify_me = r; return this; } int_setting *modif(const function<void(int_setting*)>& r) { modify_me = r; return this; }
virtual bool affects(void *v) override { return v == value; } bool affects(void *v) override { return v == value; }
virtual void show_edit_option(char key) override; void show_edit_option(char key) override;
virtual cld get_cld() override { return *value; } cld get_cld() override { return *value; }
int_setting *editable(int min_value, int max_value, ld step, string menu_item_name, string help_text, char key) { int_setting *editable(int min_value, int max_value, ld step, string menu_item_name, string help_text, char key) {
this->min_value = min_value; this->min_value = min_value;
this->max_value = max_value; this->max_value = max_value;
@ -162,7 +161,7 @@ struct int_setting : public setting {
return this; return this;
} }
virtual void load_from(const string& s) override { void load_from(const string& s) override {
*value = parseint(s); *value = parseint(s);
} }
}; };
@ -176,10 +175,10 @@ struct bool_setting : public setting {
is_editable = true; is_editable = true;
menu_item_name = cap; default_key = key; return this; menu_item_name = cap; default_key = key; return this;
} }
virtual bool affects(void *v) override { return v == value; } bool affects(void *v) override { return v == value; }
virtual void show_edit_option(char key) override; void show_edit_option(char key) override;
virtual cld get_cld() override { return *value ? 1 : 0; } cld get_cld() override { return *value ? 1 : 0; }
virtual void load_from(const string& s) override { void load_from(const string& s) override {
*value = parseint(s); *value = parseint(s);
} }
}; };
@ -188,9 +187,9 @@ struct custom_setting : public setting {
function<void(char)> custom_viewer; function<void(char)> custom_viewer;
function<cld()> custom_value; function<cld()> custom_value;
function<bool(void*)> custom_affect; function<bool(void*)> custom_affect;
virtual void show_edit_option(char key) override { custom_viewer(key); } void show_edit_option(char key) override { custom_viewer(key); }
virtual cld get_cld() override { return custom_value(); } cld get_cld() override { return custom_value(); }
virtual bool affects(void *v) override { return custom_affect(v); } bool affects(void *v) override { return custom_affect(v); }
}; };
#if CAP_CONFIG #if CAP_CONFIG
@ -198,11 +197,11 @@ struct custom_setting : public setting {
template<class T> struct dsaver : supersaver { template<class T> struct dsaver : supersaver {
T& val; T& val;
T dft; T dft;
bool dosave() { return val != dft; } bool dosave() override { return val != dft; }
void reset() { val = dft; } void reset() override { val = dft; }
dsaver(T& val) : val(val) { } explicit dsaver(T& val) : val(val) { }
bool affects(void* v) { return v == &val; } bool affects(void* v) override { return v == &val; }
void set_default() { dft = val; } void set_default() override { dft = val; }
}; };
template<class T> struct saver : dsaver<T> {}; template<class T> struct saver : dsaver<T> {};
@ -233,13 +232,13 @@ template<class T> void set_saver_default(T& val) {
template<class T> struct saverenum : supersaver { template<class T> struct saverenum : supersaver {
T& val; T& val;
T dft; T dft;
bool dosave() { return val != dft; } explicit saverenum(T& v) : val(v) { }
void reset() { val = dft; } bool dosave() override { return val != dft; }
saverenum<T>(T& v) : val(v) { } void reset() override { val = dft; }
string save() { return its(int(val)); } string save() override { return its(int(val)); }
void load(const string& s) { val = (T) atoi(s.c_str()); } void load(const string& s) override { val = (T) atoi(s.c_str()); }
virtual bool affects(void* v) { return v == &val; } bool affects(void* v) override { return v == &val; }
virtual void set_default() { dft = val; } void set_default() override { dft = val; }
}; };
template<class T, class U> void addsaverenum(T& i, U name, T dft) { template<class T, class U> void addsaverenum(T& i, U name, T dft) {
@ -254,39 +253,39 @@ template<class T, class U> void addsaverenum(T& i, U name) {
} }
template<> struct saver<int> : dsaver<int> { template<> struct saver<int> : dsaver<int> {
saver<int>(int& val) : dsaver<int>(val) { } explicit saver(int& val) : dsaver<int>(val) { }
string save() { return its(val); } string save() override { return its(val); }
void load(const string& s) { val = atoi(s.c_str()); } void load(const string& s) override { val = atoi(s.c_str()); }
}; };
template<> struct saver<char> : dsaver<char> { template<> struct saver<char> : dsaver<char> {
saver<char>(char& val) : dsaver<char>(val) { } explicit saver(char& val) : dsaver<char>(val) { }
string save() { return its(val); } string save() override { return its(val); }
void load(const string& s) { val = atoi(s.c_str()); } void load(const string& s) override { val = atoi(s.c_str()); }
}; };
template<> struct saver<bool> : dsaver<bool> { template<> struct saver<bool> : dsaver<bool> {
saver<bool>(bool& val) : dsaver<bool>(val) { } explicit saver(bool& val) : dsaver<bool>(val) { }
string save() { return val ? "yes" : "no"; } string save() override { return val ? "yes" : "no"; }
void load(const string& s) { val = isize(s) && s[0] == 'y'; } void load(const string& s) override { val = isize(s) && s[0] == 'y'; }
}; };
template<> struct saver<unsigned> : dsaver<unsigned> { template<> struct saver<unsigned> : dsaver<unsigned> {
saver<unsigned>(unsigned& val) : dsaver<unsigned>(val) { } explicit saver(unsigned& val) : dsaver<unsigned>(val) { }
string save() { return itsh(val); } string save() override { return itsh(val); }
void load(const string& s) { val = (unsigned) strtoll(s.c_str(), NULL, 16); } void load(const string& s) override { val = (unsigned) strtoll(s.c_str(), NULL, 16); }
}; };
template<> struct saver<string> : dsaver<string> { template<> struct saver<string> : dsaver<string> {
saver<string>(string& val) : dsaver<string>(val) { } explicit saver(string& val) : dsaver<string>(val) { }
string save() { return val; } string save() override { return val; }
void load(const string& s) { val = s; } void load(const string& s) override { val = s; }
}; };
template<> struct saver<ld> : dsaver<ld> { template<> struct saver<ld> : dsaver<ld> {
saver<ld>(ld& val) : dsaver<ld>(val) { } explicit saver(ld& val) : dsaver<ld>(val) { }
string save() { return fts(val, 10); } string save() override { return fts(val, 10); }
void load(const string& s) { void load(const string& s) override {
if(s == "0.0000000000e+000") ; // ignore! if(s == "0.0000000000e+000") ; // ignore!
else val = atof(s.c_str()); else val = atof(s.c_str());
} }

View File

@ -56,7 +56,7 @@ struct drawqueueitem {
virtual void draw() = 0; virtual void draw() = 0;
/** \brief Draw the object as background. */ /** \brief Draw the object as background. */
virtual void draw_back() {} virtual void draw_back() {}
virtual ~drawqueueitem() {} virtual ~drawqueueitem() = default;
/** \brief When minimizing OpenGL calls, we need to group items of the same color, etc. together. This value is used as an extra sorting key. */ /** \brief When minimizing OpenGL calls, we need to group items of the same color, etc. together. This value is used as an extra sorting key. */
virtual color_t outline_group() = 0; virtual color_t outline_group() = 0;
}; };
@ -85,12 +85,12 @@ struct dqi_poly : drawqueueitem {
hyperpoint intester; hyperpoint intester;
/** \brief temporarily cached data */ /** \brief temporarily cached data */
float cache; float cache;
void draw(); void draw() override;
#if CAP_GL #if CAP_GL
void gldraw(); void gldraw();
#endif #endif
void draw_back(); void draw_back() override;
virtual color_t outline_group() { return outline; } color_t outline_group() override { return outline; }
}; };
/** \brief Drawqueueitem used to draw lines */ /** \brief Drawqueueitem used to draw lines */
@ -101,9 +101,9 @@ struct dqi_line : drawqueueitem {
int prf; int prf;
/** \brief width of this line */ /** \brief width of this line */
double width; double width;
void draw(); void draw() override;
void draw_back(); void draw_back() override;
virtual color_t outline_group() { return color; } color_t outline_group() override { return color; }
}; };
/** \brief Drawqueueitem used to draw strings, using sccreen coodinates */ /** \brief Drawqueueitem used to draw strings, using sccreen coodinates */
@ -120,8 +120,8 @@ struct dqi_string : drawqueueitem {
int frame; int frame;
/** alignment (0-8-16) */ /** alignment (0-8-16) */
int align; int align;
void draw(); void draw() override;
virtual color_t outline_group() { return 1; } color_t outline_group() override { return 1; }
}; };
/** Drawqueueitem used to draw circles, using screen coordinates */ /** Drawqueueitem used to draw circles, using screen coordinates */
@ -134,16 +134,16 @@ struct dqi_circle : drawqueueitem {
color_t fillcolor; color_t fillcolor;
/** \brief width of the circle */ /** \brief width of the circle */
double linewidth; double linewidth;
void draw(); void draw() override;
virtual color_t outline_group() { return 2; } color_t outline_group() override { return 2; }
}; };
/** \brief Perform an arbitrary action. May temporarily change the model, etc. */ /** \brief Perform an arbitrary action. May temporarily change the model, etc. */
struct dqi_action : drawqueueitem { struct dqi_action : drawqueueitem {
reaction_t action; reaction_t action;
dqi_action(const reaction_t& a) : action(a) {} explicit dqi_action(const reaction_t& a) : action(a) {}
void draw() { action(); } void draw() override { action(); }
virtual color_t outline_group() { return 2; } color_t outline_group() override { return 2; }
}; };
#endif #endif

View File

@ -44,7 +44,7 @@ EX int hrand(int i) {
#if HDR #if HDR
template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i = {x,u...}; return *(i.begin() + hrand(1+sizeof...(u))); } template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i = {x,u...}; return *(i.begin() + hrand(1+sizeof...(u))); }
template<class T> void hrandom_shuffle(T* x, int n) { for(int k=1; k<n; k++) swap(x[k], x[hrand(k+1)]); } template<class T> void hrandom_shuffle(T* x, int n) { for(int k=1; k<n; k++) swap(x[k], x[hrand(k+1)]); }
template<class T> void hrandom_shuffle(T& container) { hrandom_shuffle(&container[0], isize(container)); } template<class T> void hrandom_shuffle(T& container) { hrandom_shuffle(container.data(), isize(container)); }
template<class U> auto hrand_elt(U& container) -> decltype(container[0]) { return container[hrand(isize(container))]; } template<class U> auto hrand_elt(U& container) -> decltype(container[0]) { return container[hrand(isize(container))]; }
template<class T, class U> T hrand_elt(U& container, T default_value) { template<class T, class U> T hrand_elt(U& container, T default_value) {
if(container.empty()) return default_value; if(container.empty()) return default_value;

View File

@ -1860,8 +1860,8 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
queuepoly(VAHEAD, cgi.shFamiliarHead, darkena(0xC04000, 0, 0xFF)); queuepoly(VAHEAD, cgi.shFamiliarHead, darkena(0xC04000, 0, 0xFF));
// queuepoly(V, cgi.shCatLegs, darkena(0x902000, 0, 0xFF)); // queuepoly(V, cgi.shCatLegs, darkena(0x902000, 0, 0xFF));
if(true) { if(true) {
queuepoly(VAHEAD, cgi.shFamiliarEye, darkena(0xFFFF000, 0, 0xFF)); queuepoly(VAHEAD, cgi.shFamiliarEye, darkena(0xFFFF00, 0, 0xFF));
queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, darkena(0xFFFF000, 0, 0xFF)); queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, darkena(0xFFFF00, 0, 0xFF));
} }
return true; return true;
} }
@ -2096,7 +2096,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const shiftmatrix& V1, color_t
b--; b--;
if(b < 0) b = 0; if(b < 0) b = 0;
if(b > 6) b = 6; if(b > 6) b = 6;
queuepoly(VHEAD1, cgi.shWightCloak, (0x605040A0 | UNTRANS) + 0x10101000 * b); queuepoly(VHEAD1, cgi.shWightCloak, color_t(0x605040A0 | UNTRANS) + color_t(0x10101000 * b));
return true; return true;
} }

View File

@ -122,25 +122,25 @@ struct hstream_exception : hr_exception { hstream_exception() {} };
struct fhstream : hstream { struct fhstream : hstream {
color_t vernum; color_t vernum;
virtual color_t get_vernum() override { return vernum; }
FILE *f; FILE *f;
virtual void write_char(char c) override { write_chars(&c, 1); } explicit fhstream() { f = NULL; vernum = VERNUM_HEX; }
virtual void write_chars(const char* c, size_t i) override { if(fwrite(c, i, 1, f) != 1) throw hstream_exception(); } explicit fhstream(const string pathname, const char *mode) { f = fopen(pathname.c_str(), mode); vernum = VERNUM_HEX; }
virtual void read_chars(char* c, size_t i) override { if(fread(c, i, 1, f) != 1) throw hstream_exception(); }
virtual char read_char() override { char c; read_chars(&c, 1); return c; }
fhstream() { f = NULL; vernum = VERNUM_HEX; }
fhstream(const string pathname, const char *mode) { f = fopen(pathname.c_str(), mode); vernum = VERNUM_HEX; }
~fhstream() { if(f) fclose(f); } ~fhstream() { if(f) fclose(f); }
color_t get_vernum() override { return vernum; }
void write_char(char c) override { write_chars(&c, 1); }
void write_chars(const char* c, size_t i) override { if(fwrite(c, i, 1, f) != 1) throw hstream_exception(); }
void read_chars(char* c, size_t i) override { if(fread(c, i, 1, f) != 1) throw hstream_exception(); }
char read_char() override { char c; read_chars(&c, 1); return c; }
}; };
struct shstream : hstream { struct shstream : hstream {
color_t vernum; color_t vernum;
virtual color_t get_vernum() override { return vernum; }
string s; string s;
int pos; int pos;
shstream(const string& t = "") : s(t) { pos = 0; vernum = VERNUM_HEX; } explicit shstream(const string& t = "") : s(t) { pos = 0; vernum = VERNUM_HEX; }
virtual void write_char(char c) override { s += c; } color_t get_vernum() override { return vernum; }
virtual char read_char() override { if(pos == isize(s)) throw hstream_exception(); return s[pos++]; } void write_char(char c) override { s += c; }
char read_char() override { if(pos == isize(s)) throw hstream_exception(); return s[pos++]; }
}; };
inline void print(hstream& hs) {} inline void print(hstream& hs) {}
@ -243,11 +243,11 @@ int SDL_GetTicks();
struct logger : hstream { struct logger : hstream {
int indentation; int indentation;
bool doindent; bool doindent;
logger() { doindent = false; } explicit logger() { doindent = false; }
virtual void write_char(char c) { if(doindent) { doindent = false; void write_char(char c) override { if(doindent) { doindent = false;
if(debugflags & DF_TIME) { int t = SDL_GetTicks(); if(t < 0) t = 999999; t %= 1000000; string s = its(t); while(isize(s) < 6) s = "0" + s; for(char c: s) special_log(c); special_log(' '); } if(debugflags & DF_TIME) { int t = SDL_GetTicks(); if(t < 0) t = 999999; t %= 1000000; string s = its(t); while(isize(s) < 6) s = "0" + s; for(char c: s) special_log(c); special_log(' '); }
for(int i=0; i<indentation; i++) special_log(' '); } special_log(c); if(c == 10) doindent = true; if(c == 10 && debugfile) fflush(debugfile); } for(int i=0; i<indentation; i++) special_log(' '); } special_log(c); if(c == 10) doindent = true; if(c == 10 && debugfile) fflush(debugfile); }
virtual char read_char() { throw hstream_exception(); } char read_char() override { throw hstream_exception(); }
}; };
extern logger hlog; extern logger hlog;
@ -278,11 +278,11 @@ inline void print(hstream& hs, cellwalker cw) {
struct indenter { struct indenter {
dynamicval<int> ind; dynamicval<int> ind;
indenter(int i = 2) : ind(hlog.indentation, hlog.indentation + (i)) {} explicit indenter(int i = 2) : ind(hlog.indentation, hlog.indentation + (i)) {}
}; };
struct indenter_finish : indenter { struct indenter_finish : indenter {
indenter_finish(bool b = true): indenter(b ? 2:0) {} explicit indenter_finish(bool b = true): indenter(b ? 2:0) {}
~indenter_finish() { if(hlog.indentation != ind.backup) println(hlog, "(done)"); } ~indenter_finish() { if(hlog.indentation != ind.backup) println(hlog, "(done)"); }
}; };

View File

@ -19,10 +19,10 @@ template<class T, class R, class... Args>
struct function_state : function_state_base<R, Args...> { struct function_state : function_state_base<R, Args...> {
T t_; T t_;
explicit function_state(T t) : t_(std::move(t)) {} explicit function_state(T t) : t_(std::move(t)) {}
R call(Args... args) const /*override*/ { R call(Args... args) const override {
return const_cast<T&>(t_)(static_cast<Args&&>(args)...); return const_cast<T&>(t_)(static_cast<Args&&>(args)...);
} }
function_state_base<R, Args...> *clone() const /*override*/ { function_state_base<R, Args...> *clone() const override {
return new function_state(*this); return new function_state(*this);
} }
}; };

View File

@ -21,7 +21,7 @@ EX namespace inforder {
struct hrmap_inforder : hrmap_hyperbolic { struct hrmap_inforder : hrmap_hyperbolic {
heptagon *create_step(heptagon *h, int direction) { heptagon *create_step(heptagon *h, int direction) override {
int deg = h->type; int deg = h->type;
if(mixed()) deg = 7 - deg; if(mixed()) deg = 7 - deg;
auto h1 = init_heptagon(deg); auto h1 = init_heptagon(deg);
@ -51,4 +51,4 @@ EX namespace inforder {
EX } EX }
} }

View File

@ -339,7 +339,7 @@ struct hrmap_kite : hrmap {
return gm * where; return gm * where;
} }
virtual int wall_offset(cell *c) { int wall_offset(cell *c) override {
if(WDIM == 3) if(WDIM == 3)
return kite::getshape(c->master) == kite::pKite ? 10 : 0; return kite::getshape(c->master) == kite::pKite ? 10 : 0;
else else
@ -426,4 +426,4 @@ auto hooksw = addHook(hooks_swapdim, 100, [] { if(kite::in() && currentmap) kite
#endif #endif
}} }}

View File

@ -525,7 +525,7 @@ S("(Menu button) and select the ASCII mode, which runs much faster. "
S("(in the MENU). You can reduce the sight range, this should make " S("(in the MENU). You can reduce the sight range, this should make "
"the animations smoother.", "the animations smoother.",
"MENU). Вы можете уменьшить радиус обзора, что сделает анимацию более гладкой. ") "МЕНЮ). Вы можете уменьшить радиус обзора, чтобы сделать анимацию более гладкой.")
S("(press v) and change the wall/monster mode to ASCII, or change " S("(press v) and change the wall/monster mode to ASCII, or change "
"the resolution.", "the resolution.",
@ -1450,7 +1450,7 @@ S("This Orb allows you to create illusions of yourself. Illusions are targeted "
"так же как Вас, Тамперы и ваших союзников.\n\n" "так же как Вас, Тамперы и ваших союзников.\n\n"
"Каждая иллюзия требует 5 зарядов для создания и по одному в каждый ход. " "Каждая иллюзия требует 5 зарядов для создания и по одному в каждый ход. "
"Также Вы можете кликнуть на иллюзию, чтобы забрать её, потратив 3 заряда.\n\n" "Также Вы можете кликнуть на иллюзию, чтобы забрать её, потратив 3 заряда.\n\n"
"Если у Вас есть сферы Хитрости и Телепорта, Иллюзия работает первой -- Вы можете" "Если у Вас есть сферы Хитрости и Телепорта, Иллюзия работает первой -- Вы можете "
"потом телепортироваться на неё, чтобы поменяться с ней местами.") "потом телепортироваться на неё, чтобы поменяться с ней местами.")
// Иллюзии "Хитрости" // Иллюзии "Хитрости"
S("Illusions are targeted by most monsters, just like yourself, Thumpers, and your friends.", S("Illusions are targeted by most monsters, just like yourself, Thumpers, and your friends.",
@ -1613,7 +1613,7 @@ S("This land contains high rock formations. Most of the valley is at level 0, "
"or to lose three levels, in a single move, (attacks are possible at any " "or to lose three levels, in a single move, (attacks are possible at any "
"difference, though). Kill Red Trolls and Rock Snakes to make a cell higher.", "difference, though). Kill Red Trolls and Rock Snakes to make a cell higher.",
"Эта земля содержт участки высоких скал. Большая часть долины находится на уровне 0, " "Эта земля содержит участки высоких скал. Большая часть долины находится на уровне 0, "
"а все предметы лежат на уровне 3. Невозможно подняться на 2 или больше уровня " "а все предметы лежат на уровне 3. Невозможно подняться на 2 или больше уровня "
"или опуститься на 3 уровня за один ход, хотя атаковать можно всегда. " "или опуститься на 3 уровня за один ход, хотя атаковать можно всегда. "
"Убейте Красного тролля или Каменную змею, чтобы сделать клетку выше.") "Убейте Красного тролля или Каменную змею, чтобы сделать клетку выше.")
@ -1784,7 +1784,7 @@ N("Albatross", GEN_M, "Альбатрос", "Альбатросы", "Альба
S( S(
"Those large seabirds attack you for some reason. At least they are not " "Those large seabirds attack you for some reason. At least they are not "
"as fast as Eagles...", "as fast as Eagles...",
"Эти большие морские птицв почему-то атакуют Вас. Они хотя бы не такие " "Эти большие морские птицы почему-то атакуют Вас. Они хотя бы не такие "
"быстрые, как Орлы...") "быстрые, как Орлы...")
N("stranded boat", GEN_F, "лодка на мели", "лодки на мели", "лодку на мели", "в лодке на мели") N("stranded boat", GEN_F, "лодка на мели", "лодки на мели", "лодку на мели", "в лодке на мели")
@ -2479,7 +2479,7 @@ S("forbidden to find in %the1", "запрещена %abl1")
S("too dangerous to use in %the1", "слишком опасна %abl1") S("too dangerous to use in %the1", "слишком опасна %abl1")
S("useless in %the1", "бесполезна %abl1") S("useless in %the1", "бесполезна %abl1")
S("only native Orbs allowed in %the1", "только родные сферы доступны %abl1") S("only native Orbs allowed in %the1", "только родные сферы доступны %abl1")
S("this Orb is never unlocked globally (only hubs)", "эта сфера открывается только ы Центрах") S("this Orb is never unlocked globally (only hubs)", "эта сфера открывается только в Центрах")
S("collect 25 %2 to unlock it in %the1", "соберите 25x %2, чтобы открыть её %abl1") S("collect 25 %2 to unlock it in %the1", "соберите 25x %2, чтобы открыть её %abl1")
S("collect 3 %2 to unlock it in %the1","соберите 3x %2, чтобы открыть её %abl1") S("collect 3 %2 to unlock it in %the1","соберите 3x %2, чтобы открыть её %abl1")
S("native to %the1 (collect 10 %2)", "родная %abl1 (10x %2)") S("native to %the1 (collect 10 %2)", "родная %abl1 (10x %2)")
@ -2900,7 +2900,7 @@ S(
S("Yendor Challenge", "Миссия Йендора") S("Yendor Challenge", "Миссия Йендора")
S("Collect 10 treasures in various lands to unlock the challenges there", S("Collect 10 treasures in various lands to unlock the challenges there",
"Собирайте 10 сокровищ в разных землях, чтобы разблокировать миссии здесь") "Собирайте 10 сокровищ в разных землях, чтобы открыть миссии здесь")
S("easy", "легко") S("easy", "легко")
S("challenge", "испытание") S("challenge", "испытание")
@ -2956,9 +2956,6 @@ S(
S("Unlock this challenge by getting the Orb of Yendor!", S("Unlock this challenge by getting the Orb of Yendor!",
"Откройте этот режим, собрав сферу Йендора!") "Откройте этот режим, собрав сферу Йендора!")
S("Collect 10 treasures in various lands to unlock the challenges there",
"Собирайте 10 сокровищ в разных землях, чтобы открыть миссии здесь")
// Wild West // Wild West
// ---------- // ----------
@ -3986,9 +3983,6 @@ S("\n\nOnce you collect 10 Bomberbird Eggs, "
S("This might be very useful for devices with limited memory.", S("This might be very useful for devices with limited memory.",
"Это может быть полезно для устройств с ограниченной памятью.") "Это может быть полезно для устройств с ограниченной памятью.")
S("(in the MENU). You can reduce the sight range, this should make the animations smoother.",
"(в МЕНЮ). Вы можете уменьшить радиус обзора, чтобы сделать анимацию более гладкой.")
S("Unavailable in the shmup mode.\n", "Недоступно в режиме стрельбы.\n") S("Unavailable in the shmup mode.\n", "Недоступно в режиме стрельбы.\n")
S("Unavailable in the multiplayer mode.\n", "Недоступно в режиме нескольких игроков.\n") S("Unavailable in the multiplayer mode.\n", "Недоступно в режиме нескольких игроков.\n")
S("Unavailable in the Chaos mode.\n", "Недоступно в режиме Хаоса.\n") S("Unavailable in the Chaos mode.\n", "Недоступно в режиме Хаоса.\n")
@ -4575,27 +4569,6 @@ S("You gain your protective Shell back!", "Вы вернули свою рако
S("rainbow landscape", "радужный пейзаж") S("rainbow landscape", "радужный пейзаж")
S("Cannot use %the1 here!", "Нельзя использовать %a1 здесь!") S("Cannot use %the1 here!", "Нельзя использовать %a1 здесь!")
S("draw the grid", "нарисовать сетку")
S("Escher/3D", "Эшер/3D")
S("plain/3D", "простой/3D")
S("3D", "3D")
S("Welcome to Halloween!", "Добро пожаловать на Хэллоуин!")
S("How long should the messages stay on the screen.",
"Как долго сообщения остаются на экране")
S("select this color", "выбери этот цвет")
S("sound effects volume", "громкость звуковых эффектов")
S("\n\nSee sounds/credits.txt for credits for sound effects",
"\n\nБлагодарности за звуковые эффекты: sounds/credits.txt")
S("scrolling speed", "скорость проматывания")
S("movement animation speed", "скорость анимации движения")
S("+5 = move instantly", "+5 = мгновенное движение")
S("extra graphical effects", "дополнительные графические эффекты")
S("rainbow landscape", "радужный пейзаж")
S("Cannot use %the1 here!", "Невозможно использовать %a1 here!")
S("draw the grid", "рисовать сетку") S("draw the grid", "рисовать сетку")
S("Escher/3D", "Эшер/3D") S("Escher/3D", "Эшер/3D")
S("plain/3D", "простой/3D") S("plain/3D", "простой/3D")
@ -4612,15 +4585,13 @@ S("\n\nSee sounds/credits.txt for credits for sound effects",
S("scrolling speed", "скорость прокрутки") S("scrolling speed", "скорость прокрутки")
S("movement animation speed", "скорость анимации движения") S("movement animation speed", "скорость анимации движения")
S("+5 = move instantly", "+5 = мгновенный ход") S("+5 = move instantly", "+5 = мгновенное движение")
S("extra graphical effects", "дополнительные графические эффекты") S("extra graphical effects", "дополнительные графические эффекты")
// VERSION 9.3 // VERSION 9.3
// =========== // ===========
S("SORT", "СОРТИРУЙ") S("PICK", "ВЫБИРАТЬ")
S("PICK", "ВЫБИРАЙ")
S("PLAY", "ИГРАЙ")
// 3D configuration // 3D configuration
// ---------------- // ----------------
@ -5204,7 +5175,7 @@ S("Try the Guided Tour to help with understanding the "
"geometry of HyperRogue (menu -> special modes).\n\n", "geometry of HyperRogue (menu -> special modes).\n\n",
"Попробуйте Руководство, чтобы понять геометрию HyperRogue (меню -> специальные режимы.\n\n") "Попробуйте Руководство, чтобы понять геометрию HyperRogue (меню -> специальные режимы.\n\n")
S("guided tour", "Руководство") S("guided tour", "руководство")
S("spherical geometry", "сферическая геометрия") S("spherical geometry", "сферическая геометрия")
S("Euclidean geometry", "евклидова геометрия") S("Euclidean geometry", "евклидова геометрия")
S("more curved hyperbolic geometry", "более искривлённая геометрия") S("more curved hyperbolic geometry", "более искривлённая геометрия")
@ -5444,7 +5415,7 @@ S("The game is normally displayed in the so called Poincaré disk model, "
"прямыми линиями.") "прямыми линиями.")
S("Curvature", "Кривизна") S("Curvature", "Кривизна")
S("gain Orb of the Sword", "получи Сферу меча") S("gain Orb of the Sword", "дать сферу Меча")
S( S(
"Now, go to the Burial Grounds and find an Orb of the Sword. The Sword appears to " "Now, go to the Burial Grounds and find an Orb of the Sword. The Sword appears to "
"always be facing in the same direction whatever you do, and it appears that " "always be facing in the same direction whatever you do, and it appears that "
@ -5713,7 +5684,7 @@ S("aura smoothening factor", "сглаживание ауры")
S("graphics configuration", "настройка графики") S("graphics configuration", "настройка графики")
S("special display modes", "специальные режимы отображения") S("special display modes", "специальные режимы отображения")
S("openGL mode", "режим OpenGL") S("openGL mode", "режим OpenGL")
S("anti-aliasing", "anti-aliasing") S("anti-aliasing", "сглаживание")
S("line width", "широта линии") S("line width", "широта линии")
S("configure panning and general keys", "настроить панораму и общие клавиши") S("configure panning and general keys", "настроить панораму и общие клавиши")
@ -5734,7 +5705,6 @@ S("four triangles", "четыре треугольника")
S("big triangles: rings", "большие треугольники: кольца") S("big triangles: rings", "большие треугольники: кольца")
// missing for the Tutorial // missing for the Tutorial
S("guided tour", "руководство")
S("This Orb is not compatible with the Tutorial.", "Эта сфера не совместима с Руководством.") S("This Orb is not compatible with the Tutorial.", "Эта сфера не совместима с Руководством.")
// local scores // local scores
@ -5971,7 +5941,6 @@ S("puzzles and exploration", "головоломки и изучение")
S("Zebra quotient", "фактор Зебры") S("Zebra quotient", "фактор Зебры")
S("field quotient", "фактор поля") S("field quotient", "фактор поля")
S("mark heptagons", "пометить семиугольники")
S("projection", "проекция") S("projection", "проекция")
S("compass size", "размер компаса") S("compass size", "размер компаса")
@ -6040,7 +6009,7 @@ S(
S("skip the start menu", "пропустить начальное меню") S("skip the start menu", "пропустить начальное меню")
S("quick mouse", "быстрая мышь") S("quick mouse", "быстрая мышь")
S("This combination is known to be buggy at the moment.", "Эта комбинация пока что работает с ошибками.") S("This combination is known to be buggy at the moment.", "Эта комбинация сейчас может работать с ошибками.")
// extra Princess texts // extra Princess texts
// -------------------- // --------------------
@ -6483,8 +6452,8 @@ S("Useless in Euclidean geometry.", "Бесполезно в Евклидово
S("Not implemented for spherical geometry. Please tell me if you really want this.", S("Not implemented for spherical geometry. Please tell me if you really want this.",
"Не реализовано для сферической геометрии. Напиши мне, если очень хочешь.") "Не реализовано для сферической геометрии. Напиши мне, если очень хочешь.")
S("score: %1", "Очки: %1") S("score: %1", "счёт: %1")
S("kills: %1", "Убийства: %1") S("kills: %1", "убийства: %1")
// === 10.3 === // === 10.3 ===
@ -6508,9 +6477,6 @@ S("bestiary of %the1", "бестиарий: %1")
// for the map editor // for the map editor
N("Dragon Head", GEN_F, "Голова Дракона", "Головы Дракона", "Голову Дракона", "Головой Дракона") N("Dragon Head", GEN_F, "Голова Дракона", "Головы Дракона", "Голову Дракона", "Головой Дракона")
S("score: %1", "счет: %1")
S("kills: %1", "убийств: %1")
// advanced config of quotient geometry // advanced config of quotient geometry
//-------------------------------------- //--------------------------------------
@ -6647,7 +6613,6 @@ S("reactivate the texture", "восстановить текстуру")
S("open PNG as texture", "открыть PNG как текстуру") S("open PNG as texture", "открыть PNG как текстуру")
S("load texture config", "загрузить настройки текстур") S("load texture config", "загрузить настройки текстур")
S("warning: unable to find the center", "осторожно: не найден центр") S("warning: unable to find the center", "осторожно: не найден центр")
S("texture size", "размер текстура")
S("paint a new texture", "нарисовать новую текстуру") S("paint a new texture", "нарисовать новую текстуру")
S("precision", "точность") S("precision", "точность")
@ -7199,7 +7164,6 @@ S("This land does not work in the current settings. Reason not available.",
"Эта земля не работает при данных настройках. Причина недоступна.") "Эта земля не работает при данных настройках. Причина недоступна.")
S("This land does not work well in the current settings. Reason not available.", S("This land does not work well in the current settings. Reason not available.",
"Эта земля плохо работает при данных настройках. Причина недоступна.") "Эта земля плохо работает при данных настройках. Причина недоступна.")
S("This combination is known to be buggy at the moment.", "Эта комбинация сейчас может работать с ошибками.")
S("Somewhat sloppy pattern.", "Небрежный узор.") S("Somewhat sloppy pattern.", "Небрежный узор.")
S("Fractal landscapes not implemented in this geometry.", "Фракталы не реализованы в этой геометрии.") S("Fractal landscapes not implemented in this geometry.", "Фракталы не реализованы в этой геометрии.")
S("Only simplified walls implemented.", "Реализованы только упрощенные стены.") S("Only simplified walls implemented.", "Реализованы только упрощенные стены.")
@ -7221,21 +7185,10 @@ S("Goldberg", "Гольдберг")
S("fisheye", "рыбий глаз") S("fisheye", "рыбий глаз")
S("extend the ends", "расширить концы") // for the line animation S("extend the ends", "расширить концы") // for the line animation
S(
"This model maps the world so that the distances from two points "
"are kept. This parameter gives the distance from the two points to "
"the center.",
"Эта модель отображает мир так, что расстояния от двух точек сохраняются. "
"Этот параметр задает расстояние от этих двух точек до центра. ")
// missing texts from the Tutorial // missing texts from the Tutorial
S("enable the Camelot cheat", "включить читы в Камелоте") S("enable the Camelot cheat", "включить читы в Камелоте")
S("disable the Camelot cheat", "выключить читы в Камелоте") S("disable the Camelot cheat", "выключить читы в Камелоте")
S("gain Orb of the Sword", "дать сферу Меча")
S("Static mode enabled.", "Статический режим включен.")
S("Static mode disabled.", "Статический режим выключен.")
S("Returned to your game.", "Вернуться в игру.") S("Returned to your game.", "Вернуться в игру.")
S("Spherical version of %the1. ", "%1 в сферической версии. ") S("Spherical version of %the1. ", "%1 в сферической версии. ")

View File

@ -134,7 +134,7 @@ template<class T> struct connection_table {
unsigned char *spintable() { return (unsigned char*) (&move_table[full()->degree()]); } unsigned char *spintable() { return (unsigned char*) (&move_table[full()->degree()]); }
/** \brief get the full T from the pointer to this connection table */ /** \brief get the full T from the pointer to this connection table */
T* full() { T* x = (T*) this; return (T*)((char*)this - ((char*)(&(x->c)) - (char*)x)); } T* full() { return (T*)((char*)this - offsetof(T, c)); }
/** \brief for the edge d, set the `spin` and `mirror` attributes */ /** \brief for the edge d, set the `spin` and `mirror` attributes */
void setspin(int d, int spin, bool mirror) { void setspin(int d, int spin, bool mirror) {
unsigned char& c = spintable() [d]; unsigned char& c = spintable() [d];
@ -178,10 +178,9 @@ template<class T> struct connection_table {
*/ */
template<class T> T* tailored_alloc(int degree) { template<class T> T* tailored_alloc(int degree) {
const T* sample = nullptr;
T* result; T* result;
#ifndef NO_TAILORED_ALLOC #ifndef NO_TAILORED_ALLOC
int b = (char*)&sample->c.move_table[degree] + degree - (char*) sample; int b = offsetof(T, c) + offsetof(connection_table<T>, move_table) + sizeof(T*) * degree + degree;
result = (T*) new char[b]; result = (T*) new char[b];
new (result) T(); new (result) T();
#else #else

View File

@ -567,7 +567,7 @@ EX int totalbulldistance(cell *c, int k) {
shpos.resize(SHSIZE); shpos.resize(SHSIZE);
int tbd = 0; int tbd = 0;
for(int p: player_indices()) { for(int p: player_indices()) {
cell *c2 = shpos[p][(cshpos+SHSIZE-k-1)%SHSIZE]; cell *c2 = shpos[(cshpos+SHSIZE-k-1)%SHSIZE][p];
if(c2) tbd += bulldistance(c, c2); if(c2) tbd += bulldistance(c, c2);
} }
return tbd; return tbd;

View File

@ -75,7 +75,7 @@ void set_linux() {
void set_mac() { void set_mac() {
preprocessor = "g++ -E"; preprocessor = "g++ -E";
compiler = "g++ -march=native -W -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -c"; compiler = "g++ -march=native -W -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-invalid-offsetof -c";
linker = "g++ -o hyper"; linker = "g++ -o hyper";
opts = "-DMAC -I/usr/local/include"; opts = "-DMAC -I/usr/local/include";
libs = " -L/usr/local/lib -framework AppKit -framework OpenGL -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpng -lpthread -lz"; libs = " -L/usr/local/lib -framework AppKit -framework OpenGL -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpng -lpthread -lz";

View File

@ -664,10 +664,10 @@ EX namespace patterns {
si.reflect = false; si.reflect = false;
} }
else { else {
int ids = 0, tids = 0, td = 0; int ids = 0, td = 0;
for(int i=0; i<S3; i++) { for(int i=0; i<S3; i++) {
int d = c->move(2*i)->master->fieldval; int d = c->move(2*i)->master->fieldval;
ids |= (1<<d); tids += d; ids |= (1<<d);
} }
for(int i=0; i<S3; i++) { for(int i=0; i<S3; i++) {
int d = c->move(2*i)->master->fieldval; int d = c->move(2*i)->master->fieldval;

View File

@ -64,16 +64,16 @@ struct hrmap_quotient : hrmap_standard {
void build(); void build();
hrmap_quotient() { explicit hrmap_quotient() {
generate_connections(); generate_connections();
build(); build();
} }
hrmap_quotient(const vector<int>& con) : connections(con) { explicit hrmap_quotient(const vector<int>& con) : connections(con) {
build(); build();
} }
heptagon *getOrigin() { return allh[0]; } heptagon *getOrigin() override { return allh[0]; }
~hrmap_quotient() { ~hrmap_quotient() {
for(int i=0; i<isize(allh); i++) { for(int i=0; i<isize(allh); i++) {
@ -82,7 +82,7 @@ struct hrmap_quotient : hrmap_standard {
} }
} }
vector<cell*>& allcells() { return celllist; } vector<cell*>& allcells() override { return celllist; }
}; };
#endif #endif

View File

@ -331,7 +331,7 @@ void find_track(cell *start, int sign, int len) {
} }
EX void block_cells(vector<cell*> to_block, function<bool(cell*)> blockbound) { EX void block_cells(vector<cell*> to_block, function<bool(cell*)> blockbound) {
hrandom_shuffle(&to_block[0], isize(to_block)); hrandom_shuffle(to_block);
for(cell *c: to_block) switch(specialland) { for(cell *c: to_block) switch(specialland) {
case laIce: case laIce:

View File

@ -654,7 +654,7 @@ EX namespace reg3 {
int h_id; int h_id;
/** transition matrix to that heptagon */ /** transition matrix to that heptagon */
transmatrix T; transmatrix T;
/** the sequence of moves we need to make to get there */; /** the sequence of moves we need to make to get there */
vector<int> move_sequence; vector<int> move_sequence;
}; };
@ -685,7 +685,7 @@ EX namespace reg3 {
return cgi.subshapes[id].vertices_only_local; return cgi.subshapes[id].vertices_only_local;
} }
transmatrix master_relative(cell *c, bool get_inverse) { transmatrix master_relative(cell *c, bool get_inverse) override {
int id = local_id.at(c).second; int id = local_id.at(c).second;
auto& ss = cgi.subshapes[id]; auto& ss = cgi.subshapes[id];
return get_inverse ? ss.from_cellcenter : ss.to_cellcenter; return get_inverse ? ss.from_cellcenter : ss.to_cellcenter;
@ -694,11 +694,11 @@ EX namespace reg3 {
void make_subconnections(); void make_subconnections();
int wall_offset(cell *c) override; int wall_offset(cell *c) override;
int shvid(cell *c) { return local_id.at(c).second; } int shvid(cell *c) override { return local_id.at(c).second; }
virtual transmatrix ray_iadj(cell *c, int i) override; transmatrix ray_iadj(cell *c, int i) override;
const vector<char>& dirdist(cell *c, int i) { const vector<char>& dirdist(cell *c, int i) override {
int id = local_id.at(c).second; int id = local_id.at(c).second;
return cgi.subshapes[id].dirdist[i]; return cgi.subshapes[id].dirdist[i];
} }
@ -1521,7 +1521,7 @@ EX namespace reg3 {
return cgi.vertices_only; return cgi.vertices_only;
} }
const vector<char>& dirdist(cell *c, int i) { const vector<char>& dirdist(cell *c, int i) override {
return cgi.dirdist[i]; return cgi.dirdist[i];
} }
@ -1613,7 +1613,7 @@ EX namespace reg3 {
clearfrom(allh[0]); clearfrom(allh[0]);
} }
virtual struct transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override { struct transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
return iso_inverse(locations[h1->fieldval]) * locations[h2->fieldval]; return iso_inverse(locations[h1->fieldval]) * locations[h2->fieldval];
} }
@ -1932,13 +1932,13 @@ EX namespace reg3 {
return relative_matrix_via_masters(c2, c1, hint); return relative_matrix_via_masters(c2, c1, hint);
} }
transmatrix master_relative(cell *c, bool get_inverse) { transmatrix master_relative(cell *c, bool get_inverse) override {
if(PURE) return Id; if(PURE) return Id;
int aid = cell_id.at(c); int aid = cell_id.at(c);
return quotient_map->master_relative(quotient_map->acells[aid], get_inverse); return quotient_map->master_relative(quotient_map->acells[aid], get_inverse);
} }
int shvid(cell *c) { int shvid(cell *c) override {
if(PURE) return 0; if(PURE) return 0;
if(!cell_id.count(c)) return quotient_map->shvid(c); if(!cell_id.count(c)) return quotient_map->shvid(c);
int aid = cell_id.at(c); int aid = cell_id.at(c);
@ -1994,14 +1994,14 @@ EX namespace reg3 {
c->c.connect(d, c1, ac->c.spin(d), false); c->c.connect(d, c1, ac->c.spin(d), false);
} }
virtual transmatrix ray_iadj(cell *c, int i) { transmatrix ray_iadj(cell *c, int i) override {
if(PURE) return iadj(c, i); if(PURE) return iadj(c, i);
if(!cell_id.count(c)) return quotient_map->ray_iadj(c, i); /* necessary because ray samples are from quotient_map */ if(!cell_id.count(c)) return quotient_map->ray_iadj(c, i); /* necessary because ray samples are from quotient_map */
int aid = cell_id.at(c); int aid = cell_id.at(c);
return quotient_map->ray_iadj(quotient_map->acells[aid], i); return quotient_map->ray_iadj(quotient_map->acells[aid], i);
} }
const vector<char>& dirdist(cell *c, int i) { const vector<char>& dirdist(cell *c, int i) override {
if(PURE) return cgi.dirdist[i]; if(PURE) return cgi.dirdist[i];
int aid = cell_id.at(c); int aid = cell_id.at(c);
return quotient_map->dirdist(quotient_map->acells[aid], i); return quotient_map->dirdist(quotient_map->acells[aid], i);

View File

@ -1253,7 +1253,7 @@ void fillgroups() {
do_classify(); do_classify();
vector<int> samples_to_sort; vector<int> samples_to_sort;
for(int i=0; i<samples; i++) samples_to_sort.push_back(i); for(int i=0; i<samples; i++) samples_to_sort.push_back(i);
hrandom_shuffle(&samples_to_sort[0], samples); hrandom_shuffle(samples_to_sort);
for(int i=0; i<samples; i++) if(net[bids[i]].drawn_samples < net[bids[i]].max_group_here) for(int i=0; i<samples; i++) if(net[bids[i]].drawn_samples < net[bids[i]].max_group_here)
showsample(i); showsample(i);
distribute_neurons(); distribute_neurons();

View File

@ -24,11 +24,11 @@ struct sky_item {
struct dqi_sky : drawqueueitem { struct dqi_sky : drawqueueitem {
vector<sky_item> sky; vector<sky_item> sky;
void draw(); void draw() override;
virtual color_t outline_group() { return 3; } color_t outline_group() override { return 3; }
// singleton // singleton
dqi_sky() { hr::sky = this; } explicit dqi_sky() { hr::sky = this; }
~dqi_sky() { hr::sky = NULL; } ~dqi_sky() override { hr::sky = NULL; }
}; };
EX struct dqi_sky *sky; EX struct dqi_sky *sky;

View File

@ -139,14 +139,14 @@ struct hrmap_spherical : hrmap_standard {
#endif #endif
} }
heptagon *getOrigin() { return dodecahedron[0]; } heptagon *getOrigin() override { return dodecahedron[0]; }
~hrmap_spherical() { ~hrmap_spherical() {
for(int i=0; i<spherecells(); i++) clearHexes(dodecahedron[i]); for(int i=0; i<spherecells(); i++) clearHexes(dodecahedron[i]);
for(int i=0; i<spherecells(); i++) tailored_delete(dodecahedron[i]); for(int i=0; i<spherecells(); i++) tailored_delete(dodecahedron[i]);
} }
void verify() { void verify() override {
for(int i=0; i<spherecells(); i++) for(int k=0; k<S7; k++) { for(int i=0; i<spherecells(); i++) for(int k=0; k<S7; k++) {
heptspin hs(dodecahedron[i], k, false); heptspin hs(dodecahedron[i], k, false);
heptspin hs2 = hs + wstep + (S7-1) + wstep + (S7-1) + wstep + (S7-1); heptspin hs2 = hs + wstep + (S7-1) + wstep + (S7-1) + wstep + (S7-1);
@ -172,7 +172,7 @@ struct hrmap_spherical : hrmap_standard {
return Id; return Id;
} }
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) { transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix T = iso_inverse(get_where(c1)) * get_where(c2); transmatrix T = iso_inverse(get_where(c1)) * get_where(c2);
if(elliptic) fixelliptic(T); if(elliptic) fixelliptic(T);
return T; return T;