Stock all special rooms at the end of level creation
This unifies the two separate special-room-stocking code paths, one in the standard dungeon generator and one in the special level generator (neither of which reacted to themed rooms, which is the reason for this commit) into the end of makelevel(), placing the special room stocking as the very last step of level creation. Under the new system, when a regular or special level decides to create a special room, it sets that room's rtype, but the room is not stocked until later. It already worked this way for special levels, so the main difference here is in the normal level generation, where the mkroom family of functions identifies and marks a room as a special room, but stops short of filling it. (I suppose perhaps the mkroom, mkzoo, mkshop family of functions would be better off changing their names to "pickroom" and so on.) This also restructures makelevel() itself a bit, but the only real change is that the paths that call makemaz don't return immediately afterward; they continue to the special room stocking code. Also, this code was lifted from fill_special_rooms, which is now not used anywhere, so it has been deleted. I don't really like how fill_ordinary_room is in mklev.c and fill_special_room is in sp_lev.c; they seem like they'd be better off in mkroom.c, but in the interest of not making unnecessary code changes, I'll just recommend it.
This commit is contained in:
committed by
Pasi Kallinen
parent
a35cbf3816
commit
3d03a472f6
12
src/mkroom.c
12
src/mkroom.c
@@ -199,8 +199,10 @@ gottype:
|
||||
topologize(sroom);
|
||||
#endif
|
||||
|
||||
/* stock the room with a shopkeeper and artifacts */
|
||||
stock_room(i, sroom);
|
||||
/* 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
|
||||
* with other special rooms. */
|
||||
sroom->needfill = FILL_NORMAL;
|
||||
}
|
||||
|
||||
/* pick an unused room, preferably with only one door */
|
||||
@@ -237,7 +239,9 @@ int type;
|
||||
|
||||
if ((sroom = pick_room(FALSE)) != 0) {
|
||||
sroom->rtype = type;
|
||||
fill_zoo(sroom);
|
||||
/* room does not get stocked at this time - it will get stocked at the
|
||||
* end of makelevel() */
|
||||
sroom->needfill = FILL_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,6 +275,8 @@ struct mkroom *sroom;
|
||||
int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
|
||||
coord mm;
|
||||
|
||||
/* Note: This doesn't check needfill; it assumes the caller has already done
|
||||
* that. */
|
||||
sh = sroom->fdoor;
|
||||
switch (type) {
|
||||
case COURT:
|
||||
|
||||
Reference in New Issue
Block a user