Original Post
I'm using the State pattern in my game, and I've got it working at a basic level. However, I have a bit of a problem. My first few States are okay - Title, Options Menu, etc. However I have just started to add in the actual gameplay states - currently 'World Map' and 'Inventory'. My question is - how should I go about sharing information between the two. For example, how would I share the relevant information such that each character is shown with the correct equipment on the world map, and then that equipment is listed in the Inventory. I don't want to have to go back and add in passing pointers for this at the BaseState level - there's no need for such things in the Title Screen, for example. Obviously all the information would have to be stored at the highest 'gameplay' state, and then distributed down. But how do I go about this? I hope someone can help, as I've canned countless mini projects at this point, either because i cannot see a solution or because any solution makes the code so convoluted as to be impossible to expand.