Bufix null-pointers in regionname

This commit is contained in:
Enno Rehling 2003-06-22 10:13:22 +00:00
parent 1b84f9d61f
commit f9657cf936
3 changed files with 8 additions and 7 deletions

View File

@ -161,7 +161,7 @@ int
region_x(const region *r, const faction *f) region_x(const region *r, const faction *f)
{ {
plane *pl; plane *pl;
assert(r!=NULL);
pl = getplane(r); pl = getplane(r);
return r->x - ursprung_x(f, pl, r) - plane_center_x(pl); return r->x - ursprung_x(f, pl, r) - plane_center_x(pl);
} }
@ -170,7 +170,7 @@ int
region_y(const region *r, const faction *f) region_y(const region *r, const faction *f)
{ {
plane *pl; plane *pl;
assert(r!=NULL);
pl = getplane(r); pl = getplane(r);
return r->y - plane_center_y(pl) - ursprung_y(f, pl, r); return r->y - plane_center_y(pl) - ursprung_y(f, pl, r);
} }
@ -179,7 +179,7 @@ void
set_ursprung(faction *f, int id, int x, int y) set_ursprung(faction *f, int id, int x, int y)
{ {
ursprung *ur; ursprung *ur;
assert(f!=NULL);
for(ur=f->ursprung;ur;ur=ur->next) { for(ur=f->ursprung;ur;ur=ur->next) {
if(ur->id == id) { if(ur->id == id) {
ur->x += x; ur->x += x;

View File

@ -75,8 +75,9 @@ regionname(const region * r, const faction * f)
{ {
static char buf[65]; static char buf[65];
plane *pl = getplane(r); plane *pl = getplane(r);
if (r==NULL) {
if (f == NULL) { strcpy(buf, "(null)");
} else if (f == NULL) {
strncpy(buf, rname(r, NULL), 65); strncpy(buf, rname(r, NULL), 65);
} else if (pl && fval(pl, PFL_NOCOORDS)) { } else if (pl && fval(pl, PFL_NOCOORDS)) {
strncpy(buf, rname(r, f->locale), 65); strncpy(buf, rname(r, f->locale), 65);

View File

@ -5,8 +5,8 @@
<arg name="number" type="int"></arg> <arg name="number" type="int"></arg>
<arg name="race" type="race"></arg> <arg name="race" type="race"></arg>
</type> </type>
<text locale="de">"$if($isnull($region),"In $region($region)","Es") wurde$if($eq($number,1),"","n") $number $race($race,$number) gesichtet."</text> <text locale="de">"$if($isnull($region),"Es","In $region($region)") wurde$if($eq($number,1),"","n") $number $race($race,$number) gesichtet."</text>
<text locale="en">"In $region($region), $number $race($race,$number) were discovered."</text> <text locale="en">$if($isnull($region),"","In $region($region), ")$number $race($race,$number) were discovered."</text>
</message> </message>
<message name="mallorn_effect" section="magic"> <message name="mallorn_effect" section="magic">
<type> <type>