mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
gp:: fixed wrong gp_adj on embedded
This commit is contained in:
parent
f9a951a2d1
commit
cad46dc16f
10
cell.cpp
10
cell.cpp
@ -98,6 +98,7 @@ struct hrmap_standard : hrmap {
|
|||||||
virtual hyperpoint get_corner(cell *c, int cid, ld cf) override;
|
virtual hyperpoint get_corner(cell *c, int cid, ld cf) override;
|
||||||
virtual transmatrix master_relative(cell *c, bool get_inverse) override;
|
virtual transmatrix master_relative(cell *c, bool get_inverse) override;
|
||||||
virtual bool link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) override;
|
virtual bool link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) override;
|
||||||
|
virtual void on_dim_change();
|
||||||
};
|
};
|
||||||
|
|
||||||
void clearfrom(heptagon*);
|
void clearfrom(heptagon*);
|
||||||
@ -118,6 +119,11 @@ struct hrmap_hyperbolic : hrmap_standard {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void hrmap_standard::on_dim_change() {
|
||||||
|
for(auto& p: gp::gp_swapped) swapmatrix(gp::gp_adj[p]);
|
||||||
|
gp::gp_swapped.clear();
|
||||||
|
}
|
||||||
|
|
||||||
double hrmap::spacedist(cell *c, int i) { return hdist(tile_center(), adj(c, i) * tile_center()); }
|
double hrmap::spacedist(cell *c, int i) { return hdist(tile_center(), adj(c, i) * tile_center()); }
|
||||||
|
|
||||||
heptagon *hrmap::create_step(heptagon *h, int direction) {
|
heptagon *hrmap::create_step(heptagon *h, int direction) {
|
||||||
@ -542,7 +548,11 @@ EX void initcells() {
|
|||||||
DEBB(DF_INIT, ("initcells"));
|
DEBB(DF_INIT, ("initcells"));
|
||||||
|
|
||||||
if(embedded_plane) {
|
if(embedded_plane) {
|
||||||
|
geom3::swap_direction = -1;
|
||||||
|
for(auto& m: cgi.heptmove) swapmatrix(m);
|
||||||
IPF(initcells());
|
IPF(initcells());
|
||||||
|
geom3::swap_direction = +1;
|
||||||
|
for(auto& m: cgi.heptmove) swapmatrix(m);
|
||||||
currentmap->on_dim_change();
|
currentmap->on_dim_change();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -274,6 +274,8 @@ EX namespace gp {
|
|||||||
if(do_adjm) {
|
if(do_adjm) {
|
||||||
get_adj(wcw.at, wcw.spin) = inverse(wc.adjm) * wc1.adjm;
|
get_adj(wcw.at, wcw.spin) = inverse(wc.adjm) * wc1.adjm;
|
||||||
get_adj(wcw1.at, wcw1.spin) = inverse(wc1.adjm) * wc.adjm;
|
get_adj(wcw1.at, wcw1.spin) = inverse(wc1.adjm) * wc.adjm;
|
||||||
|
if(geom3::flipped) gp_swapped.emplace(wcw.at, wcw.spin);
|
||||||
|
if(geom3::flipped) gp_swapped.emplace(wcw1.at, wcw1.spin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,6 +285,7 @@ EX namespace gp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX map<pair<cell*, int>, transmatrix> gp_adj;
|
EX map<pair<cell*, int>, transmatrix> gp_adj;
|
||||||
|
EX set<pair<cell*, int>> gp_swapped;
|
||||||
|
|
||||||
EX transmatrix& get_adj(cell *c, int i) { return gp_adj[make_pair(c,i)]; }
|
EX transmatrix& get_adj(cell *c, int i) { return gp_adj[make_pair(c,i)]; }
|
||||||
|
|
||||||
|
@ -172,7 +172,10 @@ struct hrmap_spherical : hrmap_standard {
|
|||||||
return Id;
|
return Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_dim_change() override { where.clear(); }
|
void on_dim_change() override {
|
||||||
|
hrmap_standard::on_dim_change();
|
||||||
|
where.clear();
|
||||||
|
}
|
||||||
|
|
||||||
transmatrix relative_matrixc(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);
|
transmatrix T = iso_inverse(get_where(c1)) * get_where(c2);
|
||||||
|
Loading…
Reference in New Issue
Block a user