mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
fixed potential crashes on Ivy errors
This commit is contained in:
parent
c906a2b906
commit
f3040d439c
@ -761,7 +761,8 @@ EX void killMonster(cell *c, eMonster who, flagtype deathflags IS(0)) {
|
||||
drawBubble(c, 0xFFFF00, s.get_str(100), .5);
|
||||
if(m == moIvyBranch || m == moIvyHead || m == moIvyNext) {
|
||||
int qty = 0;
|
||||
cell *c2 = c->move(c->mondir);
|
||||
cell *c2 = proper(c, c->mondir) ? c->move(c->mondir) : nullptr;
|
||||
if(!c2) c2 = c; /* should not happen */
|
||||
for(int i=0; i<c2->type; i++)
|
||||
if(c2->move(i)->monst == moIvyWait && c2->move(i)->mondir == c2->c.spin(i))
|
||||
qty++;
|
||||
|
@ -931,6 +931,8 @@ EX void ivynext(cell *c) {
|
||||
cell *c2 = c;
|
||||
while(true) {
|
||||
if(c2->monst == moIvyRoot) break;
|
||||
if(!proper(c2, c2->mondir))
|
||||
return; /* incorrect data */
|
||||
if(!isIvy(c2->monst)) break;
|
||||
if(c2->c.mirror(c2->mondir)) cw.mirrored = !cw.mirrored;
|
||||
c2 = c2->move(c2->mondir);
|
||||
@ -1031,6 +1033,7 @@ EX void moveivy() {
|
||||
mto->monst = moIvyHead; co->monst = moIvyBranch;
|
||||
}
|
||||
}
|
||||
else if(!proper(co, co->mondir) || !co->move(co->mondir)) ; /* should not happen */
|
||||
else if(co->move(co->mondir)->monst != moIvyRoot) {
|
||||
// shrink useless branches, but do not remove them completely (at the root)
|
||||
if(co->monst == moIvyHead) co->move(co->mondir)->monst = moIvyHead;
|
||||
|
Loading…
Reference in New Issue
Block a user