simplify simplify #overview shop handling

This commit is contained in:
PatR
2024-05-09 11:43:01 -07:00
parent 4927b2cc1b
commit 71cfcc6229

View File

@@ -2556,14 +2556,16 @@ save_exclusions(NHFILE *nhfp)
struct exclusion_zone *ez; struct exclusion_zone *ez;
int nez; int nez;
for (nez = 0, ez = ge.exclusion_zones; ez; ez = ez->next, ++nez) ; for (nez = 0, ez = ge.exclusion_zones; ez; ez = ez->next, ++nez)
;
if (nhfp->structlevel) if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &nez, sizeof nez); bwrite(nhfp->fd, (genericptr_t) &nez, sizeof nez);
for (ez = ge.exclusion_zones; ez; ez = ez->next) { for (ez = ge.exclusion_zones; ez; ez = ez->next) {
if (nhfp->structlevel) { if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &ez->zonetype, sizeof ez->zonetype); bwrite(nhfp->fd, (genericptr_t) &ez->zonetype,
sizeof ez->zonetype);
bwrite(nhfp->fd, (genericptr_t) &ez->lx, sizeof ez->lx); bwrite(nhfp->fd, (genericptr_t) &ez->lx, sizeof ez->lx);
bwrite(nhfp->fd, (genericptr_t) &ez->ly, sizeof ez->ly); bwrite(nhfp->fd, (genericptr_t) &ez->ly, sizeof ez->ly);
bwrite(nhfp->fd, (genericptr_t) &ez->hx, sizeof ez->hx); bwrite(nhfp->fd, (genericptr_t) &ez->hx, sizeof ez->hx);
@@ -3409,14 +3411,15 @@ staticfn const char *
shop_string(int rtype) shop_string(int rtype)
{ {
extern const struct shclass shtypes[]; /* defined in shknam.c */ extern const struct shclass shtypes[]; /* defined in shknam.c */
int shoptype = rtype - SHOPBASE; /* convert room type to shop type */
const char *str = "shop?"; /* catchall */ const char *str = "shop?"; /* catchall */
if (rtype < SHOPBASE) { if (shoptype < 0) {
str = "untended shop"; str = "untended shop";
} else if (shtypes[rtype - SHOPBASE].annotation) { } else if (shtypes[shoptype].annotation) {
str = shtypes[rtype - SHOPBASE].annotation; str = shtypes[shoptype].annotation;
} else if (shtypes[rtype - SHOPBASE].name) { } else if (shtypes[shoptype].name) {
str = shtypes[rtype - SHOPBASE].name; str = shtypes[shoptype].name;
} }
return str; return str;
} }