1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:59:54 +00:00
openmw/components/esm3/transport.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
965 B
C++
Raw Normal View History

#include "transport.hpp"
#include <components/debug/debuglog.hpp>
#include <components/esm3/esmreader.hpp>
#include <components/esm3/esmwriter.hpp>
namespace ESM
{
void Transport::add(ESMReader& esm)
{
if (esm.retSubName().toInt() == fourCC("DODT"))
{
Dest dodt;
esm.getSubComposite(dodt.mPos);
mList.push_back(dodt);
}
else if (esm.retSubName().toInt() == fourCC("DNAM"))
{
2023-01-19 16:31:45 +00:00
std::string name = esm.getHString();
if (mList.empty())
Log(Debug::Warning) << "Encountered DNAM record without DODT record, skipped.";
else
2023-07-29 07:44:39 +00:00
mList.back().mCellName = std::move(name);
}
}
void Transport::save(ESMWriter& esm) const
{
for (const Dest& dest : mList)
{
esm.writeNamedComposite("DODT", dest.mPos);
esm.writeHNOCString("DNAM", dest.mCellName);
}
}
}