I had previously coded up a bunch of library code for my roguelike game engine. My first idea was to hold all items in a big array. When the items were picked up and them wielded, the item state would change. Then I had a bunch of custom code that switched on the state.
The problem was that most items get removed and regenerated during change of dungeon level. I did not want my players inventory and equipment to disappear when the dungeon level changed. So I needed a refactoring. I decided to create separate containers for the player inventory and the player equipment. Today I refactored all the code to use this new design.
I was pleased to see that much code was simplified. Many functions were no longer even needed. The code was getting really clean. This must mean the redesign was a move in the positive direction. This shall also allow easy changes of inventory/equipment rules in the future.
Not sure what I am going to do next. I am still riding a high of a good code refactoring. It is probably time to implement some more functionality in the dungeon.
Check Your Subroutines - We are delivering our latest release to internal test today. Had a code review yesterday. Many issues were found. We are fixing the highest priority probl...
1 week ago