Closed Justin08784 closed 3 years ago
Finished adding room_t *curr_room
parameter to room_generate(). Modified dependent documentation, function calls, and tests.
Justin and I met on Zoom today. We discussed how to transform room_generate into a helper function that can be used by both multi_room_generate and recursive_generate to reduce redundant code. To achieve this, we will
Summary of 28793b3:
char* dir_to_new
(direction to to-be-generated room) and char* dir_to_curr
(reverse)Openworld library compiles fine.
To-do:
Summary of ef2d4d9:
Modifications:
Bug Fixes:
random_items()
Passing a roomspec_t
whose item_hash_t *items
field is NULL (i.e. no items) to random_items() caused it to crash. cause + fix
room_generate() In test room_generate_failure, trying to generate a room in a direction that is already full (full as in a path exists for that direction) crashed the program. cause + fix
recursive_generate() recursive_gen tests for radii ≥ 2 were crashing and/or failing. cause + fix
Tests for pick_random_dir() added.
Closing Statement: The relevant pull request (#1077) has been approved, and the refactored room_generate() function as well as the new helper pick_random_direction() (along with relevant tests), has been merged into the dev branch. This marks the end of this issue.
Follow-ups:
Note: Please ignore the commits below. They were caused by a series of reverts/rollbacks relevant to another issue (#1035).
Issue Score: ✔️++
Comments: Excellent work! Your summary did a particularly good job noting the specific subtasks being accomplished in this issue.
Currently, the room_generate() function is only able to generate rooms around the
room_t* curr_room
field specified ingame_t
–– the unusual specificity of room_generate() is restricting its widespread usage. room_generate() should be converted into a general-purpose function for generating a single room around any given room in the game–– a functionality needed by higher-level functions like recursive_generate() and multi_room_generate().Subtasks include:
A new branch (
openworld/refactor-room-generate
) will be created for these changes and merged intodev
using a PR.