forked from github/server
null-pointer check if no terrain was picked for terraforming
This commit is contained in:
parent
881f1ff2df
commit
802228db41
1 changed files with 36 additions and 26 deletions
|
@ -937,23 +937,29 @@ movearound(short rx, short ry) {
|
||||||
if (r==NULL) break;
|
if (r==NULL) break;
|
||||||
if (!Tagged) {
|
if (!Tagged) {
|
||||||
const terrain_type * terrain = select_terrain(r->terrain);
|
const terrain_type * terrain = select_terrain(r->terrain);
|
||||||
if (hx>-1) {
|
if (terrain!=NULL) {
|
||||||
int Rx,Ry;
|
if (hx>-1) {
|
||||||
Rx=rx; Ry=ry;
|
int Rx,Ry;
|
||||||
if (rx>Hx) { a=Hx; Hx=Rx; rx=a; }
|
Rx=rx; Ry=ry;
|
||||||
if (ry>Hy) { a=Hy; Hy=Ry; ry=a; }
|
if (rx>Hx) { a=Hx; Hx=Rx; rx=a; }
|
||||||
for (a=Rx; a<=Hx; a++) {
|
if (ry>Hy) { a=Hy; Hy=Ry; ry=a; }
|
||||||
for (b=Ry; b<=Hy; b++) {
|
for (a=Rx; a<=Hx; a++) {
|
||||||
c = findregion(a,b);
|
for (b=Ry; b<=Hy; b++) {
|
||||||
if (c) terraform_region(c, terrain);
|
c = findregion(a,b);
|
||||||
|
if (c) terraform_region(c, terrain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
terraform_region(r, terrain);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
terraform_region(r, terrain);
|
|
||||||
} else {
|
} else {
|
||||||
const terrain_type * terrain = select_terrain(r->terrain);
|
const terrain_type * terrain = select_terrain(r->terrain);
|
||||||
for (tag=Tagged; tag; tag=tag->next)
|
if (terrain!=NULL) {
|
||||||
terraform_region(tag->r, terrain);
|
for (tag=Tagged; tag; tag=tag->next) {
|
||||||
|
terraform_region(tag->r, terrain);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ch = -9;
|
ch = -9;
|
||||||
modified = 1;
|
modified = 1;
|
||||||
|
@ -961,24 +967,28 @@ movearound(short rx, short ry) {
|
||||||
case 'Z':
|
case 'Z':
|
||||||
if (!Tagged) {
|
if (!Tagged) {
|
||||||
const terrain_type * terrain = select_terrain(r->terrain);
|
const terrain_type * terrain = select_terrain(r->terrain);
|
||||||
if (hx>-1) {
|
if (terrain!=NULL) {
|
||||||
short Rx,Ry;
|
if (hx>-1) {
|
||||||
Rx=rx; Ry=ry;
|
short Rx,Ry;
|
||||||
if (rx>Hx) { a=Hx; Hx=Rx; rx=a; }
|
Rx=rx; Ry=ry;
|
||||||
if (ry>Hy) { a=Hy; Hy=Ry; ry=a; }
|
if (rx>Hx) { a=Hx; Hx=Rx; rx=a; }
|
||||||
for (a=Rx; a<=Hx; a++) {
|
if (ry>Hy) { a=Hy; Hy=Ry; ry=a; }
|
||||||
for (b=Ry; b<=Hy; b++) {
|
for (a=Rx; a<=Hx; a++) {
|
||||||
c = findregion(a,b);
|
for (b=Ry; b<=Hy; b++) {
|
||||||
if (c) c->terrain = terrain;
|
c = findregion(a,b);
|
||||||
|
if (c) c->terrain = terrain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
r->terrain = terrain;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
r->terrain = terrain;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const terrain_type * terrain = select_terrain(r->terrain);
|
const terrain_type * terrain = select_terrain(r->terrain);
|
||||||
for (tag=Tagged; tag; tag=tag->next) {
|
if (terrain!=NULL) {
|
||||||
tag->r->terrain = terrain;
|
for (tag=Tagged; tag; tag=tag->next) {
|
||||||
|
tag->r->terrain = terrain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ch = -9;
|
ch = -9;
|
||||||
|
|
Loading…
Reference in a new issue