1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-28 11:00:34 +00:00

savemem:: removed some more potential crashes

This commit is contained in:
Zeno Rogue 2022-07-17 12:42:35 +02:00
parent 7c1d083afa
commit 6225fd38e8
4 changed files with 7 additions and 4 deletions

View File

@ -454,7 +454,7 @@ EX void killMutantIvy(cell *c, eMonster who) {
changes.ccell(c);
removeIvy(c);
for(int i=0; i<c->type; i++)
if(c->move(i)->mondir == c->c.spin(i) && (isMutantIvy(c->move(i)) || c->move(i)->monst == moFriendlyIvy))
if(c->move(i) && c->move(i)->mondir == c->c.spin(i) && (isMutantIvy(c->move(i)) || c->move(i)->monst == moFriendlyIvy))
kills[c->move(i)->monst]++, killMutantIvy(c->move(i), who);
if(c->land == laClearing) clearing::imput(c);
}

View File

@ -2709,6 +2709,7 @@ EX namespace dragon {
total += c->hitpoints;
if(c->mondir == NODIR) return total;
c = c->move(c->mondir);
if(!c) return total;
}
return total;
}
@ -2737,6 +2738,7 @@ EX namespace dragon {
}
while(c->mondir != NODIR) {
c = c->move(c->mondir);
if(!c) return;
c->stuntime = 2;
}
break;

View File

@ -2539,7 +2539,7 @@ EX int cellcolor(cell *c) {
int taildist(cell *c) {
int s = 0;
while(s < 1000 && c->mondir != NODIR && isWorm(c->monst)) {
while(s < 1000 && c && c->mondir != NODIR && isWorm(c->monst)) {
s++; c = c->move(c->mondir);
}
return s;

View File

@ -817,6 +817,7 @@ EX void moveWorm(cell *c) {
while(c2->mondir != NODIR) {
allcells.push_back(c2);
c2 = c2->move(c2->mondir);
if(!c2) { allcells.pop_back(); break; }
}
allcells.push_back(c2);
for(int i=isize(allcells)-2; i>=0; i--) {
@ -865,7 +866,7 @@ EX void moveWorm(cell *c) {
}
eItem loc = treasureType(c->land);
bool spiceSeen = false;
while(c->monst == moWorm || c->monst == moWormtail || c->monst == moTentacle || c->monst == moTentacletail) {
while(c && (c->monst == moWorm || c->monst == moWormtail || c->monst == moTentacle || c->monst == moTentacletail)) {
// if(!id)
explodeAround(c);
drawParticles(c, minf[c->monst].color, 16);
@ -981,7 +982,7 @@ EX void removeIvy(cell *c) {
c->monst = moNone; // NEWYEARFIX
for(int i=0; i<c->type; i++)
// note that semi-vines don't count
if(c->move(i)->wall == waVinePlant) {
if(c->move(i) && c->move(i)->wall == waVinePlant) {
destroyHalfvine(c);
if (!do_not_touch_this_wall(c))
c->wall = waVinePlant;