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/sp_lev.c
12
src/sp_lev.c
@@ -40,7 +40,6 @@ static void NDECL(remove_boundary_syms);
|
||||
static void FDECL(set_door_orientation, (int, int));
|
||||
static void FDECL(maybe_add_door, (int, int, struct mkroom *));
|
||||
static void NDECL(link_doors_rooms);
|
||||
static void NDECL(fill_special_rooms);
|
||||
static int NDECL(rnddoor);
|
||||
static int NDECL(rndtrap);
|
||||
static void FDECL(get_location, (schar *, schar *, int, struct mkroom *));
|
||||
@@ -1035,16 +1034,6 @@ link_doors_rooms()
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fill_special_rooms()
|
||||
{
|
||||
int tmpi, m;
|
||||
|
||||
for (tmpi = 0; tmpi < g.nroom; tmpi++) {
|
||||
fill_special_room(&g.rooms[tmpi]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Choose randomly the state (nodoor, open, closed or locked) for a door
|
||||
*/
|
||||
@@ -6426,7 +6415,6 @@ const char *name;
|
||||
goto give_up;
|
||||
|
||||
link_doors_rooms();
|
||||
fill_special_rooms();
|
||||
remove_boundary_syms();
|
||||
|
||||
/* TODO: ensure_way_out() needs rewrite */
|
||||
|
||||
Reference in New Issue
Block a user