mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-06 00:40:04 +00:00
added description field to saved game record; make use of description in GUI
This commit is contained in:
parent
7efac4c9a5
commit
67cd0887e6
@ -2,6 +2,7 @@
|
|||||||
#define GAME_MWSTATE_STATEMANAGER_H
|
#define GAME_MWSTATE_STATEMANAGER_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace MWState
|
namespace MWState
|
||||||
{
|
{
|
||||||
@ -52,7 +53,7 @@ namespace MWBase
|
|||||||
|
|
||||||
virtual void endGame() = 0;
|
virtual void endGame() = 0;
|
||||||
|
|
||||||
virtual void saveGame (const MWState::Slot *slot = 0) = 0;
|
virtual void saveGame (const std::string& description, const MWState::Slot *slot = 0) = 0;
|
||||||
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
||||||
///
|
///
|
||||||
/// \note Slot must belong to the current character.
|
/// \note Slot must belong to the current character.
|
||||||
|
@ -83,6 +83,8 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::open();
|
||||||
|
|
||||||
|
mSaveNameEdit->setCaption ("");
|
||||||
|
|
||||||
center();
|
center();
|
||||||
|
|
||||||
MWBase::StateManager* mgr = MWBase::Environment::get().getStateManager();
|
MWBase::StateManager* mgr = MWBase::Environment::get().getStateManager();
|
||||||
@ -145,7 +147,7 @@ namespace MWGui
|
|||||||
|
|
||||||
if (mSaving)
|
if (mSaving)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getStateManager()->saveGame (slot);
|
MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getCaption(), slot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -179,7 +181,7 @@ namespace MWGui
|
|||||||
return;
|
return;
|
||||||
for (MWState::Character::SlotIterator it = mCurrentCharacter->begin(); it != mCurrentCharacter->end(); ++it)
|
for (MWState::Character::SlotIterator it = mCurrentCharacter->begin(); it != mCurrentCharacter->end(); ++it)
|
||||||
{
|
{
|
||||||
mSaveList->addItem(it->mPath.string());
|
mSaveList->addItem(it->mProfile.mDescription);
|
||||||
}
|
}
|
||||||
onSlotSelected(mSaveList, MyGUI::ITEM_NONE);
|
onSlotSelected(mSaveList, MyGUI::ITEM_NONE);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ void MWState::StateManager::endGame()
|
|||||||
mState = State_Ended;
|
mState = State_Ended;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWState::StateManager::saveGame (const Slot *slot)
|
void MWState::StateManager::saveGame (const std::string& description, const Slot *slot)
|
||||||
{
|
{
|
||||||
ESM::SavedGame profile;
|
ESM::SavedGame profile;
|
||||||
|
|
||||||
@ -98,6 +98,7 @@ void MWState::StateManager::saveGame (const Slot *slot)
|
|||||||
profile.mInGameTime.mMonth = world.getMonth();
|
profile.mInGameTime.mMonth = world.getMonth();
|
||||||
/// \todo year
|
/// \todo year
|
||||||
/// \todo time played
|
/// \todo time played
|
||||||
|
profile.mDescription = description;
|
||||||
|
|
||||||
if (!slot)
|
if (!slot)
|
||||||
slot = mCharacterManager.getCurrentCharacter()->createSlot (profile);
|
slot = mCharacterManager.getCurrentCharacter()->createSlot (profile);
|
||||||
|
@ -32,7 +32,7 @@ namespace MWState
|
|||||||
|
|
||||||
virtual void endGame();
|
virtual void endGame();
|
||||||
|
|
||||||
virtual void saveGame (const Slot *slot = 0);
|
virtual void saveGame (const std::string& description, const Slot *slot = 0);
|
||||||
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
||||||
///
|
///
|
||||||
/// \note Slot must belong to the current character.
|
/// \note Slot must belong to the current character.
|
||||||
|
@ -15,6 +15,7 @@ void ESM::SavedGame::load (ESMReader &esm)
|
|||||||
mPlayerCell = esm.getHNString("PCEL");
|
mPlayerCell = esm.getHNString("PCEL");
|
||||||
esm.getHNT (mInGameTime, "TSTM", 16);
|
esm.getHNT (mInGameTime, "TSTM", 16);
|
||||||
esm.getHNT (mTimePlayed, "TIME");
|
esm.getHNT (mTimePlayed, "TIME");
|
||||||
|
mDescription = esm.getHNString ("DESC");
|
||||||
|
|
||||||
while (esm.isNextSub ("DEPE"))
|
while (esm.isNextSub ("DEPE"))
|
||||||
mContentFiles.push_back (esm.getHString());
|
mContentFiles.push_back (esm.getHString());
|
||||||
@ -28,6 +29,7 @@ void ESM::SavedGame::save (ESMWriter &esm) const
|
|||||||
esm.writeHNCString ("PCEL", mPlayerCell);
|
esm.writeHNCString ("PCEL", mPlayerCell);
|
||||||
esm.writeHNT ("TSTM", mInGameTime, 16);
|
esm.writeHNT ("TSTM", mInGameTime, 16);
|
||||||
esm.writeHNT ("TIME", mTimePlayed);
|
esm.writeHNT ("TIME", mTimePlayed);
|
||||||
|
esm.writeHNCString ("DESC", mDescription);
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
|
for (std::vector<std::string>::const_iterator iter (mContentFiles.begin());
|
||||||
iter!=mContentFiles.end(); ++iter)
|
iter!=mContentFiles.end(); ++iter)
|
||||||
|
@ -30,6 +30,7 @@ namespace ESM
|
|||||||
std::string mPlayerCell;
|
std::string mPlayerCell;
|
||||||
TimeStamp mInGameTime;
|
TimeStamp mInGameTime;
|
||||||
double mTimePlayed;
|
double mTimePlayed;
|
||||||
|
std::string mDescription;
|
||||||
|
|
||||||
/// \todo add field for screenshot
|
/// \todo add field for screenshot
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user