1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-22 01:17:39 +00:00

fixed incorrect pushing in some geometries (also caused crash when next to Thumper in Solv)

This commit is contained in:
Zeno Rogue
2019-07-30 13:54:32 +02:00
parent 6682c760a9
commit b773ecc9d9
2 changed files with 57 additions and 14 deletions

16
hyper.h
View File

@@ -622,6 +622,11 @@ int hrand(int x);
// automatically adjust monster generation for 3D geometries
int hrand_monster(int x);
vector<int> reverse_directions(struct cell *c, int i);
// unused for heptagons
vector<int> reverse_directions(struct heptagon *c, int i) { return {i}; }
template<class T> struct walker {
T *at;
int spin;
@@ -648,13 +653,10 @@ template<class T> struct walker {
return (*this);
}
walker<T>& operator += (rev_t) {
int d = at->degree();
if(WDIM == 3 && binarytiling) {
if(spin < 4) spin = 8;
else if(spin >= 8) spin = 0;
else spin ^= 1;
}
return (*this) += d/2 + ((d&1)?hrand(2):0);
auto rd = reverse_directions(at, spin);
if(rd.size() == 1) spin = rd[0];
else spin = rd[hrand(rd.size())];
return (*this);
}
walker<T>& operator += (revstep_t) {
(*this) += rev; return (*this) += wstep;