Merge branch 'master' into jgrpp
# Conflicts: # src/lang/korean.txt # src/saveload/afterload.cpp # src/saveload/ai_sl.cpp # src/saveload/game_sl.cpp # src/script/script_instance.cpp
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "../road_cmd.h"
|
||||
#include "../ai/ai.hpp"
|
||||
#include "../ai/ai_gui.hpp"
|
||||
#include "../game/game.hpp"
|
||||
#include "../town.h"
|
||||
#include "../economy_base.h"
|
||||
#include "../animated_tile_func.h"
|
||||
@@ -317,7 +318,6 @@ static void InitializeWindowsAndCaches()
|
||||
|
||||
CheckTrainsLengths();
|
||||
ShowNewGRFError();
|
||||
ShowAIDebugWindowIfAIError();
|
||||
|
||||
/* Rebuild the smallmap list of owners. */
|
||||
BuildOwnerLegend();
|
||||
@@ -613,6 +613,22 @@ TileIndex GetOtherTunnelBridgeEndOld(TileIndex tile)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start the scripts.
|
||||
*/
|
||||
static void StartScripts()
|
||||
{
|
||||
/* Start the GameScript. */
|
||||
Game::StartNew();
|
||||
|
||||
/* Start the AIs. */
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
if (Company::IsValidAiID(c->index)) AI::StartNew(c->index, false);
|
||||
}
|
||||
|
||||
ShowAIDebugWindowIfAIError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a (large) amount of savegame conversion *magic* in order to
|
||||
* load older savegames and to fill the caches for various purposes.
|
||||
@@ -966,13 +982,6 @@ bool AfterLoadGame()
|
||||
/* Update template vehicles */
|
||||
AfterLoadTemplateVehicles();
|
||||
|
||||
/* Make sure there is an AI attached to an AI company */
|
||||
{
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
if (c->is_ai && c->ai_instance == nullptr) AI::StartNew(c->index);
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure there is a town in the game */
|
||||
if (_game_mode == GM_NORMAL && Town::GetNumItems() == 0) {
|
||||
SetSaveLoadError(STR_ERROR_NO_TOWN_IN_SCENARIO);
|
||||
@@ -4191,6 +4200,9 @@ bool AfterLoadGame()
|
||||
_game_load_tick_skip_counter = _tick_skip_counter;
|
||||
_game_load_time = time(nullptr);
|
||||
|
||||
/* Start the scripts. This MUST happen after everything else. */
|
||||
StartScripts();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user