mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +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 transmatrix master_relative(cell *c, bool get_inverse) override;
|
||||
virtual bool link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) override;
|
||||
virtual void on_dim_change();
|
||||
};
|
||||
|
||||
void clearfrom(heptagon*);
|
||||
@ -118,6 +119,11 @@ struct hrmap_hyperbolic : hrmap_standard {
|
||||
};
|
||||
#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()); }
|
||||
|
||||
heptagon *hrmap::create_step(heptagon *h, int direction) {
|
||||
@ -542,7 +548,11 @@ EX void initcells() {
|
||||
DEBB(DF_INIT, ("initcells"));
|
||||
|
||||
if(embedded_plane) {
|
||||
geom3::swap_direction = -1;
|
||||
for(auto& m: cgi.heptmove) swapmatrix(m);
|
||||
IPF(initcells());
|
||||
geom3::swap_direction = +1;
|
||||
for(auto& m: cgi.heptmove) swapmatrix(m);
|
||||
currentmap->on_dim_change();
|
||||
return;
|
||||
}
|
||||
|
@ -274,6 +274,8 @@ EX namespace gp {
|
||||
if(do_adjm) {
|
||||
get_adj(wcw.at, wcw.spin) = inverse(wc.adjm) * wc1.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 set<pair<cell*, int>> gp_swapped;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 T = iso_inverse(get_where(c1)) * get_where(c2);
|
||||
|
Loading…
Reference in New Issue
Block a user