Sunday, September 24, 2006

Declarations Tab

As you can see, the declarations tab on the Kingdoms View Window is starting to take shape. I'm not 100% happy with the code populating the pane, but the functionality is complete.

Adding the declaration order required a lot more effort than I initially expected. There are several (undocumented) features that Orders have to properly implement to work correctly, and I stumbled upon most of them through trial and error. I now have a TestCase documenting the required steps, so work on future orders (such as trading with a partner) will be easier.

I also added close to 40 more tests to get a handle on how each game archives players. There was one critical aspect I didn't realise until it was too late - players cannot be referenced until they are loaded. The initial plan was to persist ally & enemy declarations using the target player. Unfortunately, if the ally was not already loaded, the game coughed. I decided to lazy load the allies & enemies - internally I store the kingdom code, and then find the players at the last second as the game requires them. It's a little more complicated, but I'm happy with the results. I'm also happy I had junit tests in place for the archiving - I changed the implementation, and the tests stayed green. This gave me confidence that everything still worked.

0 Comments:

Post a Comment

<< Home