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

@@ -368,7 +368,7 @@ Initialize the map with a random generator of a certain type.
Example:
des.level_init({ style = "solidfill", fg = " " });
des.level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 })
des.level_init({ style = "mines", fg = ".", bg = "}", smoothed=true, joined=true, lit=0 })
des.level_init({ style = "maze", corrwid = 3, wallthick = 1, deadends = false });
=== levregion
@@ -553,7 +553,7 @@ fields:
| yalign | Vertical alignment on a rough 3x3 grid. Default is "random".
| lit | Is the room lit or unlit? Defaults to -1 (random).
| filled | Is the room filled as per the room type. Defaults to 1 (filled).
| joined | Is the room joined to the rest of the level with corridors? Default is 1 (joined).
| joined | Is the room joined to the rest of the level with corridors? Default is true.
| contents | A function called with one parameter, a table with "width" and "height", the room width and height, excluding the walls. All coordinates in the function will be relative to the room.
|===