1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00

Merge pull request #233 from Quuxplusone/fix-warnings

Fix -Woverloaded-virtual warnings
This commit is contained in:
Zeno Rogue 2021-07-13 01:46:51 +02:00 committed by GitHub
commit 039d86cd13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 46 additions and 41 deletions

View File

@ -82,9 +82,9 @@ endif
ifeq (${TOOLCHAIN},clang)
CXXFLAGS_STD = -std=c++11
CXXFLAGS_EARLY += -march=native -fPIC
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic
CXXFLAGS_EARLY += -W -Wall -Wextra -Wsuggest-override -Werror -pedantic
CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option
CXXFLAGS_EARLY += -Wno-invalid-offsetof -Wno-overloaded-virtual
CXXFLAGS_EARLY += -Wno-invalid-offsetof
endif
ifeq (${TOOLCHAIN},gcc)

View File

@ -807,7 +807,7 @@ struct hrmap_arbi : hrmap {
return h1;
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
return relative_matrix_recursive(h2, h1);
}

View File

@ -706,7 +706,7 @@ struct hrmap_archimedean : hrmap {
return calc_relative_matrix(c->cmove(dir), c, C0);
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(use_gmatrix && gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7))
return inverse_shift(gmatrix0[h1->c7], gmatrix0[h2->c7]);
transmatrix gm = Id, where = Id;

View File

@ -197,7 +197,7 @@ struct hrmap_asonov : hrmap {
transmatrix adj(heptagon *h, int i) override { return adjmatrix(i); }
virtual transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
for(int a=0; a<S7; a++) if(h2 == h1->move(a)) return adjmatrix(a);
return coord_to_matrix(coords[h2], coords[h1]);
}

View File

@ -453,7 +453,7 @@ EX namespace bt {
else throw hr_exception("wrong dir");
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7))
return inverse_shift(gmatrix0[h1->c7], gmatrix0[h2->c7]);
transmatrix gm = Id, where = Id;

View File

