mkroom.c oddity

Replace a strange pline() with impossible().

Remove some ancient MAC special handling for getenv("SHOPTYPE").
This commit is contained in:
PatR
2021-02-11 15:38:26 -08:00
parent 79ca1dc422
commit 2e69789e6d
+13 -15
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 mkroom.c $NHDT-Date: 1596498184 2020/08/03 23:43:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.45 $ */ /* NetHack 3.7 mkroom.c $NHDT-Date: 1613086701 2021/02/11 23:38:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.52 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -45,9 +45,9 @@ isbig(struct mkroom* sroom)
void void
do_mkroom(int roomtype) do_mkroom(int roomtype)
{ {
if (roomtype >= SHOPBASE) if (roomtype >= SHOPBASE) {
mkshop(); /* someday, we should be able to specify shop type */ mkshop(); /* someday, we should be able to specify shop type */
else } else {
switch (roomtype) { switch (roomtype) {
case COURT: case COURT:
mkzoo(COURT); mkzoo(COURT);
@@ -82,6 +82,7 @@ do_mkroom(int roomtype)
default: default:
impossible("Tried to make a room of type %d.", roomtype); impossible("Tried to make a room of type %d.", roomtype);
} }
}
} }
static void static void
@@ -93,7 +94,6 @@ mkshop(void)
/* first determine shoptype */ /* first determine shoptype */
if (wizard) { if (wizard) {
#ifndef MAC
ep = nh_getenv("SHOPTYPE"); ep = nh_getenv("SHOPTYPE");
if (ep) { if (ep) {
if (*ep == 'z' || *ep == 'Z') { if (*ep == 'z' || *ep == 'Z') {
@@ -146,23 +146,21 @@ mkshop(void)
else else
i = -1; i = -1;
} }
#endif
} }
#ifndef MAC
gottype: gottype:
#endif
for (sroom = &g.rooms[0];; sroom++) { for (sroom = &g.rooms[0];; sroom++) {
if (sroom->hx < 0) if (sroom->hx < 0)
return; return;
if (sroom - g.rooms >= g.nroom) { if (sroom - g.rooms >= g.nroom) {
pline("g.rooms not closed by -1?"); impossible("rooms[] not closed by -1?");
return; return;
} }
if (sroom->rtype != OROOM) if (sroom->rtype != OROOM)
continue; continue;
if (has_dnstairs(sroom) || has_upstairs(sroom)) if (has_dnstairs(sroom) || has_upstairs(sroom))
continue; continue;
if ((wizard && ep && sroom->doorct != 0) || sroom->doorct == 1) if (sroom->doorct == 1 || (wizard && ep && sroom->doorct != 0))
break; break;
} }
if (!sroom->rlit) { if (!sroom->rlit) {
@@ -197,9 +195,9 @@ gottype:
topologize(sroom); topologize(sroom);
#endif #endif
/* The shop used to be stocked here, but this no longer happens - all we do /* The shop used to be stocked here, but this no longer happens--all we do
* is set its rtype, and it gets stocked at the end of makelevel() along is set its rtype, and it gets stocked at the end of makelevel() along
* with other special rooms. */ with other special rooms. */
sroom->needfill = FILL_NORMAL; sroom->needfill = FILL_NORMAL;
} }
@@ -269,8 +267,8 @@ fill_zoo(struct mkroom* sroom)
int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET); int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
coord mm; coord mm;
/* Note: This doesn't check needfill; it assumes the caller has already done /* Note: This doesn't check needfill; it assumes the caller has already
* that. */ done that. */
sh = sroom->fdoor; sh = sroom->fdoor;
switch (type) { switch (type) {
case COURT: case COURT: