1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-22 10:39:41 +00:00

Merge branch 'savedgamecell' into 'master'

Fix cell name format in save menu

See merge request OpenMW/openmw!2853
This commit is contained in:
psi29a 2023-03-23 18:53:15 +00:00
commit 9a20193eb5
6 changed files with 12 additions and 8 deletions

View file

@ -373,7 +373,7 @@ namespace ESSImport
profile.mInGameTime.mMonth = context.mMonth; profile.mInGameTime.mMonth = context.mMonth;
profile.mInGameTime.mYear = context.mYear; profile.mInGameTime.mYear = context.mYear;
profile.mTimePlayed = 0; profile.mTimePlayed = 0;
profile.mPlayerCell = ESM::RefId::stringRefId(header.mGameData.mCurrentCell.toString()); profile.mPlayerCellName = context.mPlayerCellName;
if (context.mPlayerBase.mClass == "NEWCLASSID_CHARGEN") if (context.mPlayerBase.mClass == "NEWCLASSID_CHARGEN")
profile.mPlayerClassName = context.mCustomPlayerClassName; profile.mPlayerClassName = context.mCustomPlayerClassName;
else else

View file

@ -414,7 +414,7 @@ namespace MWGui
text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n"; text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n";
text << "#{sLevel} " << mCurrentSlot->mProfile.mPlayerLevel << "\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); int hour = int(mCurrentSlot->mProfile.mInGameTime.mGameHour);
bool pm = hour >= 12; bool pm = hour >= 12;

View file

@ -223,7 +223,7 @@ void MWState::StateManager::saveGame(const std::string& description, const Slot*
else else
profile.mPlayerClassId = classId; profile.mPlayerClassId = classId;
profile.mPlayerCell = ESM::RefId::stringRefId(world.getCellName()); profile.mPlayerCellName = world.getCellName();
profile.mInGameTime = world.getEpochTimeStamp(); profile.mInGameTime = world.getEpochTimeStamp();
profile.mTimePlayed = mTimePlayed; profile.mTimePlayed = mTimePlayed;
profile.mDescription = description; profile.mDescription = description;

View file

@ -21,7 +21,8 @@ namespace ESM
inline constexpr FormatVersion MaxOldCreatureStatsFormatVersion = 19; inline constexpr FormatVersion MaxOldCreatureStatsFormatVersion = 19;
inline constexpr FormatVersion MaxLimitedSizeStringsFormatVersion = 22; inline constexpr FormatVersion MaxLimitedSizeStringsFormatVersion = 22;
inline constexpr FormatVersion MaxStringRefIdFormatVersion = 23; inline constexpr FormatVersion MaxStringRefIdFormatVersion = 23;
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 24; inline constexpr FormatVersion MaxSavedGameCellNameAsRefId = 24;
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 25;
} }
#endif #endif

View file

@ -13,7 +13,10 @@ namespace ESM
mPlayerClassId = esm.getHNORefId("PLCL"); mPlayerClassId = esm.getHNORefId("PLCL");
mPlayerClassName = esm.getHNOString("PLCN"); 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.getHNTSized<16>(mInGameTime, "TSTM");
esm.getHNT(mTimePlayed, "TIME"); esm.getHNT(mTimePlayed, "TIME");
mDescription = esm.getHNString("DESC"); mDescription = esm.getHNString("DESC");
@ -37,7 +40,7 @@ namespace ESM
else else
esm.writeHNString("PLCN", mPlayerClassName); esm.writeHNString("PLCN", mPlayerClassName);
esm.writeHNRefId("PLCE", mPlayerCell); esm.writeHNString("PLCE", mPlayerCellName);
esm.writeHNT("TSTM", mInGameTime, 16); esm.writeHNT("TSTM", mInGameTime, 16);
esm.writeHNT("TIME", mTimePlayed); esm.writeHNT("TIME", mTimePlayed);
esm.writeHNString("DESC", mDescription); esm.writeHNString("DESC", mDescription);

View file

@ -27,8 +27,8 @@ namespace ESM
// Name of the class. When using a custom class, the ID is not really meaningful prior // 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. // to loading the savegame, so the name is stored separately.
std::string mPlayerClassName; std::string mPlayerClassName;
// Name of the cell. Note that this is not an ID.
ESM::RefId mPlayerCell; std::string mPlayerCellName;
EpochTimeStamp mInGameTime; EpochTimeStamp mInGameTime;
double mTimePlayed; double mTimePlayed;
std::string mDescription; std::string mDescription;