mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 06:27:17 +00:00
fixed crashes caused by missing rev_dir
This commit is contained in:
parent
f2e9b371ff
commit
e13172f9ab
@ -1211,7 +1211,7 @@ EX void stabbingAttack(movei mi, eMonster who, int bonuskill IS(0)) {
|
||||
|
||||
cell *mf = mi.s;
|
||||
cell *mt = mi.t;
|
||||
int backdir = mi.rev_dir();
|
||||
int backdir = mi.rev_dir_mirror();
|
||||
|
||||
do_swords(mi, who, [&] (cell *c, int bb) { if(swordAttack(mt, who, c, bb)) numbb[bb]++, numslash++; });
|
||||
|
||||
@ -1279,7 +1279,7 @@ EX void stabbingAttack(movei mi, eMonster who, int bonuskill IS(0)) {
|
||||
if(!logical_adjacent(mt, who, c)) continue;
|
||||
eMonster mm = c->monst;
|
||||
int flag = AF_APPROACH;
|
||||
if(anglestraight(mt, backdir, t)) flag |= AF_HORNS;
|
||||
if(proper(mt, backdir) && anglestraight(mt, backdir, t)) flag |= AF_HORNS;
|
||||
if(canAttack(mt,who,c,c->monst, flag)) {
|
||||
changes.ccell(c);
|
||||
if(attackMonster(c, flag | AF_MSG, who)) numlance++;
|
||||
|
@ -2872,7 +2872,7 @@ EX namespace sword {
|
||||
cell *c2 = mi.t;
|
||||
if(!mi.proper()) return d;
|
||||
int s1 = mi.d;
|
||||
int s2 = mi.rev_dir();
|
||||
int s2 = mi.rev_dir_force();
|
||||
neighborId(c2, c1);
|
||||
if(s1 < 0 || s2 < 0) return d;
|
||||
if(SWORDDIM == 2) {
|
||||
|
@ -452,6 +452,8 @@ inline cellwalker operator+ (heptspin hs, cth_t) { return cellwalker(hs.at->c7,
|
||||
|
||||
#endif
|
||||
|
||||
EX bool proper(cell *c, int d) { return d >= 0 && d < c->type; }
|
||||
|
||||
#if HDR
|
||||
|
||||
constexpr int STRONGWIND = 99;
|
||||
@ -485,7 +487,8 @@ struct movei {
|
||||
movei rev() const { return movei(t, s, rev_dir_or(d)); }
|
||||
int dir_or(int x) const { return proper() ? d : x; }
|
||||
int rev_dir_or(int x) const { return proper() ? s->c.spin(d) : x; }
|
||||
int rev_dir() const { return s->c.spin(d); }
|
||||
int rev_dir_mirror() const { return proper() ? s->c.spin(d) : d; }
|
||||
int rev_dir_force() const { hassert(proper()); return s->c.spin(d); }
|
||||
bool mirror() { return s->c.mirror(d); }
|
||||
};
|
||||
#endif
|
||||
|
@ -765,12 +765,12 @@ EX void mountmove(const movei& mi, bool fp) {
|
||||
animateMovement(mi, LAYER_SMALL);
|
||||
if(multi::players > 1) {
|
||||
multi::player[i].at = mi.t;
|
||||
multi::player[i].spin = mi.rev_dir();
|
||||
multi::player[i].spin = mi.rev_dir_force();
|
||||
multi::flipped[i] = fp;
|
||||
}
|
||||
else {
|
||||
cwt.at = mi.t;
|
||||
cwt.spin = mi.rev_dir();
|
||||
cwt.spin = mi.rev_dir_force();
|
||||
flipplayer = fp;
|
||||
}
|
||||
afterplayermoved();
|
||||
|
Loading…
Reference in New Issue
Block a user