From 1d3adb2b66989630b2a3c201ac1210a886d41a51 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 5 Jun 2010 12:16:12 +0000 Subject: (svn r19931) -Fix (r19914): Convert assertion in Backup<> destructor into DEBUG() output. It was triggered on exceptions, especially when aborting world generation. --- src/ai/ai_core.cpp | 12 ++++++------ src/ai/ai_gui.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/ai') diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index f61bc058c..8d333877f 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -69,7 +69,7 @@ assert(_settings_game.difficulty.competitor_speed <= 4); if ((AI::frame_counter & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return; - Backup cur_company(_current_company); + Backup cur_company(_current_company, FILE_LINE); const Company *c; FOR_ALL_COMPANIES(c) { if (c->is_ai) { @@ -96,7 +96,7 @@ { if (_networking && !_network_server) return; - Backup cur_company(_current_company, company); + Backup cur_company(_current_company, company, FILE_LINE); Company *c = Company::Get(company); delete c->ai_instance; @@ -112,7 +112,7 @@ { if (_networking && !_network_server) return; - Backup cur_company(_current_company, company); + Backup cur_company(_current_company, company, FILE_LINE); Company::Get(company)->ai_instance->Suspend(); cur_company.Restore(); @@ -201,7 +201,7 @@ } /* Queue the event */ - Backup cur_company(_current_company, company); + Backup cur_company(_current_company, company, FILE_LINE); AIEventController::InsertEvent(event); cur_company.Restore(); @@ -247,7 +247,7 @@ void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) Company *c = Company::GetIfValid(company); assert(c != NULL && c->ai_instance != NULL); - Backup cur_company(_current_company, company); + Backup cur_company(_current_company, company, FILE_LINE); c->ai_instance->Save(); cur_company.Restore(); } else { @@ -261,7 +261,7 @@ void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) Company *c = Company::GetIfValid(company); assert(c != NULL && c->ai_instance != NULL); - Backup cur_company(_current_company, company); + Backup cur_company(_current_company, company, FILE_LINE); c->ai_instance->Load(version); cur_company.Restore(); } else { diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index afad432f6..91ebe0781 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -820,7 +820,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget(AID_WIDGET_COMPANY_BUTTON_START + i)->pos_y + 2 + offset); } - Backup cur_company(_current_company, ai_debug_company); + Backup cur_company(_current_company, ai_debug_company, FILE_LINE); AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer(); cur_company.Restore(); @@ -875,7 +875,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { switch (widget) { case AID_WIDGET_LOG_PANEL: { - Backup cur_company(_current_company, ai_debug_company); + Backup cur_company(_current_company, ai_debug_company, FILE_LINE); AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer(); cur_company.Restore(); if (log == NULL) return; @@ -914,7 +914,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START); ai_debug_company = show_ai; - Backup cur_company(_current_company, ai_debug_company); + Backup cur_company(_current_company, ai_debug_company, FILE_LINE); AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer(); cur_company.Restore(); this->vscroll.SetCount((log == NULL) ? 0 : log->used); @@ -1009,7 +1009,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { /* If the log message is related to the active company tab, check the break string */ if (data == ai_debug_company && this->break_check_enabled && !StrEmpty(this->edit_str_buf)) { /* Get the log instance of the active company */ - Backup cur_company(_current_company, ai_debug_company); + Backup cur_company(_current_company, ai_debug_company, FILE_LINE); AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer(); if (log != NULL && case_sensitive_break_check? -- cgit v1.2.3-54-g00ecf