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,6 +937,7 @@ movearound(short rx, short ry) {
|
|||
if (r==NULL) break;
|
||||
if (!Tagged) {
|
||||
const terrain_type * terrain = select_terrain(r->terrain);
|
||||
if (terrain!=NULL) {
|
||||
if (hx>-1) {
|
||||
int Rx,Ry;
|
||||
Rx=rx; Ry=ry;
|
||||
|
@ -948,19 +949,25 @@ movearound(short rx, short ry) {
|
|||
if (c) terraform_region(c, terrain);
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
terraform_region(r, terrain);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const terrain_type * terrain = select_terrain(r->terrain);
|
||||
for (tag=Tagged; tag; tag=tag->next)
|
||||
if (terrain!=NULL) {
|
||||
for (tag=Tagged; tag; tag=tag->next) {
|
||||
terraform_region(tag->r, terrain);
|
||||
}
|
||||
}
|
||||
}
|
||||
ch = -9;
|
||||
modified = 1;
|
||||
break;
|
||||
case 'Z':
|
||||
if (!Tagged) {
|
||||
const terrain_type * terrain = select_terrain(r->terrain);
|
||||
if (terrain!=NULL) {
|
||||
if (hx>-1) {
|
||||
short Rx,Ry;
|
||||
Rx=rx; Ry=ry;
|
||||
|
@ -974,11 +981,14 @@ movearound(short rx, short ry) {
|
|||
}
|
||||
} else {
|
||||
r->terrain = terrain;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const terrain_type * terrain = select_terrain(r->terrain);
|
||||
if (terrain!=NULL) {
|
||||
for (tag=Tagged; tag; tag=tag->next) {
|
||||
tag->r->terrain = terrain;
|
||||
}
|
||||
}
|
||||
}
|
||||
ch = -9;
|
||||
|
|
Loading…
Reference in a new issue