Index: src/ai/ai_core.cpp
===================================================================
--- src/ai/ai_core.cpp (revision 27569)
+++ src/ai/ai_core.cpp (working copy)
@@ -15,6 +15,7 @@
#include "../company_base.h"
#include "../company_func.h"
#include "../network/network.h"
+#include "../saveload/saveload.h"
#include "../window_func.h"
#include "ai_scanner.hpp"
#include "ai_instance.hpp"
@@ -276,7 +277,7 @@
/* static */ void AI::Save(CompanyID company)
{
- if (!_networking || _network_server) {
+ if (!_networking || _network_server && !_save_empty_script) {
Company *c = Company::GetIfValid(company);
assert(c != NULL && c->ai_instance != NULL);
Index: src/game/game_core.cpp
===================================================================
--- src/game/game_core.cpp (revision 27569)
+++ src/game/game_core.cpp (working copy)
@@ -14,6 +14,7 @@
#include "../company_base.h"
#include "../company_func.h"
#include "../network/network.h"
+#include "../saveload/saveload.h"
#include "../window_func.h"
#include "game.hpp"
#include "game_scanner.hpp"
@@ -197,7 +198,7 @@
/* static */ void Game::Save()
{
- if (Game::instance != NULL && (!_networking || _network_server)) {
+ if (Game::instance != NULL && (!_networking || _network_server && !_save_empty_script)) {
Backup<CompanyByte> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
Game::instance->Save();
cur_company.Restore();
Index: src/saveload/saveload.cpp
===================================================================
--- src/saveload/saveload.cpp (revision 27569)
+++ src/saveload/saveload.cpp (working copy)
@@ -272,6 +272,7 @@
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
char _savegame_format[8]; ///< how to compress savegames
bool _do_autosave; ///< are we doing an autosave at the moment?
+bool _save_empty_script; ///< are we sending a map to a client over the nework?
/** What are we currently doing? */
enum SaveLoadAction {
@@ -2473,6 +2474,7 @@
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SAVELOAD_FINISH);
_sl.saveinprogress = false;
+ _save_empty_script = false;
}
/** Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friends) */
@@ -2604,6 +2606,7 @@
SaveOrLoadResult SaveWithFilter(SaveFilter *writer, bool threaded)
{
try {
+ _save_empty_script = true;
_sl.action = SLA_SAVE;
return DoSave(writer, threaded);
} catch (...) {
Index: src/saveload/saveload.h
===================================================================
--- src/saveload/saveload.h (revision 27569)
+++ src/saveload/saveload.h (working copy)
@@ -548,5 +548,6 @@
extern char _savegame_format[8];
extern bool _do_autosave;
+extern bool _save_empty_script;
#endif /* SAVELOAD_H */