mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-24 16:09:41 +00:00
character signatures
This commit is contained in:
parent
cbbdf390ad
commit
5ba56a5ea5
2 changed files with 24 additions and 0 deletions
|
@ -108,4 +108,23 @@ MWState::Character::SlotIterator MWState::Character::begin() const
|
|||
MWState::Character::SlotIterator MWState::Character::end() const
|
||||
{
|
||||
return mSlots.rend();
|
||||
}
|
||||
|
||||
ESM::SavedGame MWState::Character::getSignature() const
|
||||
{
|
||||
if (mSlots.empty())
|
||||
throw std::logic_error ("character signature not available");
|
||||
|
||||
std::vector<Slot>::const_iterator iter (mSlots.begin());
|
||||
|
||||
Slot slot = *iter;
|
||||
|
||||
for (++iter; iter!=mSlots.end(); ++iter)
|
||||
if (iter->mProfile.mPlayerLevel>slot.mProfile.mPlayerLevel)
|
||||
slot = *iter;
|
||||
else if (iter->mProfile.mPlayerLevel==slot.mProfile.mPlayerLevel &&
|
||||
iter->mTimeStamp>slot.mTimeStamp)
|
||||
slot = *iter;
|
||||
|
||||
return slot.mProfile;
|
||||
}
|
|
@ -50,6 +50,11 @@ namespace MWState
|
|||
///< First slot is the most recent. Other slots follow in descending order of save date.
|
||||
|
||||
SlotIterator end() const;
|
||||
|
||||
ESM::SavedGame getSignature() const;
|
||||
///< Return signature information for this character.
|
||||
///
|
||||
/// \todo attention This function must not be called if there are no slots.
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue