Refactor how maps, rooms, and corridors are generated

- Rect and Room method objects no longer need to know the map size up front
- The Map object has lists of interesting map features (I don't like this)
- Room and corridor generators take the map itself as an argument to their
  generate and apply methods
- Create a Corridor object to hold a list of points
- Add a bunch of documentation here and there
This commit is contained in:
Eryn Wells 2023-03-11 00:06:47 -08:00
parent e1523cd9c0
commit b0d91c9c5d
6 changed files with 111 additions and 62 deletions

View file

@ -57,14 +57,11 @@ class Engine:
self.rng = tcod.random.Random()
self.message_log = MessageLog()
map_size = config.map_size
map_generator = RoomsAndCorridorsGenerator(
RoomGenerator(
size=map_size,
config=RoomGenerator.Configuration(
RoomGenerator.Configuration(
rect_method=BSPRectMethod(
size=map_size,
config=BSPRectMethod.Configuration(number_of_rooms=30)),
BSPRectMethod.Configuration(number_of_rooms=30)),
room_method=OrRoomMethod(
methods=[
(0.2, CellularAtomatonRoomMethod(CellularAtomataMapGenerator.Configuration())),