mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +00:00
3bdd989a50
When multiple quicksaves occurred in quick succession, the numeric order of the saves could not be guaranteed. To prevent players from getting confused as to why their saves appear out of order, don't number them.
38 lines
946 B
C++
38 lines
946 B
C++
#include "quicksavemanager.hpp"
|
|
|
|
MWState::QuickSaveManager::QuickSaveManager(std::string &saveName, unsigned int maxSaves)
|
|
{
|
|
this->mSaveName = saveName;
|
|
this->mMaxSaves = maxSaves;
|
|
this->mOldestSlotVisited = NULL;
|
|
this->mSlotsVisited = 0;
|
|
}
|
|
|
|
void MWState::QuickSaveManager::visitSave(const Slot *saveSlot)
|
|
{
|
|
if(mSaveName == saveSlot->mProfile.mDescription)
|
|
{
|
|
++mSlotsVisited;
|
|
if(isOldestSave(saveSlot))
|
|
mOldestSlotVisited = saveSlot;
|
|
}
|
|
}
|
|
|
|
bool MWState::QuickSaveManager::isOldestSave(const Slot *compare)
|
|
{
|
|
if(mOldestSlotVisited == NULL)
|
|
return true;
|
|
return (compare->mTimeStamp <= mOldestSlotVisited->mTimeStamp);
|
|
}
|
|
|
|
bool MWState::QuickSaveManager::shouldCreateNewSlot()
|
|
{
|
|
return (mSlotsVisited < mMaxSaves);
|
|
}
|
|
|
|
const MWState::Slot *MWState::QuickSaveManager::getNextQuickSaveSlot()
|
|
{
|
|
if(shouldCreateNewSlot())
|
|
return NULL;
|
|
return mOldestSlotVisited;
|
|
}
|