The crashes and memory errors made it impossible for me to test to see if the AI was building starbases, so my main priority this week was debugging the crashes and memory errors. I did some multi-tasking and worked on the fleets in a clean copy of the project while running the game in the AI test mode and waiting for it to crash, but more on that later.
At first, I tried using BoundsChecker, which works well for memory and resource leaks, but doesn't really help much for heap errors, which is what I was trying to find. There were places where the heap errors were more likely to show up. So running in the debugger without BoundsChecker, I started adding in a lot of calls to _CrtCheckMemory and commenting out or otherwise disabling code. While I was narrowing down the cause of the heap errors, I was able to find and fix areas of the code that caused crashes, a lockup, or was potentially non-threadsafe.
The errors and crashes ended up having nothing to do with the STL. About 20 minutes ago, I thought t that I had determined the cause of the heap errors, but the changes I made either didn't fix the problem, or there are other things still in the code causing heap errors. So I'll have to run some more tests on Monday.
I got a good portion of the fleet code in, but I'm still working on the functions that handle collision detections. I'll also still need to hook up the fleet combat window. The starbase animations are going to have to wait until I can get rid of these crashes and have enough of the fleet code in for Jesse to work on fleet battles.