Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ProductCatalogue from static class to regular class #1337

Open
DanRStevens opened this issue May 4, 2023 · 0 comments
Open

Convert ProductCatalogue from static class to regular class #1337

DanRStevens opened this issue May 4, 2023 · 0 comments
Labels
intermediate A task that doesn't require a deep understanding of the code base task Task to be completed.
Milestone

Comments

@DanRStevens
Copy link
Member

Related:

The init function is basically already a constructor. We should consider using a normal class as opposed to declaring everything static. 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 the ProductCatalogue 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.

@ldicker83 ldicker83 added this to the v0.9.5 milestone May 17, 2024
@ldicker83 ldicker83 added task Task to be completed. intermediate A task that doesn't require a deep understanding of the code base labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intermediate A task that doesn't require a deep understanding of the code base task Task to be completed.
Projects
None yet
Development

No branches or pull requests

2 participants