(svn r13563) [NoAI] -Fix: added some asserts to ensure sanity of AI*Modes.
-Note: it has to be said that currently 'scoping' is broken, and it is possible to cause an assert. But it is better to have an assert, than to build stuff for real in TestMode ;)
--- a/src/ai/api/ai_execmode.cpp Tue Jun 17 23:16:33 2008 +0000
+++ b/src/ai/api/ai_execmode.cpp Wed Jun 18 10:58:16 2008 +0000
@@ -21,5 +21,6 @@
AIExecMode::~AIExecMode()
{
+ assert(this->GetDoCommandModeInstance() == this);
this->SetDoCommandMode(this->last_mode, this->last_instance);
}
--- a/src/ai/api/ai_testmode.cpp Tue Jun 17 23:16:33 2008 +0000
+++ b/src/ai/api/ai_testmode.cpp Wed Jun 18 10:58:16 2008 +0000
@@ -21,5 +21,6 @@
AITestMode::~AITestMode()
{
+ assert(this->GetDoCommandModeInstance() == this);
this->SetDoCommandMode(this->last_mode, this->last_instance);
}
--- a/src/ai/api/ai_transactionmode.cpp Tue Jun 17 23:16:33 2008 +0000
+++ b/src/ai/api/ai_transactionmode.cpp Wed Jun 18 10:58:16 2008 +0000
@@ -39,6 +39,7 @@
AITransactionMode::~AITransactionMode()
{
+ assert(this->GetDoCommandModeInstance() == this);
this->SetDoCommandMode(this->last_mode, this->last_instance);
/* Clean up the command_stack nicely (as in: free the cmd_text) */