Saving and Loading HamQuest

I finally got a little bit of time again to work on HamQuest, and so I picked up where I left off, namely, the “load game” functionality.

Note to self: stop being so clever with things.

Most of my objects wound up tightly coupled, which is fine in a smallish project like this, but for the saving and loading aspects, this has been disastrous.

For example, I have a class called “CountedCollection”, which is a generic  that requires a type of thing that will be “counted”.  Really, this is just a wrapped up dictionary. It is so that I can count things like how many swords a room or a player has.

The ToXml function was easy.  blah.ToString() to send out the counted type.

The FromXml function… not so easy.  CountedCollection doesn’t necessarily count enumerated types, so the Enum.Parse function cannot be used.  I might instead be counting various string values.

So, I now have to pass a delegate to the FromXml function in order to enable conversion from string. Durp.

Quickly, this code base is turning into a slightly steaming pile of goofy code.

But, if and when there is a HamQuest II, I will avoid some of these mistakes.


One thought on “Saving and Loading HamQuest

  1. I think you’re in the same place I’m at. You’re so experienced at what you do and the answers to problems come so easily that overthinking things will almost always take you into a problem area.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s