forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
421679b319
38 changed files with 150 additions and 71 deletions
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
class ESMReader;
|
class ESMReader;
|
||||||
|
@ -60,7 +65,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const = 0;
|
virtual int countSavedGameRecords() const = 0;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) const = 0;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
|
||||||
|
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
#include "../mwdialogue/topic.hpp"
|
#include "../mwdialogue/topic.hpp"
|
||||||
#include "../mwdialogue/quest.hpp"
|
#include "../mwdialogue/quest.hpp"
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
class ESMReader;
|
class ESMReader;
|
||||||
|
@ -80,7 +85,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const = 0;
|
virtual int countSavedGameRecords() const = 0;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) const = 0;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
|
||||||
|
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -303,7 +303,7 @@ namespace MWBase
|
||||||
/// Clear all savegame-specific data
|
/// Clear all savegame-specific data
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) = 0;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) = 0;
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const = 0;
|
virtual int countSavedGameRecords() const = 0;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) const = 0;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) const = 0;
|
||||||
|
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type,
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
const std::map<int, int>& contentFileMap) = 0;
|
const std::map<int, int>& contentFileMap) = 0;
|
||||||
|
|
|
@ -609,7 +609,7 @@ namespace MWDialogue
|
||||||
return 1; // known topics
|
return 1; // known topics
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::write (ESM::ESMWriter& writer) const
|
void DialogueManager::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
ESM::DialogueState state;
|
ESM::DialogueState state;
|
||||||
|
|
||||||
|
@ -621,6 +621,7 @@ namespace MWDialogue
|
||||||
writer.startRecord (ESM::REC_DIAS);
|
writer.startRecord (ESM::REC_DIAS);
|
||||||
state.save (writer);
|
state.save (writer);
|
||||||
writer.endRecord (ESM::REC_DIAS);
|
writer.endRecord (ESM::REC_DIAS);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)
|
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const;
|
virtual int countSavedGameRecords() const;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) const;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
};
|
};
|
||||||
|
|
|
@ -167,7 +167,7 @@ namespace MWDialogue
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Journal::write (ESM::ESMWriter& writer) const
|
void Journal::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
for (TQuestIter iter (mQuests.begin()); iter!=mQuests.end(); ++iter)
|
for (TQuestIter iter (mQuests.begin()); iter!=mQuests.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
@ -178,6 +178,7 @@ namespace MWDialogue
|
||||||
writer.startRecord (ESM::REC_QUES);
|
writer.startRecord (ESM::REC_QUES);
|
||||||
state.save (writer);
|
state.save (writer);
|
||||||
writer.endRecord (ESM::REC_QUES);
|
writer.endRecord (ESM::REC_QUES);
|
||||||
|
progress.increaseProgress();
|
||||||
|
|
||||||
for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter)
|
for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
@ -188,6 +189,7 @@ namespace MWDialogue
|
||||||
writer.startRecord (ESM::REC_JOUR);
|
writer.startRecord (ESM::REC_JOUR);
|
||||||
entry.save (writer);
|
entry.save (writer);
|
||||||
writer.endRecord (ESM::REC_JOUR);
|
writer.endRecord (ESM::REC_JOUR);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +201,7 @@ namespace MWDialogue
|
||||||
writer.startRecord (ESM::REC_JOUR);
|
writer.startRecord (ESM::REC_JOUR);
|
||||||
entry.save (writer);
|
entry.save (writer);
|
||||||
writer.endRecord (ESM::REC_JOUR);
|
writer.endRecord (ESM::REC_JOUR);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
|
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
|
||||||
|
@ -214,6 +217,7 @@ namespace MWDialogue
|
||||||
writer.startRecord (ESM::REC_JOUR);
|
writer.startRecord (ESM::REC_JOUR);
|
||||||
entry.save (writer);
|
entry.save (writer);
|
||||||
writer.endRecord (ESM::REC_JOUR);
|
writer.endRecord (ESM::REC_JOUR);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const;
|
virtual int countSavedGameRecords() const;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) const;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
};
|
};
|
||||||
|
|
|
@ -160,7 +160,6 @@ namespace MWGui
|
||||||
|
|
||||||
void LoadingScreen::setProgress (size_t value)
|
void LoadingScreen::setProgress (size_t value)
|
||||||
{
|
{
|
||||||
assert(value < mProgressBar->getScrollRange());
|
|
||||||
if (value - mProgress < mProgressBar->getScrollRange()/100.f)
|
if (value - mProgress < mProgressBar->getScrollRange()/100.f)
|
||||||
return;
|
return;
|
||||||
mProgress = value;
|
mProgress = value;
|
||||||
|
@ -174,7 +173,6 @@ namespace MWGui
|
||||||
mProgressBar->setScrollPosition(0);
|
mProgressBar->setScrollPosition(0);
|
||||||
size_t value = mProgress + increase;
|
size_t value = mProgress + increase;
|
||||||
mProgress = value;
|
mProgress = value;
|
||||||
assert(mProgress < mProgressBar->getScrollRange());
|
|
||||||
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MWGui
|
||||||
|
|
||||||
virtual void setProgressRange (size_t range);
|
virtual void setProgressRange (size_t range);
|
||||||
virtual void setProgress (size_t value);
|
virtual void setProgress (size_t value);
|
||||||
virtual void increaseProgress (size_t increase);
|
virtual void increaseProgress (size_t increase=1);
|
||||||
|
|
||||||
virtual void setVisible(bool visible);
|
virtual void setVisible(bool visible);
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ namespace MWGui
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::write(ESM::ESMWriter &writer)
|
void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)
|
||||||
{
|
{
|
||||||
ESM::GlobalMap map;
|
ESM::GlobalMap map;
|
||||||
mGlobalMapRender->write(map);
|
mGlobalMapRender->write(map);
|
||||||
|
@ -605,6 +605,7 @@ namespace MWGui
|
||||||
writer.startRecord(ESM::REC_GMAP);
|
writer.startRecord(ESM::REC_GMAP);
|
||||||
map.save(writer);
|
map.save(writer);
|
||||||
writer.endRecord(ESM::REC_GMAP);
|
writer.endRecord(ESM::REC_GMAP);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)
|
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace MWGui
|
||||||
/// Clear all savegame-specific data
|
/// Clear all savegame-specific data
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer);
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress);
|
||||||
void readRecord (ESM::ESMReader& reader, int32_t type);
|
void readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1407,9 +1407,9 @@ namespace MWGui
|
||||||
mMap->clear();
|
mMap->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::write(ESM::ESMWriter &writer)
|
void WindowManager::write(ESM::ESMWriter &writer, Loading::Listener& progress)
|
||||||
{
|
{
|
||||||
mMap->write(writer);
|
mMap->write(writer, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::readRecord(ESM::ESMReader &reader, int32_t type)
|
void WindowManager::readRecord(ESM::ESMReader &reader, int32_t type)
|
||||||
|
|
|
@ -291,7 +291,7 @@ namespace MWGui
|
||||||
/// Clear all savegame-specific data
|
/// Clear all savegame-specific data
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer);
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress);
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ namespace MWMechanics
|
||||||
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
|
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
|
||||||
CreatureStats &stats = cls.getCreatureStats(iter->first);
|
CreatureStats &stats = cls.getCreatureStats(iter->first);
|
||||||
|
|
||||||
if(stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow)
|
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow)
|
||||||
{
|
{
|
||||||
MWMechanics::AiFollow* package = static_cast<MWMechanics::AiFollow*>(stats.getAiSequence().getActivePackage());
|
MWMechanics::AiFollow* package = static_cast<MWMechanics::AiFollow*>(stats.getAiSequence().getActivePackage());
|
||||||
if(package->getFollowedActor() == actor.getCellRef().mRefID)
|
if(package->getFollowedActor() == actor.getCellRef().mRefID)
|
||||||
|
@ -1041,7 +1041,7 @@ namespace MWMechanics
|
||||||
const MWWorld::Class &cls = MWWorld::Class::get(*iter);
|
const MWWorld::Class &cls = MWWorld::Class::get(*iter);
|
||||||
CreatureStats &stats = cls.getCreatureStats(*iter);
|
CreatureStats &stats = cls.getCreatureStats(*iter);
|
||||||
|
|
||||||
if(stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat)
|
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat)
|
||||||
{
|
{
|
||||||
MWMechanics::AiCombat* package = static_cast<MWMechanics::AiCombat*>(stats.getAiSequence().getActivePackage());
|
MWMechanics::AiCombat* package = static_cast<MWMechanics::AiCombat*>(stats.getAiSequence().getActivePackage());
|
||||||
if(package->getTargetId() == actor.getCellRef().mRefID)
|
if(package->getTargetId() == actor.getCellRef().mRefID)
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace MWScript
|
||||||
return mScripts.size();
|
return mScripts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalScripts::write (ESM::ESMWriter& writer) const
|
void GlobalScripts::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
for (std::map<std::string, std::pair<bool, Locals> >::const_iterator iter (mScripts.begin());
|
for (std::map<std::string, std::pair<bool, Locals> >::const_iterator iter (mScripts.begin());
|
||||||
iter!=mScripts.end(); ++iter)
|
iter!=mScripts.end(); ++iter)
|
||||||
|
@ -113,6 +113,7 @@ namespace MWScript
|
||||||
writer.startRecord (ESM::REC_GSCR);
|
writer.startRecord (ESM::REC_GSCR);
|
||||||
script.save (writer);
|
script.save (writer);
|
||||||
writer.endRecord (ESM::REC_GSCR);
|
writer.endRecord (ESM::REC_GSCR);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace ESM
|
||||||
class ESMReader;
|
class ESMReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
struct ESMStore;
|
struct ESMStore;
|
||||||
|
@ -46,7 +51,7 @@ namespace MWScript
|
||||||
|
|
||||||
int countSavedGameRecords() const;
|
int countSavedGameRecords() const;
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer) const;
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
///< Records for variables that do not exist are dropped silently.
|
///< Records for variables that do not exist are dropped silently.
|
||||||
|
|
|
@ -196,26 +196,36 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
||||||
writer.addMaster (*iter, 0); // not using the size information anyway -> use value of 0
|
writer.addMaster (*iter, 0); // not using the size information anyway -> use value of 0
|
||||||
|
|
||||||
writer.setFormat (ESM::Header::CurrentFormat);
|
writer.setFormat (ESM::Header::CurrentFormat);
|
||||||
writer.setRecordCount (
|
int recordCount = 1 // saved game header
|
||||||
1 // saved game header
|
|
||||||
+MWBase::Environment::get().getJournal()->countSavedGameRecords()
|
+MWBase::Environment::get().getJournal()->countSavedGameRecords()
|
||||||
+MWBase::Environment::get().getWorld()->countSavedGameRecords()
|
+MWBase::Environment::get().getWorld()->countSavedGameRecords()
|
||||||
+MWBase::Environment::get().getScriptManager()->getGlobalScripts().countSavedGameRecords()
|
+MWBase::Environment::get().getScriptManager()->getGlobalScripts().countSavedGameRecords()
|
||||||
+MWBase::Environment::get().getDialogueManager()->countSavedGameRecords()
|
+MWBase::Environment::get().getDialogueManager()->countSavedGameRecords()
|
||||||
+1 // global map
|
+1; // global map
|
||||||
);
|
writer.setRecordCount (recordCount);
|
||||||
|
|
||||||
writer.save (stream);
|
writer.save (stream);
|
||||||
|
|
||||||
|
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
|
listener.setProgressRange(recordCount);
|
||||||
|
listener.setLabel("#{sNotifyMessage4}");
|
||||||
|
|
||||||
|
Loading::ScopedLoad load(&listener);
|
||||||
|
|
||||||
writer.startRecord (ESM::REC_SAVE);
|
writer.startRecord (ESM::REC_SAVE);
|
||||||
slot->mProfile.save (writer);
|
slot->mProfile.save (writer);
|
||||||
writer.endRecord (ESM::REC_SAVE);
|
writer.endRecord (ESM::REC_SAVE);
|
||||||
|
listener.increaseProgress();
|
||||||
|
|
||||||
MWBase::Environment::get().getJournal()->write (writer);
|
MWBase::Environment::get().getJournal()->write (writer, listener);
|
||||||
MWBase::Environment::get().getDialogueManager()->write (writer);
|
MWBase::Environment::get().getDialogueManager()->write (writer, listener);
|
||||||
MWBase::Environment::get().getWorld()->write (writer);
|
MWBase::Environment::get().getWorld()->write (writer, listener);
|
||||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().write (writer);
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().write (writer, listener);
|
||||||
MWBase::Environment::get().getWindowManager()->write(writer);
|
MWBase::Environment::get().getWindowManager()->write(writer, listener);
|
||||||
|
|
||||||
|
// Ensure we have written the number of records that was estimated
|
||||||
|
if (writer.getRecordCount() != recordCount+1) // 1 extra for TES3 record
|
||||||
|
std::cerr << "Warning: number of written savegame records does not match. Estimated: " << recordCount+1 << ", written: " << writer.getRecordCount() << std::endl;
|
||||||
|
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
|
@ -261,6 +271,13 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
|
||||||
|
|
||||||
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
|
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
|
||||||
|
|
||||||
|
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
|
|
||||||
|
listener.setProgressRange(reader.getRecordCount());
|
||||||
|
listener.setLabel("#{sLoadingMessage14}");
|
||||||
|
|
||||||
|
Loading::ScopedLoad load(&listener);
|
||||||
|
|
||||||
while (reader.hasMoreRecs())
|
while (reader.hasMoreRecs())
|
||||||
{
|
{
|
||||||
ESM::NAME n = reader.getRecName();
|
ESM::NAME n = reader.getRecName();
|
||||||
|
@ -318,6 +335,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
|
||||||
/// \todo log error
|
/// \todo log error
|
||||||
reader.skipRecord();
|
reader.skipRecord();
|
||||||
}
|
}
|
||||||
|
listener.increaseProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
mCharacterManager.setCurrentCharacter(character);
|
mCharacterManager.setCurrentCharacter(character);
|
||||||
|
|
|
@ -277,17 +277,23 @@ int MWWorld::Cells::countSavedGameRecords() const
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::Cells::write (ESM::ESMWriter& writer) const
|
void MWWorld::Cells::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
for (std::map<std::pair<int, int>, CellStore>::iterator iter (mExteriors.begin());
|
for (std::map<std::pair<int, int>, CellStore>::iterator iter (mExteriors.begin());
|
||||||
iter!=mExteriors.end(); ++iter)
|
iter!=mExteriors.end(); ++iter)
|
||||||
if (iter->second.hasState())
|
if (iter->second.hasState())
|
||||||
|
{
|
||||||
writeCell (writer, iter->second);
|
writeCell (writer, iter->second);
|
||||||
|
progress.increaseProgress(); // Assumes that each cell writes one record
|
||||||
|
}
|
||||||
|
|
||||||
for (std::map<std::string, CellStore>::iterator iter (mInteriors.begin());
|
for (std::map<std::string, CellStore>::iterator iter (mInteriors.begin());
|
||||||
iter!=mInteriors.end(); ++iter)
|
iter!=mInteriors.end(); ++iter)
|
||||||
if (iter->second.hasState())
|
if (iter->second.hasState())
|
||||||
|
{
|
||||||
writeCell (writer, iter->second);
|
writeCell (writer, iter->second);
|
||||||
|
progress.increaseProgress(); // Assumes that each cell writes one record
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, int32_t type,
|
bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
|
|
|
@ -15,6 +15,11 @@ namespace ESM
|
||||||
struct Cell;
|
struct Cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class ESMStore;
|
class ESMStore;
|
||||||
|
@ -69,7 +74,7 @@ namespace MWWorld
|
||||||
|
|
||||||
int countSavedGameRecords() const;
|
int countSavedGameRecords() const;
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer) const;
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
bool readRecord (ESM::ESMReader& reader, int32_t type,
|
bool readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
const std::map<int, int>& contentFileMap);
|
const std::map<int, int>& contentFileMap);
|
||||||
|
|
|
@ -153,17 +153,17 @@ void ESMStore::setUp()
|
||||||
+mWeapons.getDynamicSize();
|
+mWeapons.getDynamicSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMStore::write (ESM::ESMWriter& writer) const
|
void ESMStore::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
mPotions.write (writer);
|
mPotions.write (writer, progress);
|
||||||
mArmors.write (writer);
|
mArmors.write (writer, progress);
|
||||||
mBooks.write (writer);
|
mBooks.write (writer, progress);
|
||||||
mClasses.write (writer);
|
mClasses.write (writer, progress);
|
||||||
mClothes.write (writer);
|
mClothes.write (writer, progress);
|
||||||
mEnchants.write (writer);
|
mEnchants.write (writer, progress);
|
||||||
mSpells.write (writer);
|
mSpells.write (writer, progress);
|
||||||
mWeapons.write (writer);
|
mWeapons.write (writer, progress);
|
||||||
mNpcs.write (writer);
|
mNpcs.write (writer, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ESMStore::readRecord (ESM::ESMReader& reader, int32_t type)
|
bool ESMStore::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||||
|
|
|
@ -212,7 +212,7 @@ namespace MWWorld
|
||||||
|
|
||||||
int countSavedGameRecords() const;
|
int countSavedGameRecords() const;
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer) const;
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
///< \return Known type?
|
///< \return Known type?
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace MWWorld
|
||||||
return mVariables.size();
|
return mVariables.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Globals::write (ESM::ESMWriter& writer) const
|
void Globals::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
for (Collection::const_iterator iter (mVariables.begin()); iter!=mVariables.end(); ++iter)
|
for (Collection::const_iterator iter (mVariables.begin()); iter!=mVariables.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@ namespace MWWorld
|
||||||
writer.writeHNString ("NAME", iter->first);
|
writer.writeHNString ("NAME", iter->first);
|
||||||
iter->second.write (writer, ESM::Variant::Format_Global);
|
iter->second.write (writer, ESM::Variant::Format_Global);
|
||||||
writer.endRecord (ESM::REC_GLOB);
|
writer.endRecord (ESM::REC_GLOB);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ namespace ESM
|
||||||
class ESMReader;
|
class ESMReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class ESMStore;
|
class ESMStore;
|
||||||
|
@ -46,7 +51,7 @@ namespace MWWorld
|
||||||
|
|
||||||
int countSavedGameRecords() const;
|
int countSavedGameRecords() const;
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer) const;
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
///< Records for variables that do not exist are dropped silently.
|
///< Records for variables that do not exist are dropped silently.
|
||||||
|
|
|
@ -215,7 +215,7 @@ namespace MWWorld
|
||||||
mTeleported = false;
|
mTeleported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::write (ESM::ESMWriter& writer) const
|
void Player::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
ESM::Player player;
|
ESM::Player player;
|
||||||
|
|
||||||
|
@ -245,6 +245,8 @@ namespace MWWorld
|
||||||
writer.startRecord (ESM::REC_PLAY);
|
writer.startRecord (ESM::REC_PLAY);
|
||||||
player.save (writer);
|
player.save (writer);
|
||||||
writer.endRecord (ESM::REC_PLAY);
|
writer.endRecord (ESM::REC_PLAY);
|
||||||
|
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::readRecord (ESM::ESMReader& reader, int32_t type)
|
bool Player::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||||
|
|
|
@ -21,6 +21,11 @@ namespace MWBase
|
||||||
class Ptr;
|
class Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class CellStore;
|
class CellStore;
|
||||||
|
@ -95,7 +100,7 @@ namespace MWWorld
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer) const;
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
bool readRecord (ESM::ESMReader& reader, int32_t type);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include <components/esm/esmwriter.hpp>
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
|
|
||||||
#include "recordcmp.hpp"
|
#include "recordcmp.hpp"
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
|
@ -313,7 +315,7 @@ namespace MWWorld
|
||||||
return erase(item.mId);
|
return erase(item.mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer) const
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
for (typename Dynamic::const_iterator iter (mDynamic.begin()); iter!=mDynamic.end();
|
for (typename Dynamic::const_iterator iter (mDynamic.begin()); iter!=mDynamic.end();
|
||||||
++iter)
|
++iter)
|
||||||
|
@ -322,6 +324,7 @@ namespace MWWorld
|
||||||
writer.writeHNString ("NAME", iter->second.mId);
|
writer.writeHNString ("NAME", iter->second.mId);
|
||||||
iter->second.save (writer);
|
iter->second.save (writer);
|
||||||
writer.endRecord (T::sRecordId);
|
writer.endRecord (T::sRecordId);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,7 @@ bool WeatherManager::isDark() const
|
||||||
return exterior && (mHour < mSunriseTime || mHour > mNightStart - 1);
|
return exterior && (mHour < mSunriseTime || mHour > mNightStart - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WeatherManager::write(ESM::ESMWriter& writer)
|
void WeatherManager::write(ESM::ESMWriter& writer, Loading::Listener& progress)
|
||||||
{
|
{
|
||||||
ESM::WeatherState state;
|
ESM::WeatherState state;
|
||||||
state.mHour = mHour;
|
state.mHour = mHour;
|
||||||
|
@ -701,6 +701,7 @@ void WeatherManager::write(ESM::ESMWriter& writer)
|
||||||
writer.startRecord(ESM::REC_WTHR);
|
writer.startRecord(ESM::REC_WTHR);
|
||||||
state.save(writer);
|
state.save(writer);
|
||||||
writer.endRecord(ESM::REC_WTHR);
|
writer.endRecord(ESM::REC_WTHR);
|
||||||
|
progress.increaseProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)
|
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)
|
||||||
|
|
|
@ -18,6 +18,11 @@ namespace MWRender
|
||||||
class RenderingManager;
|
class RenderingManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
class Listener;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Fallback;
|
class Fallback;
|
||||||
|
@ -158,7 +163,7 @@ namespace MWWorld
|
||||||
/// @see World::isDark
|
/// @see World::isDark
|
||||||
bool isDark() const;
|
bool isDark() const;
|
||||||
|
|
||||||
void write(ESM::ESMWriter& writer);
|
void write(ESM::ESMWriter& writer, Loading::Listener& progress);
|
||||||
|
|
||||||
bool readRecord(ESM::ESMReader& reader, int32_t type);
|
bool readRecord(ESM::ESMReader& reader, int32_t type);
|
||||||
|
|
||||||
|
|
|
@ -268,19 +268,20 @@ namespace MWWorld
|
||||||
int World::countSavedGameRecords() const
|
int World::countSavedGameRecords() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
mStore.countSavedGameRecords()
|
mCells.countSavedGameRecords()
|
||||||
|
+mStore.countSavedGameRecords()
|
||||||
+mGlobalVariables.countSavedGameRecords()
|
+mGlobalVariables.countSavedGameRecords()
|
||||||
+1 // player record
|
+1 // player record
|
||||||
+mCells.countSavedGameRecords();
|
+1; // weather record
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::write (ESM::ESMWriter& writer) const
|
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
mStore.write (writer);
|
mCells.write (writer, progress);
|
||||||
mGlobalVariables.write (writer);
|
mStore.write (writer, progress);
|
||||||
mCells.write (writer);
|
mGlobalVariables.write (writer, progress);
|
||||||
mPlayer->write (writer);
|
mPlayer->write (writer, progress);
|
||||||
mWeatherManager->write (writer);
|
mWeatherManager->write (writer, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
|
|
|
@ -194,7 +194,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const;
|
virtual int countSavedGameRecords() const;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer) const;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type,
|
virtual void readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
const std::map<int, int>& contentFileMap);
|
const std::map<int, int>& contentFileMap);
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
int getVer() const { return mHeader.mData.version; }
|
int getVer() const { return mHeader.mData.version; }
|
||||||
|
int getRecordCount() const { return mHeader.mData.records; }
|
||||||
float getFVer() const { if(mHeader.mData.version == VER_12) return 1.2; else return 1.3; }
|
float getFVer() const { if(mHeader.mData.version == VER_12) return 1.2; else return 1.3; }
|
||||||
const std::string getAuthor() const { return mHeader.mData.author.toString(); }
|
const std::string getAuthor() const { return mHeader.mData.author.toString(); }
|
||||||
const std::string getDesc() const { return mHeader.mData.desc.toString(); }
|
const std::string getDesc() const { return mHeader.mData.desc.toString(); }
|
||||||
|
|
|
@ -29,7 +29,12 @@ class ESMWriter
|
||||||
void setEncoder(ToUTF8::Utf8Encoder *encoding);
|
void setEncoder(ToUTF8::Utf8Encoder *encoding);
|
||||||
void setAuthor(const std::string& author);
|
void setAuthor(const std::string& author);
|
||||||
void setDescription(const std::string& desc);
|
void setDescription(const std::string& desc);
|
||||||
|
// Set the record count for writing it in the file header
|
||||||
void setRecordCount (int count);
|
void setRecordCount (int count);
|
||||||
|
// Counts how many records we have actually written.
|
||||||
|
// It is a good idea to compare this with the value you wrote into the header (setRecordCount)
|
||||||
|
// It should be the record count you set + 1 (1 additional record for the TES3 header)
|
||||||
|
int getRecordCount() { return mRecordCount; }
|
||||||
void setFormat (int format);
|
void setFormat (int format);
|
||||||
|
|
||||||
void clearMaster();
|
void clearMaster();
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ESM
|
||||||
int type; // 0=esp, 1=esm, 32=ess (unused)
|
int type; // 0=esp, 1=esm, 32=ess (unused)
|
||||||
NAME32 author; // Author's name
|
NAME32 author; // Author's name
|
||||||
NAME256 desc; // File description
|
NAME256 desc; // File description
|
||||||
int records; // Number of records? Not used.
|
int records; // Number of records
|
||||||
};
|
};
|
||||||
|
|
||||||
// Defines another files (esm or esp) that this file depends upon.
|
// Defines another files (esm or esp) that this file depends upon.
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Loading
|
||||||
|
|
||||||
virtual void setProgressRange (size_t range) = 0;
|
virtual void setProgressRange (size_t range) = 0;
|
||||||
virtual void setProgress (size_t value) = 0;
|
virtual void setProgress (size_t value) = 0;
|
||||||
virtual void increaseProgress (size_t increase) = 0;
|
virtual void increaseProgress (size_t increase = 1) = 0;
|
||||||
|
|
||||||
/// Indicate the scene is now ready to be shown
|
/// Indicate the scene is now ready to be shown
|
||||||
virtual void removeWallpaper() = 0;
|
virtual void removeWallpaper() = 0;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<Property key="MultiLine" value="true"/>
|
<Property key="MultiLine" value="true"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="HBox" position="0 89 272 24" align="Right Bottom">
|
<Widget type="HBox" position="0 89 284 24" align="Right Bottom">
|
||||||
<Widget type="Widget">
|
<Widget type="Widget">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
<Property key="FontName" value="Default"/>
|
<Property key="FontName" value="Default"/>
|
||||||
<Property key="TextAlign" value="Top HCenter"/>
|
<Property key="TextAlign" value="Top HCenter"/>
|
||||||
<Property key="TextColour" value="0.75 0.6 0.35"/>
|
<Property key="TextColour" value="0.75 0.6 0.35"/>
|
||||||
|
<Property key="TextShadow" value="true"/>
|
||||||
|
|
||||||
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
|
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
|
@ -147,29 +147,29 @@
|
||||||
|
|
||||||
<Skin name="MW_ChargeBar" size="204 18">
|
<Skin name="MW_ChargeBar" size="204 18">
|
||||||
<Child type="ProgressBar" skin="MW_Progress_Red" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/>
|
<Child type="ProgressBar" skin="MW_Progress_Red" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/>
|
||||||
<Child type="TextBox" skin="SandTextC" offset="0 0 204 18" align="Right Top Stretch" name="BarText"/>
|
<Child type="TextBox" skin="ProgressText" offset="0 0 204 18" align="Right Top Stretch" name="BarText"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
<Skin name="MW_ChargeBar_Blue" size="204 18">
|
<Skin name="MW_ChargeBar_Blue" size="204 18">
|
||||||
<Child type="ProgressBar" skin="MW_Progress_Blue" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/>
|
<Child type="ProgressBar" skin="MW_Progress_Blue" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/>
|
||||||
<Child type="TextBox" skin="SandTextC" offset="0 2 204 18" align="Right Top Stretch" name="BarText"/>
|
<Child type="TextBox" skin="ProgressText" offset="0 2 204 18" align="Right Top Stretch" name="BarText"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
<Skin name="MW_DynamicStat_Red" size="204 18">
|
<Skin name="MW_DynamicStat_Red" size="204 18">
|
||||||
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
|
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
|
||||||
<Child type="ProgressBar" skin="MW_Progress_Red" offset="74 0 130 18" align="Right Top" name="Bar"/>
|
<Child type="ProgressBar" skin="MW_Progress_Red" offset="74 0 130 18" align="Right Top" name="Bar"/>
|
||||||
<Child type="TextBox" skin="SandTextC" offset="74 0 130 18" align="Right Top" name="BarText"/>
|
<Child type="TextBox" skin="ProgressText" offset="74 0 130 18" align="Right Top" name="BarText"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
<Skin name="MW_DynamicStat_Blue" size="204 18">
|
<Skin name="MW_DynamicStat_Blue" size="204 18">
|
||||||
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
|
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
|
||||||
<Child type="ProgressBar" skin="MW_Progress_Blue" offset="74 0 130 18" align="Right Top" name="Bar"/>
|
<Child type="ProgressBar" skin="MW_Progress_Blue" offset="74 0 130 18" align="Right Top" name="Bar"/>
|
||||||
<Child type="TextBox" skin="SandTextC" offset="74 0 130 18" align="Right Top" name="BarText"/>
|
<Child type="TextBox" skin="ProgressText" offset="74 0 130 18" align="Right Top" name="BarText"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
<Skin name="MW_DynamicStat_Green" size="204 18">
|
<Skin name="MW_DynamicStat_Green" size="204 18">
|
||||||
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
|
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
|
||||||
<Child type="ProgressBar" skin="MW_Progress_Green" offset="74 0 130 18" align="Right Top" name="Bar"/>
|
<Child type="ProgressBar" skin="MW_Progress_Green" offset="74 0 130 18" align="Right Top" name="Bar"/>
|
||||||
<Child type="TextBox" skin="SandTextC" offset="74 0 130 18" align="Right Top" name="BarText"/>
|
<Child type="TextBox" skin="ProgressText" offset="74 0 130 18" align="Right Top" name="BarText"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
Loading…
Reference in a new issue