mirror of https://github.com/OpenTTD/OpenTTD
parent
8db4892f49
commit
2848483810
|
@ -61,6 +61,9 @@ void AIInstance::Died()
|
||||||
{
|
{
|
||||||
ScriptInstance::Died();
|
ScriptInstance::Died();
|
||||||
|
|
||||||
|
/* Intro is not supposed to use AI, but it may have 'dummy' AI which instant dies. */
|
||||||
|
if (_game_mode == GM_MENU) return;
|
||||||
|
|
||||||
ShowAIDebugWindow(_current_company);
|
ShowAIDebugWindow(_current_company);
|
||||||
|
|
||||||
const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
|
const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../stdafx.h"
|
#include "../stdafx.h"
|
||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include "../network/network.h"
|
#include "../network/network.h"
|
||||||
|
#include "../openttd.h"
|
||||||
#include "../core/random_func.hpp"
|
#include "../core/random_func.hpp"
|
||||||
|
|
||||||
#include "../script/squirrel_class.hpp"
|
#include "../script/squirrel_class.hpp"
|
||||||
|
@ -59,6 +60,11 @@ void AIScannerInfo::RegisterAPI(class Squirrel *engine)
|
||||||
|
|
||||||
AIInfo *AIScannerInfo::SelectRandomAI() const
|
AIInfo *AIScannerInfo::SelectRandomAI() const
|
||||||
{
|
{
|
||||||
|
if (_game_mode == GM_MENU) {
|
||||||
|
Debug(script, 0, "The intro game should not use AI, loading 'dummy' AI.");
|
||||||
|
return this->info_dummy;
|
||||||
|
}
|
||||||
|
|
||||||
uint num_random_ais = 0;
|
uint num_random_ais = 0;
|
||||||
for (const auto &item : info_single_list) {
|
for (const auto &item : info_single_list) {
|
||||||
AIInfo *i = static_cast<AIInfo *>(item.second);
|
AIInfo *i = static_cast<AIInfo *>(item.second);
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct AIPLChunkHandler : ChunkHandler {
|
||||||
_ai_saveload_version = -1;
|
_ai_saveload_version = -1;
|
||||||
SlObject(nullptr, slt);
|
SlObject(nullptr, slt);
|
||||||
|
|
||||||
if (_networking && !_network_server) {
|
if (_game_mode == GM_MENU || (_networking && !_network_server)) {
|
||||||
if (Company::IsValidAiID(index)) AIInstance::LoadEmpty();
|
if (Company::IsValidAiID(index)) AIInstance::LoadEmpty();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ struct GSDTChunkHandler : ChunkHandler {
|
||||||
_game_saveload_version = -1;
|
_game_saveload_version = -1;
|
||||||
SlObject(nullptr, slt);
|
SlObject(nullptr, slt);
|
||||||
|
|
||||||
if (_networking && !_network_server) {
|
if (_game_mode == GM_MENU || (_networking && !_network_server)) {
|
||||||
GameInstance::LoadEmpty();
|
GameInstance::LoadEmpty();
|
||||||
if (SlIterateArray() != -1) SlErrorCorrupt("Too many GameScript configs");
|
if (SlIterateArray() != -1) SlErrorCorrupt("Too many GameScript configs");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue