Fix Windows save & load.

actorid
cc9cii 11 years ago
parent c3f350e3fb
commit c241405d91

@ -2,6 +2,7 @@
#include <stdexcept>
#include <boost/filesystem.hpp>
#include <OgreRoot.h>
#include <OgreRenderWindow.h>
@ -339,8 +340,10 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
void OMW::Engine::prepareEngine (Settings::Manager & settings)
{
boost::filesystem::path saves(mCfgMgr.getUserDataPath() / "saves");
mEnvironment.setStateManager (
new MWState::StateManager (mCfgMgr.getUserDataPath() / "saves", mContentFiles.at (0)));
new MWState::StateManager (saves.make_preferred(), mContentFiles.at (0)));
Nif::NIFFile::CacheLock cachelock;

@ -176,7 +176,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
else
slot = mCharacterManager.getCurrentCharacter()->updateSlot (slot, profile);
std::ofstream stream (slot->mPath.string().c_str());
std::ofstream stream (slot->mPath.string().c_str(), std::ios::binary);
ESM::ESMWriter writer;

@ -80,8 +80,8 @@ namespace ESM
rec.name = name;
rec.position = mStream->tellp();
rec.size = 0;
writeT<int>(0); // Size goes here
writeT<int>(0); // Unused header?
writeT<uint32_t>(0); // Size goes here
writeT<uint32_t>(0); // Unused header?
writeT(flags);
mRecords.push_back(rec);
@ -105,7 +105,7 @@ namespace ESM
rec.name = name;
rec.position = mStream->tellp();
rec.size = 0;
writeT<int>(0); // Size goes here
writeT<uint32_t>(0); // Size goes here
mRecords.push_back(rec);
assert(mRecords.back().size == 0);
@ -120,7 +120,7 @@ namespace ESM
mStream->seekp(rec.position);
mCounting = false;
write (reinterpret_cast<const char*> (&rec.size), sizeof(int));
write (reinterpret_cast<const char*> (&rec.size), sizeof(uint32_t));
mCounting = true;
mStream->seekp(0, std::ios::end);

Loading…
Cancel
Save