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