It took me longer than I would have liked to work on the save game code this week, and I don't even have it hooked up to the interface yet. However, I was finally able to save a game and load the data back in without crashing. The save game code itself is mostly the same as it was in GC1/AP, but I had to go through and update the places where new data types were added and old ones needed to be changed. However, now it is smart enough to check and see if the data saved is the same version as what is loaded in memory. That should save some time when loading.
Some of you may be familiar with one of our programs called SmartException, which prints out a log for us when a program crashes. I also spent some time this week working on a function that will be called when SE detects a crash, allowing me to add information to the crash log. It works, but SmartException will only call the export function if it recognizes the name of the exe, so GalCiv2 needs to be added to its list.
One of the issues that we knew that we were going to have to deal with is that with the angled map, the up key no longer represents north. And with the user able to rotate the camera, that complicates it even more. So we couldn't leave the direction keys hardcoded for directions on an overhead map. We decided to make the arrow keys move you in their respective directions in relation to the screen, rather than the world coordinates. So if you hit the up key, your screen coordinates move up. We already had a function that converts screen coordinates to world coordinates for mouse hit detection. So now when you hit the up key, it doesn't automatically send you North, whatever direction North happens to be in the world. I convert the screen coordinates for 100 pixels above the center of the screen to world coordinates, get the world coordinates for the center of the screen, and calculate the direction vector between them. That gives me the direction to send the ship in the world space.
While I was working on this, I realized that the camera was re-centering itself every time I hit a direction key, so I fixed that.
Anyway, those were the big things for this week. Have a good weekend everyone.