1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-03 17:54:06 +00:00

fixes integration tests

we still want to be able to write using old formats
This commit is contained in:
florent.teppe 2023-03-01 17:27:35 +01:00
parent f99e65843a
commit 1e0c3bfdec
2 changed files with 9 additions and 2 deletions

View File

@ -793,12 +793,12 @@ namespace MWWorld
}
ESM::Cell* Store<ESM::Cell>::insert(const ESM::Cell& cell)
{
ESM::Cell* insertedCell = &mCells.emplace(cell.mId, cell).first->second;
if (search(cell) != nullptr)
{
const std::string cellType = (cell.isExterior()) ? "exterior" : "interior";
throw std::runtime_error("Failed to create " + cellType + " cell");
}
ESM::Cell* insertedCell = &mCells.emplace(cell.mId, cell).first->second;
if (cell.isExterior())
{
std::pair<int, int> key(cell.getGridX(), cell.getGridY());

View File

@ -4,6 +4,7 @@
#include <fstream>
#include <stdexcept>
#include <components/esm3/cellid.hpp>
#include <components/debug/debuglog.hpp>
#include <components/misc/notnullptr.hpp>
#include <components/to_utf8/to_utf8.hpp>
@ -238,7 +239,13 @@ namespace ESM
void ESMWriter::writeCellId(const ESM::RefId& cellId)
{
writeHNRefId("NAME", cellId);
if (mHeader.mFormatVersion <= ESM::MaxUseEsmCellId)
{
ESM::CellId generatedCellid = ESM::CellId::extractFromRefId(cellId);
generatedCellid.save(*this);
}
else
writeHNRefId("NAME", cellId);
}
void ESMWriter::writeMaybeFixedSizeString(const std::string& data, std::size_t size)