Simplify empobj_chr_name() oops recovery

Return something usable instead of null.  Matches obj_nameof().  Fixes
those callers that neglected to check the value.
This commit is contained in:
Markus Armbruster 2008-02-25 21:15:50 +01:00
parent f99adf4b3c
commit 966b881667
2 changed files with 3 additions and 5 deletions

View file

@ -92,7 +92,7 @@ empobj_chr_name(struct empobj *gp)
return dchr[(int)gp->type].d_name;
}
CANT_REACH();
return NULL;
return "The Beast";
}
int

View file

@ -254,8 +254,7 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp)
if (ef_mappable[i] == EF_NUKE)
wmap[y][x] = 'N';
else {
if ((name = empobj_chr_name(&unit.gen)) == NULL)
return RET_FAIL;
name = empobj_chr_name(&unit.gen);
wmap[y][x] = *name & ~0x20;
}
}
@ -361,8 +360,7 @@ unit_map(int unit_type, int uid, struct nstr_sect *nsp, char *originp)
if (unit_type == EF_NUKE)
*originp = 'n';
else {
if ((name = empobj_chr_name(&unit.gen)) == NULL)
return RET_FAIL;
name = empobj_chr_name(&unit.gen);
*originp = *name;
}