@ -30,16 +30,21 @@ struct hrmap {
printf("create_step called unexpectedly\n"); exit(1);
return NULL;
}
virtual struct transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
printf("relative_matrix called unexpectedly\n");
private:
virtual transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
printf("relative_matrixh called unexpectedly\n");
return Id;
}
virtual struct transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) {
return relative_matrix(c2->master, c1->master, hint);
virtual transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) {
return relative_matrixh(c2->master, c1->master, hint);
}
virtual struct transmatrix adj(cell *c, int i) { return adj(c->master, i); }
virtual struct transmatrix adj(heptagon *h, int i);
struct transmatrix iadj(cell *c, int i) { cell *c1 = c->cmove(i); return adj(c1, c->c.spin(i)); }
public:
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) { return relative_matrixh(h2, h1, hint); }
transmatrix relative_matrix(cell *h2, cell *h1, const hyperpoint& hint) { return relative_matrixc(h2, h1, hint); }
virtual transmatrix adj(cell *c, int i) { return adj(c->master, i); }
virtual transmatrix adj(heptagon *h, int i);
transmatrix iadj(cell *c, int i) { cell *c1 = c->cmove(i); return adj(c1, c->c.spin(i)); }
transmatrix iadj(heptagon *h, int d) {
heptagon *h1 = h->cmove(d); return adj(h1, h->c.spin(d));
}
@ -94,8 +99,8 @@ struct hrmap {
**/
struct hrmap_standard : hrmap {
void draw_at(cell *at, const shiftmatrix& where) override;
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override;
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override;
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override;
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override;
heptagon *create_step(heptagon *h, int direction) override;
transmatrix adj(cell *c, int d) override;
transmatrix adj(heptagon *h, int d) override;

View File

@ -673,7 +673,7 @@ struct hrmap_crystal : hrmap_standard {
else hrmap::draw_at(at, where);
}
virtual transmatrix relative_matrix(cell *h2, cell *h1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *h2, cell *h1, const hyperpoint& hint) override {
if(!crystal3()) return hrmap_standard::relative_matrix(h2, h1, hint);
if(h2 == h1) return Id;
for(int i=0; i<S7; i++) if(h2 == h1->move(i)) return adj(h1->master, i);
@ -683,7 +683,7 @@ struct hrmap_crystal : hrmap_standard {
return xpush(999);
}
virtual transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(!crystal3()) return hrmap::relative_matrix(h2, h1, hint);
return relative_matrix(h2->c7, h1->c7, hint);
}

View File

@ -260,7 +260,7 @@ EX namespace euc {
}
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(eu.twisted) {
if(h1 == h2) return Id;
for(int s=0; s<S7; s++) if(h2 == h1->move(s)) return adj(h1, s);

View File

@ -179,7 +179,7 @@ EX namespace fake {
}
}
transmatrix relative_matrix(cell *h2, cell *h1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *h2, cell *h1, const hyperpoint& hint) override {
if(arcm::in()) return underlying_map->relative_matrix(h2, h1, hint);
if(h1 == h2) return Id;
@ -189,7 +189,7 @@ EX namespace fake {
return Id;
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(arcm::in()) return underlying_map->relative_matrix(h2, h1, hint);
return relative_matrix(h2->c7, h1->c7, hint);
}

View File

@ -120,11 +120,11 @@ EX transmatrix relative_matrix_via_masters(cell *c2, cell *c1, const hyperpoint&
return gm * U * where;
}
transmatrix hrmap_standard::relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) {
transmatrix hrmap_standard::relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) {
return relative_matrix_via_masters(c2, c1, hint);
}
transmatrix hrmap_standard::relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
transmatrix hrmap_standard::relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
transmatrix gm = Id, where = Id;
// always add to last!

View File

@ -1131,11 +1131,11 @@ EX namespace gp {
return c;
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
return in_underlying([&] { return currentmap->relative_matrix(h2, h1, hint); });
}
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override {
c1 = mapping[c1];
c2 = mapping[c2];
return in_underlying([&] { return currentmap->relative_matrix(c2, c1, hint); });

View File

@ -326,7 +326,7 @@ struct hrmap_kite : hrmap {
}
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7))
return inverse_shift(gmatrix0[h1->c7], gmatrix0[h2->c7]);
transmatrix gm = Id, where = Id;

View File

@ -75,7 +75,7 @@ void set_linux() {
void set_mac() {
preprocessor = "g++ -E";
compiler = "g++ -march=native -W -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-invalid-offsetof -c";
compiler = "g++ -march=native -W -Wall -Wextra -Wsuggest-override -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-invalid-offsetof -c";
linker = "g++ -o hyper";
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";

View File

@ -425,7 +425,7 @@ EX namespace sn {
h->cmove(d); return adjmatrix(d, h->c.spin(d));
}
virtual transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
for(int i=0; i<h1->type; i++) if(h1->move(i) == h2) return adjmatrix(i, h1->c.spin(i));
if(gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7))
return inverse_shift(gmatrix0[h1->c7], gmatrix0[h2->c7]);
@ -943,7 +943,7 @@ EX namespace nilv {
transmatrix adj(heptagon *h, int i) override { return adjmatrix(i); }
virtual transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
for(int a=0; a<S7; a++) if(h2 == h1->move(a)) return adjmatrix(a);
auto p = coords[h1].inverse() * coords[h2];
for(int a=0; a<3; a++) p[a] = szgmod(p[a], nilperiod[a]);
@ -1518,7 +1518,7 @@ EX namespace product {
int z0;
struct hrmap_product : hybrid::hrmap_hybrid {
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override {
return in_underlying([&] { return calc_relative_matrix(where[c2].first, where[c1].first, hint); }) * mscale(Id, cgi.plevel * szgmod(where[c2].second - where[c1].second, hybrid::csteps));
}
@ -2079,7 +2079,7 @@ EX namespace rots {
return M = lift_matrix(PIU(currentmap->adj(cw, i)));
}
virtual transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override {
if(c1 == c2) return Id;
if(gmatrix0.count(c2) && gmatrix0.count(c1))
return inverse_shift(gmatrix0[c1], gmatrix0[c2]);
@ -2087,7 +2087,7 @@ EX namespace rots {
return Id; // not implemented yet
}
virtual transmatrix ray_iadj(cell *c1, int i) override {
transmatrix ray_iadj(cell *c1, int i) override {
if(i == c1->type-1) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel);
if(i == c1->type-2) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel);
cell *c2 = c1->cmove(i);

View File

@ -689,7 +689,7 @@ EX namespace reg3 {
heptagon *getOrigin() override { return allh[0]; }
transmatrix relative_matrix(cell *h2, cell *h1, const hyperpoint& hint) override;
transmatrix relative_matrixc(cell *h2, cell *h1, const hyperpoint& hint) override;
void initialize(int cell_count);
vector<cell*>& allcells() override { return acells; }
@ -950,7 +950,7 @@ EX namespace reg3 {
if(failures && !testing_subconnections) throw hr_exception("hrmap_closed3 failures");
}
transmatrix hrmap_closed3::relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) {
transmatrix hrmap_closed3::relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) {
if(c1 == c2) return Id;
int d = hr::celldistance(c2, c1);
@ -1505,7 +1505,7 @@ EX namespace reg3 {
return relative_matrix(h->cmove(d), h, C0);
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
auto p1 = reg_gmatrix[h1];
auto p2 = reg_gmatrix[h2];
transmatrix T = Id;
@ -1613,7 +1613,7 @@ EX namespace reg3 {
clearfrom(allh[0]);
}
struct transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
return iso_inverse(locations[h1->fieldval]) * locations[h2->fieldval];
}
@ -1927,11 +1927,11 @@ EX namespace reg3 {
return quotient_map->adj(h, d);
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
return relative_matrix_recursive(h2, h1);
}
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override {
if(PURE) return relative_matrix(c2->master, c1->master, hint);
return relative_matrix_via_masters(c2, c1, hint);
}

View File

@ -421,13 +421,13 @@ struct hrmap_grigorchuk : hrmap_standard {
}
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
if(gmatrix0.count(h2->c7) && gmatrix0.count(h1->c7))
return inverse_shift(gmatrix0[h1->c7], gmatrix0[h2->c7]);
return Id;
}
transmatrix relative_matrix(cell *c2, cell *c1, const struct hyperpoint& hint) override {
transmatrix relative_matrixc(cell *c2, cell *c1, const struct hyperpoint& hint) override {
if(gmatrix0.count(c2) && gmatrix0.count(c1))
return inverse_shift(gmatrix0[c1], gmatrix0[c2]);
return Id;

View File

@ -1103,7 +1103,7 @@ struct hrmap_notknot : hrmap {
ray::volumetric::enable();
}
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
transmatrix relative_matrixh(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
return Id;
}

View File

@ -172,7 +172,7 @@ struct hrmap_spherical : hrmap_standard {
return Id;
}
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix relative_matrixc(cell *c2, cell *c1, const hyperpoint& hint) override {
transmatrix T = iso_inverse(get_where(c1)) * get_where(c2);
if(elliptic) fixelliptic(T);
return T;