There’s a number of things that don’t look right, or are missing I think.
- Here’s the basic save game setup:
Notice you only ever need to make the save game if it doesn’t exist. ONCE.
You’re making a new one every time you save, which means everything gets overwritten.
-
You can’t just write to the save game, you need to read it from disk update it and then write it back ( as in the pic ). You’re only writing to it.
-
Each house needs to mange it’s own save game objects. If we take the example of ‘is the door open?’, it would be a bool in the save game. Initially it’s false, but when the player opens the door, the house needs to write that to the save game. Subsequently, when you play the game again, every house needs to read the save game and check if it’s own door is open. If it is, set the door open, otherwise leave it.
This means every house needs an id ( just an int ) because it needs to know which bool it’s supposed t use for the door.
You can keep these in an array, or you can have a ‘house save game struct’ for each house.
Does that make sense?