mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-04 08:14:08 +00:00
savemem:: removed some more potential crashes
This commit is contained in:
parent
7c1d083afa
commit
6225fd38e8
@ -454,7 +454,7 @@ EX void killMutantIvy(cell *c, eMonster who) {
|
|||||||
changes.ccell(c);
|
changes.ccell(c);
|
||||||
removeIvy(c);
|
removeIvy(c);
|
||||||
for(int i=0; i<c->type; i++)
|
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);
|
kills[c->move(i)->monst]++, killMutantIvy(c->move(i), who);
|
||||||
if(c->land == laClearing) clearing::imput(c);
|
if(c->land == laClearing) clearing::imput(c);
|
||||||
}
|
}
|
||||||
|
@ -2709,6 +2709,7 @@ EX namespace dragon {
|
|||||||
total += c->hitpoints;
|
total += c->hitpoints;
|
||||||
if(c->mondir == NODIR) return total;
|
if(c->mondir == NODIR) return total;
|
||||||
c = c->move(c->mondir);
|
c = c->move(c->mondir);
|
||||||
|
if(!c) return total;
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
@ -2737,6 +2738,7 @@ EX namespace dragon {
|
|||||||
}
|
}
|
||||||
while(c->mondir != NODIR) {
|
while(c->mondir != NODIR) {
|
||||||
c = c->move(c->mondir);
|
c = c->move(c->mondir);
|
||||||
|
if(!c) return;
|
||||||
c->stuntime = 2;
|
c->stuntime = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2539,7 +2539,7 @@ EX int cellcolor(cell *c) {
|
|||||||
|
|
||||||
int taildist(cell *c) {
|
int taildist(cell *c) {
|
||||||
int s = 0;
|
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);
|
s++; c = c->move(c->mondir);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
@ -817,6 +817,7 @@ EX void moveWorm(cell *c) {
|
|||||||
while(c2->mondir != NODIR) {
|
while(c2->mondir != NODIR) {
|
||||||
allcells.push_back(c2);
|
allcells.push_back(c2);
|
||||||
c2 = c2->move(c2->mondir);
|
c2 = c2->move(c2->mondir);
|
||||||
|
if(!c2) { allcells.pop_back(); break; }
|
||||||
}
|
}
|
||||||
allcells.push_back(c2);
|
allcells.push_back(c2);
|
||||||
for(int i=isize(allcells)-2; i>=0; i--) {
|
for(int i=isize(allcells)-2; i>=0; i--) {
|
||||||
@ -865,7 +866,7 @@ EX void moveWorm(cell *c) {
|
|||||||
}
|
}
|
||||||
eItem loc = treasureType(c->land);
|
eItem loc = treasureType(c->land);
|
||||||
bool spiceSeen = false;
|
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)
|
// if(!id)
|
||||||
explodeAround(c);
|
explodeAround(c);
|
||||||
drawParticles(c, minf[c->monst].color, 16);
|
drawParticles(c, minf[c->monst].color, 16);
|
||||||
@ -981,7 +982,7 @@ EX void removeIvy(cell *c) {
|
|||||||
c->monst = moNone; // NEWYEARFIX
|
c->monst = moNone; // NEWYEARFIX
|
||||||
for(int i=0; i<c->type; i++)
|
for(int i=0; i<c->type; i++)
|
||||||
// note that semi-vines don't count
|
// note that semi-vines don't count
|
||||||
if(c->move(i)->wall == waVinePlant) {
|
if(c->move(i) && c->move(i)->wall == waVinePlant) {
|
||||||
destroyHalfvine(c);
|
destroyHalfvine(c);
|
||||||
if (!do_not_touch_this_wall(c))
|
if (!do_not_touch_this_wall(c))
|
||||||
c->wall = waVinePlant;
|
c->wall = waVinePlant;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user