Convert room 'joined' and 'needjoining' into booleans

des.region() accepted booleans for the joined field, whereas des.room
accepted xchars. These were only being used as truth values, so this
converts the room ones into booleans for consistency. I don't think
accidentally using an int or a boolean wrongly would actually crash the
level generator, but consistency is good.

This converts an schar field in struct mkroom into a boolean; on most
systems these are probably 1-byte types and save files won't be broken,
but it might be best to treat this as a save breaker anyway.
This commit is contained in:
copperwater
2021-02-18 18:55:10 -05:00
committed by Pasi Kallinen
parent fa3041c9f9
commit 18dc88505d
6 changed files with 12 additions and 11 deletions

View File

@@ -65,7 +65,7 @@ mkroom_cmp(const genericptr vx, const genericptr vy)
}
/* Return TRUE if a door placed at (x, y) which otherwise passes okdoor()
* checks would be connecting into an area that was declared as joined = 0.
* checks would be connecting into an area that was declared as joined = false.
* Checking for this in finddpos() enables us to have rooms with sub-areas
* (such as shops) that will never randomly generate unwanted doors in order
* to connect them up to other areas.

View File

@@ -3480,7 +3480,7 @@ lspo_level_flags(lua_State* L)
}
/* level_init({ style = "solidfill", fg = " " }); */
/* level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 }) */
/* level_init({ style = "mines", fg = ".", bg = "}", smoothed=true, joined=true, lit=0 }) */
int
lspo_level_init(lua_State* L)
{
@@ -3694,7 +3694,7 @@ lspo_room(lua_State* L)
tmproom.rlit = get_table_int_opt(L, "lit", -1);
/* theme rooms default to unfilled */
tmproom.needfill = get_table_int_opt(L, "filled", g.in_mk_themerooms ? 0 : 1);
tmproom.joined = get_table_int_opt(L, "joined", 1);
tmproom.joined = get_table_boolean_opt(L, "joined", TRUE);
if (!g.coder->failed_room[g.coder->n_subroom - 1]) {
tmpcr = build_room(&tmproom, g.coder->croom);
@@ -5430,7 +5430,7 @@ lspo_region(lua_State* L)
* "lvflags_only" ==> filled=2, probably in a get_table_needfill_opt */
needfill = get_table_int_opt(L, "filled", 0);
irregular = get_table_boolean_opt(L, "irregular", 0);
joined = get_table_boolean_opt(L, "joined", 1);
joined = get_table_boolean_opt(L, "joined", TRUE);
do_arrival_room = get_table_boolean_opt(L, "arrival_room", 0);
rtype = get_table_roomtype_opt(L, "type", OROOM);
rlit = get_table_int_opt(L, "lit", -1);