|
|
|
#include "savedgame.hpp"
|
|
|
|
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
|
|
|
|
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
|
|
|
int ESM::SavedGame::sCurrentFormat = 15;
|
|
|
|
|
|
|
|
void ESM::SavedGame::load (ESMReader &esm)
|
|
|
|
{
|
|
|
|
mPlayerName = esm.getHNString("PLNA");
|
|
|
|
esm.getHNOT (mPlayerLevel, "PLLE");
|
|
|
|
|
|
|
|
mPlayerClassId = esm.getHNOString("PLCL");
|
|
|
|
mPlayerClassName = esm.getHNOString("PLCN");
|
|
|
|
|
|
|
|
mPlayerCell = esm.getHNString("PLCE");
|
|
|
|
esm.getHNT (mInGameTime, "TSTM", 16);
|
|
|
|
esm.getHNT (mTimePlayed, "TIME");
|
|
|
|
mDescription = esm.getHNString ("DESC");
|
|
|
|
|
|
|
|
while (esm.isNextSub ("DEPE"))
|
|
|
|
mContentFiles.push_back (esm.getHString());
|
|
|
|
|
|
|
|
esm.getSubNameIs("SCRN");
|
|
|
|
esm.getSubHeader();
|
|
|
|
mScreenshot.resize(esm.getSubSize());
|
Fix reference binding to null
/usr/include/c++/10.2.0/bits/stl_vector.h:1046:34: runtime error: reference binding to null pointer of type 'value_type'
#0 0x55e37f50008a in std::vector<char, std::allocator<char> >::operator[](unsigned long) /usr/include/c++/10.2.0/bits/stl_vector.h:1046
#1 0x55e37f50008a in ESM::SavedGame::load(ESM::ESMReader&) /home/elsid/dev/openmw/components/esm/savedgame.cpp:28
#2 0x55e37e726139 in MWState::Character::addSlot(boost::filesystem::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/character.cpp:31
#3 0x55e37e742b39 in MWState::Character::Character(boost::filesystem::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/character.cpp:88
#4 0x55e37e7006e1 in MWState::CharacterManager::CharacterManager(boost::filesystem::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/charactermanager.cpp:25
#5 0x55e37e6d4140 in MWState::StateManager::StateManager(boost::filesystem::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwstate/statemanagerimp.cpp:90
#6 0x55e37e82595a in OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:641
#7 0x55e37e8439fd in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:867
#8 0x55e37e782760 in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:289
#9 0x55e37f6483c3 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:200
#10 0x55e37ba8e3fe in main /home/elsid/dev/openmw/apps/openmw/main.cpp:301
#11 0x7f013e845151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
#12 0x55e37baa0e3d in _start (/home/elsid/dev/openmw/build/gcc/ubsan/openmw+0x6c11e3d)
4 years ago
|
|
|
esm.getExact(mScreenshot.data(), mScreenshot.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ESM::SavedGame::save (ESMWriter &esm) const
|
|
|
|
{
|
|
|
|
esm.writeHNString ("PLNA", mPlayerName);
|
|
|
|
esm.writeHNT ("PLLE", mPlayerLevel);
|
|
|
|
|
|
|
|
if (!mPlayerClassId.empty())
|
|
|
|
esm.writeHNString ("PLCL", mPlayerClassId);
|
|
|
|
else
|
|
|
|
esm.writeHNString ("PLCN", mPlayerClassName);
|
|
|
|
|
|
|
|
esm.writeHNString ("PLCE", mPlayerCell);
|
|
|
|
esm.writeHNT ("TSTM", mInGameTime, 16);
|
|
|
|
esm.writeHNT ("TIME", mTimePlayed);
|
|
|
|
esm.writeHNString ("DESC", mDescription);
|
|
|
|
|
|
|
|
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
|
|
|
|
iter!=mContentFiles.end(); ++iter)
|
|
|
|
esm.writeHNString ("DEPE", *iter);
|
|
|
|
|
|
|
|
esm.startSubRecord("SCRN");
|
|
|
|
esm.write(&mScreenshot[0], mScreenshot.size());
|
|
|
|
esm.endRecord("SCRN");
|
|
|
|
}
|