mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
Merge pull request #222 from Quuxplusone/fix-warnings
Fix or suppress a bunch of Clang warnings. NFCI.
This commit is contained in:
commit
08cbe8e4e0
2
Makefile
2
Makefile
@ -83,7 +83,7 @@ ifeq (${TOOLCHAIN},clang)
|
|||||||
CXXFLAGS_STD = -std=c++11
|
CXXFLAGS_STD = -std=c++11
|
||||||
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 -Wno-overloaded-virtual
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (${TOOLCHAIN},gcc)
|
ifeq (${TOOLCHAIN},gcc)
|
||||||
|
107
config.cpp
107
config.cpp
@ -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());
|
||||||
}
|
}
|
||||||
|
28
drawing.cpp
28
drawing.cpp
@ -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
|
||||||
|
|
||||||
|
32
hprint.cpp
32
hprint.cpp
@ -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)"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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 }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
4
kite.cpp
4
kite.cpp
@ -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
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
22
reg3.cpp
22
reg3.cpp
@ -649,7 +649,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -680,7 +680,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;
|
||||||
@ -689,11 +689,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<bool>& adjacent_dirs(cell *c, int i) {
|
const vector<bool>& adjacent_dirs(cell *c, int i) override {
|
||||||
int id = local_id.at(c).second;
|
int id = local_id.at(c).second;
|
||||||
return cgi.subshapes[id].dirs_adjacent[i];
|
return cgi.subshapes[id].dirs_adjacent[i];
|
||||||
}
|
}
|
||||||
@ -1490,7 +1490,7 @@ EX namespace reg3 {
|
|||||||
return cgi.vertices_only;
|
return cgi.vertices_only;
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<bool>& adjacent_dirs(cell *c, int i) {
|
const vector<bool>& adjacent_dirs(cell *c, int i) override {
|
||||||
return cgi.dirs_adjacent[i];
|
return cgi.dirs_adjacent[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,7 +1582,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];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1901,13 +1901,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);
|
||||||
@ -1963,14 +1963,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<bool>& adjacent_dirs(cell *c, int i) {
|
const vector<bool>& adjacent_dirs(cell *c, int i) override {
|
||||||
if(PURE) return cgi.dirs_adjacent[i];
|
if(PURE) return cgi.dirs_adjacent[i];
|
||||||
int aid = cell_id.at(c);
|
int aid = cell_id.at(c);
|
||||||
return quotient_map->adjacent_dirs(quotient_map->acells[aid], i);
|
return quotient_map->adjacent_dirs(quotient_map->acells[aid], i);
|
||||||
|
8
sky.cpp
8
sky.cpp
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user