Loading

Paste #pmzpxdfat

  1. Index: src/ai/ai_core.cpp
  2. ===================================================================
  3. --- src/ai/ai_core.cpp  (revision 27569)
  4. +++ src/ai/ai_core.cpp  (working copy)
  5. @@ -15,6 +15,7 @@
  6.  #include "../company_base.h"
  7.  #include "../company_func.h"
  8.  #include "../network/network.h"
  9. +#include "../saveload/saveload.h"
  10.  #include "../window_func.h"
  11.  #include "ai_scanner.hpp"
  12.  #include "ai_instance.hpp"
  13. @@ -276,7 +277,7 @@
  14.  
  15.  /* static */ void AI::Save(CompanyID company)
  16.  {
  17. -   if (!_networking || _network_server) {
  18. +   if (!_networking || _network_server && !_save_empty_script) {
  19.         Company *c = Company::GetIfValid(company);
  20.         assert(c != NULL && c->ai_instance != NULL);
  21.  
  22. Index: src/game/game_core.cpp
  23. ===================================================================
  24. --- src/game/game_core.cpp  (revision 27569)
  25. +++ src/game/game_core.cpp  (working copy)
  26. @@ -14,6 +14,7 @@
  27.  #include "../company_base.h"
  28.  #include "../company_func.h"
  29.  #include "../network/network.h"
  30. +#include "../saveload/saveload.h"
  31.  #include "../window_func.h"
  32.  #include "game.hpp"
  33.  #include "game_scanner.hpp"
  34. @@ -197,7 +198,7 @@
  35.  
  36.  /* static */ void Game::Save()
  37.  {
  38. -   if (Game::instance != NULL && (!_networking || _network_server)) {
  39. +   if (Game::instance != NULL && (!_networking || _network_server && !_save_empty_script)) {
  40.         Backup<CompanyByte> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
  41.         Game::instance->Save();
  42.         cur_company.Restore();
  43. Index: src/saveload/saveload.cpp
  44. ===================================================================
  45. --- src/saveload/saveload.cpp   (revision 27569)
  46. +++ src/saveload/saveload.cpp   (working copy)
  47. @@ -272,6 +272,7 @@
  48.  byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
  49.  char _savegame_format[8]; ///< how to compress savegames
  50.  bool _do_autosave;        ///< are we doing an autosave at the moment?
  51. +bool _save_empty_script;  ///< are we sending a map to a client over the nework?
  52.  
  53.  /** What are we currently doing? */
  54.  enum SaveLoadAction {
  55. @@ -2473,6 +2474,7 @@
  56.  
  57.     InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SAVELOAD_FINISH);
  58.     _sl.saveinprogress = false;
  59. +   _save_empty_script = false;
  60.  }
  61.  
  62.  /** Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friends) */
  63. @@ -2604,6 +2606,7 @@
  64.  SaveOrLoadResult SaveWithFilter(SaveFilter *writer, bool threaded)
  65.  {
  66.     try {
  67. +       _save_empty_script = true;
  68.         _sl.action = SLA_SAVE;
  69.         return DoSave(writer, threaded);
  70.     } catch (...) {
  71. Index: src/saveload/saveload.h
  72. ===================================================================
  73. --- src/saveload/saveload.h (revision 27569)
  74. +++ src/saveload/saveload.h (working copy)
  75. @@ -548,5 +548,6 @@
  76.  
  77.  extern char _savegame_format[8];
  78.  extern bool _do_autosave;
  79. +extern bool _save_empty_script;
  80.  
  81.  #endif /* SAVELOAD_H */

Comments