Loading

Paste #pqwow8vx9

  1. Index: src/saveload/engine_sl.cpp
  2. ===================================================================
  3. --- src/saveload/engine_sl.cpp  (revision 26810)
  4. +++ src/saveload/engine_sl.cpp  (working copy)
  5. @@ -13,7 +13,7 @@
  6.  #include "saveload_internal.h"
  7.  #include "../engine_base.h"
  8.  #include "../string_func.h"
  9. -#include <map>
  10. +#include <vector>
  11.  
  12.  #include "../safeguards.h"
  13.  
  14. @@ -48,11 +48,21 @@
  15.     SLE_END()
  16.  };
  17.  
  18. -static std::map<EngineID, Engine> _temp_engine;
  19. +static std::vector<Engine> _temp_engine;
  20.  
  21.  Engine *GetTempDataEngine(EngineID index)
  22.  {
  23. -   return &_temp_engine[index];
  24. +   if (index < _temp_engine.size()) {
  25. +       return &_temp_engine[index];
  26. +   } else if (index == _temp_engine.size()) {
  27. +       uint8 zero[sizeof(Engine)];
  28. +       memset(zero, 0, sizeof(zero));
  29. +       Engine *engine = new(zero)Engine();
  30. +       _temp_engine.push_back(*engine);
  31. +       return &_temp_engine[index];
  32. +   } else {
  33. +       NOT_REACHED();
  34. +   }
  35.  }
  36.  
  37.  static void Save_ENGN()
  38.  

Comments