I had limited time available this week, but made some progress on the multi-system refactoring work I started two weeks ago.
I completed refactoring UI panels (inventory, item/actor/object detail) and prompts (select cell for targeted actions such as shooting and throwing). These are now maintained in a stack with input handling controlled by the UI panel/prompt at the top of the stack. The code is much cleaner now and the recurring bugs with user input, such as mouse clicks propagating to multiple controls in certain situations, are gone.
I also consolidated the methods that return a collection of cells into a single utility class. Many of these methods are used for procedural map generation to get cells in a specific pattern, such as adjacent cells, room perimeter cells, cells in a rectangle, etc.
Finally, I replaced multiple instances of mini state machines and wait logic with event handlers. The former pattern was messy and difficult to maintain. As a turn-based game, there still needs to be some state management and centralized control, but within that framework, there are many opportunities to use event handling to simplify logic.
Next week is when I originally planned to have the major refactoring done. The scope has expanded and that won’t be possible now, but I should have more time available to get more done than I did this week.