Convert ProductCatalogue
from static
class to regular class
#1337
Labels
intermediate
A task that doesn't require a deep understanding of the code base
task
Task to be completed.
Milestone
Related:
StructureCatalogue
fromstatic
class to regular class #1336The
init
function is basically already a constructor. We should consider using a normal class as opposed to declaring everythingstatic
. I suspect the current design was to make it convenient to access the list of available products. We would get the same convenience from using a global variable for the class instance.In the future, if we split some sort of game state object out of
MapViewState
(minus the UI stuff), we could attach theProductCatalogue
there. This may even allow for cleaner loading of saved games, where if there is an error, you could just go back to the current game. That isn't really possible with static objects, since you're overwriting global state during a load, and if there's an error during load, there's no possibility to abort and return to the previous game.The text was updated successfully, but these errors were encountered: