So I feel as though this could be either in the Game Programming forum or General Programming forum, but posted here out of safety, please move it if need be!
One of my on-going problems when writing code for games has been trying to neatly connect two independent systems. Such as that of a player attempting to purchase items from a store. I have a neatly written up player inventory, a store inventory, and a class that kind of acts of intermediary between the two.
Classes involved
Player Inventory
The player inventory is pretty self explanatory, has a few methods to adding/remove objects from a list of items, and a few other things to keep track of capacity and such.
Store Inventory
Same as with the player inventory, minus the need to track capacity
Store Browser
Takes a player inventory and store inventory and has functions for purchasing an item from the store which then does the swap of currency and item(s) between the store and player.
The player will be able to press a UI button that will create an instance of the ShopBrowser and open a window to display a small list of items w/prices. This is the point where I am stuck, how would I go about grabbing an instance of the players inventory and shops inventory for the ShopBrowser without resorting to some type of static/global call? I feel like I'm missing a design pattern or there is an obvious solution and I'm too close to the code to see it, cannot see the forest for the trees so to speak.
If there is any code that needs to be posted, please let me know!