2015-03-08 19:44:41 +00:00
|
|
|
#include "transport.hpp"
|
|
|
|
|
2018-10-12 06:36:50 +00:00
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
|
2022-01-22 14:58:41 +00:00
|
|
|
#include <components/esm3/esmreader.hpp>
|
|
|
|
#include <components/esm3/esmwriter.hpp>
|
2015-03-08 19:44:41 +00:00
|
|
|
|
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void Transport::add(ESMReader& esm)
|
|
|
|
{
|
2022-04-11 22:18:39 +00:00
|
|
|
if (esm.retSubName().toInt() == fourCC("DODT"))
|
2015-03-08 19:44:41 +00:00
|
|
|
{
|
|
|
|
Dest dodt;
|
2024-02-27 19:47:46 +00:00
|
|
|
esm.getSubComposite(dodt.mPos);
|
2015-03-08 19:44:41 +00:00
|
|
|
mList.push_back(dodt);
|
|
|
|
}
|
2022-04-11 22:18:39 +00:00
|
|
|
else if (esm.retSubName().toInt() == fourCC("DNAM"))
|
2015-03-08 19:44:41 +00:00
|
|
|
{
|
2023-01-19 16:31:45 +00:00
|
|
|
std::string name = esm.getHString();
|
2018-10-12 06:36:50 +00:00
|
|
|
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);
|
2015-03-08 19:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Transport::save(ESMWriter& esm) const
|
|
|
|
{
|
2024-02-27 19:47:46 +00:00
|
|
|
for (const Dest& dest : mList)
|
2015-03-08 19:44:41 +00:00
|
|
|
{
|
2024-02-27 19:47:46 +00:00
|
|
|
esm.writeNamedComposite("DODT", dest.mPos);
|
|
|
|
esm.writeHNOCString("DNAM", dest.mCellName);
|
2015-03-08 19:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|