MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Died

Method Died

src/ai/ai_instance.cpp:61–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void AIInstance::Died()
62{
63 ScriptInstance::Died();
64
65 /* Intro is not supposed to use AI, but it may have 'dummy' AI which instant dies. */
66 if (_game_mode == GM_MENU) return;
67
68 /* Don't show errors while loading savegame. They will be shown at end of loading anyway. */
69 if (_switch_mode != SM_NONE) return;
70
71 ShowScriptDebugWindow(_current_company);
72
73 const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
74 if (info != nullptr) {
75 ShowErrorMessage(GetEncodedString(STR_ERROR_AI_PLEASE_REPORT_CRASH), {}, WL_WARNING);
76
77 if (!info->GetURL().empty()) {
78 ScriptLog::Info("Please report the error to the following URL:");
79 ScriptLog::Info(info->GetURL());
80 }
81 }
82}
83
84void AIInstance::LoadDummyScript()
85{

Callers 1

RegisterAPIMethod · 0.95

Calls 7

ShowScriptDebugWindowFunction · 0.85
GetConfigFunction · 0.85
ShowErrorMessageFunction · 0.85
GetURLMethod · 0.80
GetEncodedStringFunction · 0.50
GetInfoMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected