mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
PIU now works in the underlying map -- underlying geometry only is too fragile
This commit is contained in:
parent
30329df05c
commit
d63b14da5c
@ -132,7 +132,7 @@ EX bool grailWasFound(cell *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
|
void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
|
||||||
if(hybri) { hybrid::in_underlying_map([&] { generateAlts(h, levs, link_cdata); }); }
|
if(hybri) { PIU ( generateAlts(h, levs, link_cdata) ); }
|
||||||
if(!h->alt) return;
|
if(!h->alt) return;
|
||||||
preventbarriers(h->c7);
|
preventbarriers(h->c7);
|
||||||
if(h->c7) forCellEx(c2, h->c7) preventbarriers(c2);
|
if(h->c7) forCellEx(c2, h->c7) preventbarriers(c2);
|
||||||
@ -187,9 +187,7 @@ EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special
|
|||||||
if(hybri) {
|
if(hybri) {
|
||||||
if(hybrid::over_sphere()) return NULL;
|
if(hybrid::over_sphere()) return NULL;
|
||||||
c = hybrid::get_where(c).first;
|
c = hybrid::get_where(c).first;
|
||||||
heptagon *res;
|
return PIU ( createAlternateMap(c, rad, firststate, special) );
|
||||||
hybrid::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); });
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for direction
|
// check for direction
|
||||||
|
12
cell.cpp
12
cell.cpp
@ -439,9 +439,7 @@ EX int celldist(cell *c) {
|
|||||||
if(hybri) {
|
if(hybri) {
|
||||||
auto w = hybrid::get_where(c);
|
auto w = hybrid::get_where(c);
|
||||||
if(sl2) w.second = 0;
|
if(sl2) w.second = 0;
|
||||||
int d;
|
return PIU ( celldist(w.first) + abs(w.second) );
|
||||||
hybrid::in_underlying_map([&] { d = celldist(w.first) + abs(w.second); });
|
|
||||||
return d;
|
|
||||||
}
|
}
|
||||||
if(nil && !quotient) return DISTANCE_UNKNOWN;
|
if(nil && !quotient) return DISTANCE_UNKNOWN;
|
||||||
if(euclid) return celldistance(currentmap->gamestart(), c);
|
if(euclid) return celldistance(currentmap->gamestart(), c);
|
||||||
@ -472,7 +470,7 @@ EX int celldistAlt(cell *c) {
|
|||||||
auto w = hybrid::get_where(c);
|
auto w = hybrid::get_where(c);
|
||||||
int d = c->master->alt && c->master->alt->alt ? c->master->alt->alt->fieldval : 0;
|
int d = c->master->alt && c->master->alt->alt ? c->master->alt->alt->fieldval : 0;
|
||||||
d = sl2 ? 0 : abs(w.second - d);
|
d = sl2 ? 0 : abs(w.second - d);
|
||||||
hybrid::in_underlying_map([&] { d += celldistAlt(w.first); });
|
PIU ( d += celldistAlt(w.first) );
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
#if CAP_BT
|
#if CAP_BT
|
||||||
@ -738,7 +736,7 @@ cdata *getHeptagonCdata_legacy(heptagon *h) {
|
|||||||
|
|
||||||
|
|
||||||
cdata *getHeptagonCdata(heptagon *h) {
|
cdata *getHeptagonCdata(heptagon *h) {
|
||||||
if(hybri) { cdata *x; hybrid::in_underlying_map([&] { x = getHeptagonCdata(h); }); return x; }
|
if(hybri) return PIU ( getHeptagonCdata(h) );
|
||||||
if(geometry == gNormal && BITRUNCATED) return getHeptagonCdata_legacy(h);
|
if(geometry == gNormal && BITRUNCATED) return getHeptagonCdata_legacy(h);
|
||||||
if(h->cdata) return h->cdata;
|
if(h->cdata) return h->cdata;
|
||||||
|
|
||||||
@ -980,9 +978,7 @@ EX int celldistance(cell *c1, cell *c2) {
|
|||||||
|
|
||||||
if(prod) {
|
if(prod) {
|
||||||
auto w1 = hybrid::get_where(c1), w2 = hybrid::get_where(c2);
|
auto w1 = hybrid::get_where(c1), w2 = hybrid::get_where(c2);
|
||||||
int d;
|
return PIU ( celldistance(w1.first, w2.first) + abs(w1.second - w2.second) );
|
||||||
hybrid::in_underlying_map([&] { d = celldistance(w1.first, w2.first) + abs(w1.second - w2.second); });
|
|
||||||
return d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_FIELD
|
#if CAP_FIELD
|
||||||
|
@ -796,10 +796,8 @@ EX void set_floor(const transmatrix& spin, hpcshape& sh) {
|
|||||||
|
|
||||||
EX int shvid(cell *c) {
|
EX int shvid(cell *c) {
|
||||||
if(hybri) {
|
if(hybri) {
|
||||||
int d;
|
|
||||||
cell *c1 = hybrid::get_where(c).first;
|
cell *c1 = hybrid::get_where(c).first;
|
||||||
hybrid::in_underlying_map([&] { d = shvid(c1); });
|
return PIU( shvid(c1) );
|
||||||
return d;
|
|
||||||
}
|
}
|
||||||
else if(GOLDBERG)
|
else if(GOLDBERG)
|
||||||
return gp::get_plainshape_id(c);
|
return gp::get_plainshape_id(c);
|
||||||
|
@ -245,7 +245,7 @@ void virtualRebase(cell*& base, T& at, const U& check) {
|
|||||||
auto w = hybrid::get_where(base);
|
auto w = hybrid::get_where(base);
|
||||||
auto d = product_decompose(check(at)).first;
|
auto d = product_decompose(check(at)).first;
|
||||||
at = mscale(at, -d);
|
at = mscale(at, -d);
|
||||||
hybrid::in_underlying_map([&] { virtualRebase(w.first, at, check); });
|
PIU( virtualRebase(w.first, at, check) );
|
||||||
if(d > cgi.plevel / 2) { w.second++; d -= cgi.plevel; }
|
if(d > cgi.plevel / 2) { w.second++; d -= cgi.plevel; }
|
||||||
if(d < -cgi.plevel / 2) { w.second--; d += cgi.plevel; }
|
if(d < -cgi.plevel / 2) { w.second--; d += cgi.plevel; }
|
||||||
at = mscale(at, +d);
|
at = mscale(at, +d);
|
||||||
|
@ -2590,7 +2590,7 @@ EX void setdist(cell *c, int d, cell *from) {
|
|||||||
auto wc = hybrid::get_where(c).first;
|
auto wc = hybrid::get_where(c).first;
|
||||||
auto wf = from ? hybrid::get_where(from).first : NULL;
|
auto wf = from ? hybrid::get_where(from).first : NULL;
|
||||||
if(c->land && !wc->land) wc->land = c->land;
|
if(c->land && !wc->land) wc->land = c->land;
|
||||||
hybrid::in_underlying_map([&] { setdist(wc, d, wf); });
|
PIU ( setdist(wc, d, wf) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(buggyGeneration) {
|
if(buggyGeneration) {
|
||||||
|
@ -1102,16 +1102,16 @@ EX namespace hybrid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void in_underlying_map(const reaction_t& f) {
|
EX hrmap* get_umap() { return ((hrmap_hybrid*)currentmap)->underlying_map; }
|
||||||
if(!hybri) f();
|
|
||||||
else hmap()->in_underlying(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
template<class T> auto in_underlying_geometry(const T& f) -> decltype(f()) {
|
template<class T> auto in_underlying_geometry(const T& f) -> decltype(f()) {
|
||||||
if(!hybri) return f();
|
if(!hybri) return f();
|
||||||
dynamicval<eGeometry> g(geometry, underlying);
|
dynamicval<eGeometry> g(geometry, underlying);
|
||||||
|
dynamicval<eGeometry> gag(actual_geometry, geometry);
|
||||||
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
|
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
|
||||||
|
dynamicval<hrmap*> gpm(pmap, currentmap);
|
||||||
|
dynamicval<hrmap*> gm(currentmap, get_umap());
|
||||||
return f();
|
return f();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1128,7 +1128,7 @@ EX namespace hybrid {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ld tf, he, alpha;
|
ld tf, he, alpha;
|
||||||
in_underlying_map([&] {
|
in_underlying_geometry([&] {
|
||||||
hyperpoint h1 = get_corner_position(c, i);
|
hyperpoint h1 = get_corner_position(c, i);
|
||||||
hyperpoint h2 = get_corner_position(c, i+1);
|
hyperpoint h2 = get_corner_position(c, i+1);
|
||||||
hyperpoint hm = mid(h1, h2);
|
hyperpoint hm = mid(h1, h2);
|
||||||
@ -1723,7 +1723,7 @@ EX namespace rots {
|
|||||||
|
|
||||||
cell *co = hybrid::get_where(centerover).first;
|
cell *co = hybrid::get_where(centerover).first;
|
||||||
|
|
||||||
hybrid::in_underlying_map([&] {
|
hybrid::in_underlying_geometry([&] {
|
||||||
cgi.require_shapes();
|
cgi.require_shapes();
|
||||||
dynamicval<int> pcc(corner_centering, cornermode ? 1 : 2);
|
dynamicval<int> pcc(corner_centering, cornermode ? 1 : 2);
|
||||||
dynamicval<bool> pf(playerfound, true);
|
dynamicval<bool> pf(playerfound, true);
|
||||||
|
@ -368,9 +368,7 @@ EX int fieldval_uniq(cell *c) {
|
|||||||
if(experimental) return 0;
|
if(experimental) return 0;
|
||||||
else if(hybri) {
|
else if(hybri) {
|
||||||
auto c1 = hybrid::get_where(c).first;
|
auto c1 = hybrid::get_where(c).first;
|
||||||
int res;
|
return PIU ( fieldval_uniq(c1) );
|
||||||
hybrid::in_underlying_map([&] { res = fieldval_uniq(c1); });
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
else if(sphere) {
|
else if(sphere) {
|
||||||
if(archimedean) return c->master->fiftyval;
|
if(archimedean) return c->master->fiftyval;
|
||||||
@ -403,9 +401,7 @@ EX int fieldval_uniq(cell *c) {
|
|||||||
EX int fieldval_uniq_rand(cell *c, int randval) {
|
EX int fieldval_uniq_rand(cell *c, int randval) {
|
||||||
if(hybri) {
|
if(hybri) {
|
||||||
auto c1 = hybrid::get_where(c).first;
|
auto c1 = hybrid::get_where(c).first;
|
||||||
int res;
|
return PIU ( fieldval_uniq_rand(c1, randval) );
|
||||||
hybrid::in_underlying_map([&] { res = fieldval_uniq_rand(c1, randval); });
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
if(sphere || euclid || NONSTDVAR)
|
if(sphere || euclid || NONSTDVAR)
|
||||||
// we do not care in these cases
|
// we do not care in these cases
|
||||||
|
@ -251,7 +251,7 @@ EX void initgame() {
|
|||||||
|
|
||||||
if(cwt.at->land == laCrossroads2) {
|
if(cwt.at->land == laCrossroads2) {
|
||||||
cell *c = cwt.at;
|
cell *c = cwt.at;
|
||||||
if(hybri) { c = hybrid::get_where(c).first; hybrid::in_underlying_map([&] { c->cmove(0); }); }
|
if(hybri) { c = hybrid::get_where(c).first; PIU( c->cmove(0) ); }
|
||||||
c->landparam = 12;
|
c->landparam = 12;
|
||||||
c->cmove(0)->landparam = 44;
|
c->cmove(0)->landparam = 44;
|
||||||
c->cmove(0)->land = laCrossroads2;
|
c->cmove(0)->land = laCrossroads2;
|
||||||
|
Loading…
Reference in New Issue
Block a user