xienwolf
Deity
I've had a "phantom crash" going on with my code for a while now. It only happens when you try to load a game after having already played a game for a few turns (loading from ingame or from main menu. Any attempt to initialize a game without first going back to the desktop).
I finally got the source of the break to reveal itself, and it reveals to me a lack in my understanding of when/where to delete arrays.
So, the function SAFE_DELETE_ARRAY is run either in CvPlayerAI::~CvPlayerAI() or void CvPlayerAI::AI_uninit(). My error occurs right after AI_uninit() should be run during void CvPlayerAI::AI_reset(bool bConstructor).
Now, I've added a few arrays to CvPlayerAI, and I delete all of them during ~CvPlayerAI right now. They haven't caused me any problems before, but now that I have added additional Barbarian Civilizations, I am getting an issue with these sections of the code. I am curious if it is something to do with deleting my arrays in the wrong location, so hope someone can shed some light on what the difference is between erasing the array in ~CvPlayerAI and erasing it in AI_uninit() (other than the fact that uninit is run from a lot more places in the code, thus happens considerably more often)
I finally got the source of the break to reveal itself, and it reveals to me a lack in my understanding of when/where to delete arrays.
So, the function SAFE_DELETE_ARRAY is run either in CvPlayerAI::~CvPlayerAI() or void CvPlayerAI::AI_uninit(). My error occurs right after AI_uninit() should be run during void CvPlayerAI::AI_reset(bool bConstructor).
Now, I've added a few arrays to CvPlayerAI, and I delete all of them during ~CvPlayerAI right now. They haven't caused me any problems before, but now that I have added additional Barbarian Civilizations, I am getting an issue with these sections of the code. I am curious if it is something to do with deleting my arrays in the wrong location, so hope someone can shed some light on what the difference is between erasing the array in ~CvPlayerAI and erasing it in AI_uninit() (other than the fact that uninit is run from a lot more places in the code, thus happens considerably more often)