diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index c610224b33..3fac21ec8b 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -373,7 +373,7 @@ namespace ESSImport profile.mInGameTime.mMonth = context.mMonth; profile.mInGameTime.mYear = context.mYear; profile.mTimePlayed = 0; - profile.mPlayerCell = ESM::RefId::stringRefId(header.mGameData.mCurrentCell.toString()); + profile.mPlayerCellName = context.mPlayerCellName; if (context.mPlayerBase.mClass == "NEWCLASSID_CHARGEN") profile.mPlayerClassName = context.mCustomPlayerClassName; else diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 595591a78b..1e963a0348 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -414,7 +414,7 @@ namespace MWGui text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n"; text << "#{sLevel} " << mCurrentSlot->mProfile.mPlayerLevel << "\n"; - text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCell << "}\n"; + text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCellName << "}\n"; int hour = int(mCurrentSlot->mProfile.mInGameTime.mGameHour); bool pm = hour >= 12; diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index b4da73c9da..8718b7853c 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -223,7 +223,7 @@ void MWState::StateManager::saveGame(const std::string& description, const Slot* else profile.mPlayerClassId = classId; - profile.mPlayerCell = ESM::RefId::stringRefId(world.getCellName()); + profile.mPlayerCellName = world.getCellName(); profile.mInGameTime = world.getEpochTimeStamp(); profile.mTimePlayed = mTimePlayed; profile.mDescription = description; diff --git a/components/esm3/formatversion.hpp b/components/esm3/formatversion.hpp index 9ef945d14d..2824ced3ec 100644 --- a/components/esm3/formatversion.hpp +++ b/components/esm3/formatversion.hpp @@ -21,7 +21,8 @@ namespace ESM inline constexpr FormatVersion MaxOldCreatureStatsFormatVersion = 19; inline constexpr FormatVersion MaxLimitedSizeStringsFormatVersion = 22; inline constexpr FormatVersion MaxStringRefIdFormatVersion = 23; - inline constexpr FormatVersion CurrentSaveGameFormatVersion = 24; + inline constexpr FormatVersion MaxSavedGameCellNameAsRefId = 24; + inline constexpr FormatVersion CurrentSaveGameFormatVersion = 25; } #endif diff --git a/components/esm3/savedgame.cpp b/components/esm3/savedgame.cpp index add3df02b3..1cf0ea033c 100644 --- a/components/esm3/savedgame.cpp +++ b/components/esm3/savedgame.cpp @@ -13,7 +13,10 @@ namespace ESM mPlayerClassId = esm.getHNORefId("PLCL"); mPlayerClassName = esm.getHNOString("PLCN"); - mPlayerCell = esm.getHNRefId("PLCE"); + if (esm.getFormatVersion() <= ESM::MaxSavedGameCellNameAsRefId) + mPlayerCellName = esm.getHNRefId("PLCE").toString(); + else + mPlayerCellName = esm.getHNString("PLCE"); esm.getHNTSized<16>(mInGameTime, "TSTM"); esm.getHNT(mTimePlayed, "TIME"); mDescription = esm.getHNString("DESC"); @@ -37,7 +40,7 @@ namespace ESM else esm.writeHNString("PLCN", mPlayerClassName); - esm.writeHNRefId("PLCE", mPlayerCell); + esm.writeHNString("PLCE", mPlayerCellName); esm.writeHNT("TSTM", mInGameTime, 16); esm.writeHNT("TIME", mTimePlayed); esm.writeHNString("DESC", mDescription); diff --git a/components/esm3/savedgame.hpp b/components/esm3/savedgame.hpp index fb946742f3..0777b2498b 100644 --- a/components/esm3/savedgame.hpp +++ b/components/esm3/savedgame.hpp @@ -27,8 +27,8 @@ namespace ESM // Name of the class. When using a custom class, the ID is not really meaningful prior // to loading the savegame, so the name is stored separately. std::string mPlayerClassName; - - ESM::RefId mPlayerCell; + // Name of the cell. Note that this is not an ID. + std::string mPlayerCellName; EpochTimeStamp mInGameTime; double mTimePlayed; std::string mDescription;