mirror of https://github.com/OpenTTD/OpenTTD
(svn r19395) -Fix [FS#3669]: the AI Debug window didn't open if an AI or library fails to compile when loading a savegame
parent
d0b496feb6
commit
dfa528d058
|
@ -1024,3 +1024,15 @@ void InitializeAIGui()
|
||||||
{
|
{
|
||||||
AIDebugWindow::ai_debug_company = INVALID_COMPANY;
|
AIDebugWindow::ai_debug_company = INVALID_COMPANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Open the AI debug window if one of the AI scripts has crashed. */
|
||||||
|
void ShowAIDebugWindowIfAIError()
|
||||||
|
{
|
||||||
|
Company *c;
|
||||||
|
FOR_ALL_COMPANIES(c) {
|
||||||
|
if (c->is_ai && c->ai_instance->IsDead()) {
|
||||||
|
ShowAIDebugWindow(c->index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#ifdef ENABLE_AI
|
#ifdef ENABLE_AI
|
||||||
void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY);
|
void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY);
|
||||||
void ShowAIConfigWindow();
|
void ShowAIConfigWindow();
|
||||||
|
void ShowAIDebugWindowIfAIError();
|
||||||
#else
|
#else
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ static inline void ShowAIConfigWindow()
|
||||||
ShowErrorMessage(STR_ERROR_NO_AI, STR_ERROR_NO_AI_SUB, WL_INFO);
|
ShowErrorMessage(STR_ERROR_NO_AI, STR_ERROR_NO_AI_SUB, WL_INFO);
|
||||||
}
|
}
|
||||||
static inline void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY) {ShowAIConfigWindow();}
|
static inline void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY) {ShowAIConfigWindow();}
|
||||||
|
static inline void ShowAIDebugWindowIfAIError() {}
|
||||||
#endif /* ENABLE_AI */
|
#endif /* ENABLE_AI */
|
||||||
|
|
||||||
#endif /* AI_GUI_HPP */
|
#endif /* AI_GUI_HPP */
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "../company_func.h"
|
#include "../company_func.h"
|
||||||
#include "../road_cmd.h"
|
#include "../road_cmd.h"
|
||||||
#include "../ai/ai.hpp"
|
#include "../ai/ai.hpp"
|
||||||
|
#include "../ai/ai_gui.hpp"
|
||||||
#include "../town.h"
|
#include "../town.h"
|
||||||
#include "../economy_base.h"
|
#include "../economy_base.h"
|
||||||
#include "../animated_tile_func.h"
|
#include "../animated_tile_func.h"
|
||||||
|
@ -263,6 +264,7 @@ static void InitializeWindowsAndCaches()
|
||||||
|
|
||||||
CheckTrainsLengths();
|
CheckTrainsLengths();
|
||||||
ShowNewGRFError();
|
ShowNewGRFError();
|
||||||
|
ShowAIDebugWindowIfAIError();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (CDECL *SignalHandlerPointer)(int);
|
typedef void (CDECL *SignalHandlerPointer)(int);
|
||||||
|
|
Loading…
Reference in New Issue