1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 09:06:40 +00:00

Fixes #1224: Store class name instead of id in savegame header

This commit is contained in:
scrawl 2014-03-26 19:56:12 +01:00
parent 793649c854
commit 53ba23e303
4 changed files with 10 additions and 5 deletions

View file

@ -86,7 +86,7 @@ namespace MWGui
{ {
std::stringstream title; std::stringstream title;
title << it->getSignature().mPlayerName; title << it->getSignature().mPlayerName;
title << " (Level " << it->getSignature().mPlayerLevel << " " << it->getSignature().mPlayerClass << ")"; title << " (Level " << it->getSignature().mPlayerLevel << " " << it->getSignature().mPlayerClassName << ")";
mCharacterSelection->addItem (title.str()); mCharacterSelection->addItem (title.str());

View file

@ -155,7 +155,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
profile.mPlayerName = player.getClass().getName (player); profile.mPlayerName = player.getClass().getName (player);
profile.mPlayerLevel = player.getClass().getNpcStats (player).getLevel(); profile.mPlayerLevel = player.getClass().getNpcStats (player).getLevel();
profile.mPlayerClass = player.get<ESM::NPC>()->mBase->mClass; profile.mPlayerClassName = world.getStore().get<ESM::Class>().find(player.get<ESM::NPC>()->mBase->mClass)->mName;
profile.mPlayerCell = world.getCellName(); profile.mPlayerCell = world.getCellName();

View file

@ -11,7 +11,7 @@ void ESM::SavedGame::load (ESMReader &esm)
{ {
mPlayerName = esm.getHNString("PLNA"); mPlayerName = esm.getHNString("PLNA");
esm.getHNOT (mPlayerLevel, "PLLE"); esm.getHNOT (mPlayerLevel, "PLLE");
mPlayerClass = esm.getHNString("PLCL"); mPlayerClassName = esm.getHNString("PLCL");
mPlayerCell = esm.getHNString("PLCE"); mPlayerCell = esm.getHNString("PLCE");
esm.getHNT (mInGameTime, "TSTM", 16); esm.getHNT (mInGameTime, "TSTM", 16);
esm.getHNT (mTimePlayed, "TIME"); esm.getHNT (mTimePlayed, "TIME");
@ -30,7 +30,7 @@ void ESM::SavedGame::save (ESMWriter &esm) const
{ {
esm.writeHNString ("PLNA", mPlayerName); esm.writeHNString ("PLNA", mPlayerName);
esm.writeHNT ("PLLE", mPlayerLevel); esm.writeHNT ("PLLE", mPlayerLevel);
esm.writeHNString ("PLCL", mPlayerClass); esm.writeHNString ("PLCL", mPlayerClassName);
esm.writeHNString ("PLCE", mPlayerCell); esm.writeHNString ("PLCE", mPlayerCell);
esm.writeHNT ("TSTM", mInGameTime, 16); esm.writeHNT ("TSTM", mInGameTime, 16);
esm.writeHNT ("TIME", mTimePlayed); esm.writeHNT ("TIME", mTimePlayed);

View file

@ -26,7 +26,12 @@ namespace ESM
std::vector<std::string> mContentFiles; std::vector<std::string> mContentFiles;
std::string mPlayerName; std::string mPlayerName;
int mPlayerLevel; int mPlayerLevel;
std::string mPlayerClass; // this is the ID and not the name of the class // The (translated) name of the player class. So it will be displayed in the MW language
// the savegame was made in, not the currently running language of MW.
// However, savegames from a different MW language are not compatible anyway.
// And if only the ID was stored here, we would need to
// peek into the savegame to look for a class record in case it is a custom class.
std::string mPlayerClassName;
std::string mPlayerCell; std::string mPlayerCell;
TimeStamp mInGameTime; TimeStamp mInGameTime;
double mTimePlayed; double mTimePlayed;