Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Disable AI and Game Script when loading the title game #9608

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/saveload/ai_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ struct AIPLChunkHandler : ChunkHandler {
continue;
}

/* If on the main menu, i.e. loading the title game, disable all AIs */
if (_game_mode == GM_MENU) {
if (Company::IsValidAiID(index)) {
AIInstance::LoadEmpty();
Company::Get(index)->is_ai = false;
}
continue;
}

AIConfig *config = AIConfig::GetConfig(index, AIConfig::SSS_FORCE_GAME);
if (_ai_saveload_name.empty()) {
/* A random AI. */
Expand Down
3 changes: 2 additions & 1 deletion src/saveload/game_sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ struct GSDTChunkHandler : ChunkHandler {
_game_saveload_version = -1;
SlObject(nullptr, slt);

if (_networking && !_network_server) {
/* Network clients don't run the game script, and neither does the title screen game */
if ((_networking && !_network_server) || _game_mode == GM_MENU) {
GameInstance::LoadEmpty();
if (SlIterateArray() != -1) SlErrorCorrupt("Too many GameScript configs");
return;
Expand Down