# HG changeset patch # User truebrain # Date 1213786696 0 # Node ID d57c2e53679bde0bd3b729e63ca4956dfdb83e64 # Parent 3a11ba88eb7c8bef93b89719a3e107cc4e2f436e (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 ;) diff -r 3a11ba88eb7c -r d57c2e53679b src/ai/api/ai_execmode.cpp --- 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); } diff -r 3a11ba88eb7c -r d57c2e53679b src/ai/api/ai_testmode.cpp --- 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); } diff -r 3a11ba88eb7c -r d57c2e53679b src/ai/api/ai_transactionmode.cpp --- 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) */