(svn r13668) [NoAI] -Add: execute 'game_start.scr' on game-start or scenario load, to allow you to load AIs on game-start
[NoAI] -Fix: -vnull acts a bit more like a dedicated server, to avoid weird complexity on several places
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/scripts/game_start.scr.example Mon Jun 30 21:27:53 2008 +0000
@@ -0,0 +1,2 @@
+start_ai MyAI
+
--- a/src/genworld.cpp Mon Jun 30 19:35:57 2008 +0000
+++ b/src/genworld.cpp Mon Jun 30 21:27:53 2008 +0000
@@ -25,6 +25,7 @@
#include "settings_type.h"
#include "newgrf_storage.h"
#include "water.h"
+#include "blitter/factory.hpp"
#include "tilehighlight_func.h"
#include "table/sprites.h"
@@ -291,7 +292,7 @@
_gw.thread = NULL;
}
- if (_network_dedicated ||
+ if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0 ||
(_gw.thread = ThreadObject::New(&_GenerateWorld, NULL)) == NULL) {
DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
_gw.threaded = false;
--- a/src/openttd.cpp Mon Jun 30 19:35:57 2008 +0000
+++ b/src/openttd.cpp Mon Jun 30 21:27:53 2008 +0000
@@ -694,14 +694,17 @@
static void MakeNewGameDone()
{
/* In a dedicated server, the server does not play */
- if (_network_dedicated) {
+ if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0) {
SetLocalPlayer(PLAYER_SPECTATOR);
+ IConsoleCmdExec("exec scripts/game_start.scr 0");
return;
}
/* Create a single player */
DoStartupNewPlayer(false);
+ IConsoleCmdExec("exec scripts/game_start.scr 0");
+
SetLocalPlayer(PLAYER_FIRST);
_current_player = _local_player;
DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
@@ -906,6 +909,8 @@
/* Update the local player for a loaded game. It is either always
* player #1 (eg 0) or in the case of a dedicated server a spectator */
SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST);
+ /* Execute the game-start script */
+ IConsoleCmdExec("exec scripts/game_start.scr 0");
/* Decrease pause counter (was increased from opening load dialog) */
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
#ifdef ENABLE_NETWORK