Don't store a save's cell name as a RefID

depth-refraction
Evil Eye 2 years ago
parent 99dac61e49
commit 54d6fb29c2

@ -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

@ -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;

@ -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;

@ -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

@ -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);

@ -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;

Loading…
Cancel
Save