1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 21:59:55 +00:00

ESM::CellId is no longer stored on saves.

This commit is contained in:
florent.teppe 2023-02-22 13:45:29 +01:00
parent c39dd576f8
commit fb6701ac1a
4 changed files with 12 additions and 6 deletions

View file

@ -285,6 +285,7 @@ namespace
ESM::MaxOldSkillsAndAttributesFormatVersion, ESM::MaxOldSkillsAndAttributesFormatVersion,
ESM::MaxOldCreatureStatsFormatVersion, ESM::MaxOldCreatureStatsFormatVersion,
ESM::MaxStringRefIdFormatVersion, ESM::MaxStringRefIdFormatVersion,
ESM::MaxUseEsmCellId,
}); });
for (ESM::FormatVersion v = result.back() + 1; v <= ESM::CurrentSaveGameFormatVersion; ++v) for (ESM::FormatVersion v = result.back() + 1; v <= ESM::CurrentSaveGameFormatVersion; ++v)
result.push_back(v); result.push_back(v);

View file

@ -89,9 +89,13 @@ namespace ESM
ESM::RefId ESMReader::getCellId() ESM::RefId ESMReader::getCellId()
{ {
ESM::CellId cellId; if (mHeader.mFormatVersion <= ESM::MaxUseEsmCellId)
cellId.load(*this); {
return cellId.getCellRefId(); ESM::CellId cellId;
cellId.load(*this);
return cellId.getCellRefId();
}
return getHNRefId("NAME");
} }
void ESMReader::openRaw(std::unique_ptr<std::istream>&& stream, const std::filesystem::path& name) void ESMReader::openRaw(std::unique_ptr<std::istream>&& stream, const std::filesystem::path& name)

View file

@ -239,8 +239,7 @@ namespace ESM
void ESMWriter::writeCellId(const ESM::RefId& cellId) void ESMWriter::writeCellId(const ESM::RefId& cellId)
{ {
ESM::CellId cell = ESM::CellId::extractFromRefId(cellId); writeHNRefId("NAME", cellId);
cell.save(*this);
} }
void ESMWriter::writeMaybeFixedSizeString(const std::string& data, std::size_t size) void ESMWriter::writeMaybeFixedSizeString(const std::string& data, std::size_t size)

View file

@ -23,7 +23,9 @@ namespace ESM
inline constexpr FormatVersion MaxStringRefIdFormatVersion = 23; inline constexpr FormatVersion MaxStringRefIdFormatVersion = 23;
inline constexpr FormatVersion MaxSavedGameCellNameAsRefIdFormatVersion = 24; inline constexpr FormatVersion MaxSavedGameCellNameAsRefIdFormatVersion = 24;
inline constexpr FormatVersion MaxNameIsRefIdOnlyFormatVersion = 25; inline constexpr FormatVersion MaxNameIsRefIdOnlyFormatVersion = 25;
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 26; inline constexpr FormatVersion MaxUseEsmCellId = 26;
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 27;
} }
#endif #endif