Safety-Check, in case region names are too long despite all the checks.

This commit is contained in:
Enno Rehling 2004-09-12 09:55:47 +00:00
parent dde02d16e7
commit 2b0a40ab22
1 changed files with 5 additions and 2 deletions

View File

@ -962,9 +962,12 @@ f_regionid(const region * r, const faction * f)
else { else {
pl = getplane(r); pl = getplane(r);
if(pl && fval(pl,PFL_NOCOORDS)) { if(pl && fval(pl,PFL_NOCOORDS)) {
sprintf(buf, "%s", rname(r, f->locale)); strncpy(buf, rname(r, f->locale), NAMESIZE);
buf[NAMESIZE]=0;
} else { } else {
sprintf(buf, "%s (%d,%d%s%s)", rname(r, f->locale), region_x(r,f), region_y(r,f), pl?",":"", pl?pl->name:""); strncpy(buf, rname(r, f->locale), NAMESIZE);
buf[NAMESIZE]=0;
sprintf(buf+strlen(buf), " (%d,%d%s%s)", region_x(r,f), region_y(r,f), pl?",":"", pl?pl->name:"");
} }
} }