forked from mirror/openmw-tes3mp
Use unsigned integer types for QuickSave indices
This commit is contained in:
parent
f09fd6795c
commit
3af8f63895
2 changed files with 10 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
MWState::QuickSaveManager::QuickSaveManager(std::string &saveName, int maxSaves)
|
MWState::QuickSaveManager::QuickSaveManager(std::string &saveName, unsigned int maxSaves)
|
||||||
{
|
{
|
||||||
this->mSaveName = saveName;
|
this->mSaveName = saveName;
|
||||||
this->mMaxSaves = maxSaves;
|
this->mMaxSaves = maxSaves;
|
||||||
|
@ -13,7 +13,7 @@ MWState::QuickSaveManager::QuickSaveManager(std::string &saveName, int maxSaves)
|
||||||
|
|
||||||
void MWState::QuickSaveManager::visitSave(const Slot *saveSlot)
|
void MWState::QuickSaveManager::visitSave(const Slot *saveSlot)
|
||||||
{
|
{
|
||||||
int slotId;
|
unsigned int slotId;
|
||||||
if(tryExtractSlotId(saveSlot->mProfile.mDescription, slotId))
|
if(tryExtractSlotId(saveSlot->mProfile.mDescription, slotId))
|
||||||
{
|
{
|
||||||
++mSlotsVisited;
|
++mSlotsVisited;
|
||||||
|
@ -32,7 +32,7 @@ bool MWState::QuickSaveManager::isOldestSave(const Slot *compare)
|
||||||
return (compare->mTimeStamp <= mOldestSlotVisited->mTimeStamp);
|
return (compare->mTimeStamp <= mOldestSlotVisited->mTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MWState::QuickSaveManager::tryExtractSlotId(const std::string &slotName, int &extractedId)
|
bool MWState::QuickSaveManager::tryExtractSlotId(const std::string &slotName, unsigned int &extractedId)
|
||||||
{
|
{
|
||||||
std::istringstream formattedExtractor(slotName);
|
std::istringstream formattedExtractor(slotName);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ bool MWState::QuickSaveManager::tryExtractSlotId(const std::string &slotName, in
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MWState::QuickSaveManager::isSlotIdValid(int slotId)
|
bool MWState::QuickSaveManager::isSlotIdValid(unsigned int slotId)
|
||||||
{
|
{
|
||||||
return (slotId > 0 && slotId <= mMaxSaves);
|
return (slotId > 0 && slotId <= mMaxSaves);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
namespace MWState{
|
namespace MWState{
|
||||||
class QuickSaveManager{
|
class QuickSaveManager{
|
||||||
std::string mSaveName;
|
std::string mSaveName;
|
||||||
int mMaxSaves;
|
unsigned int mMaxSaves;
|
||||||
int mSlotsVisited;
|
unsigned int mSlotsVisited;
|
||||||
int mOldestSlotId;
|
unsigned int mOldestSlotId;
|
||||||
const Slot *mOldestSlotVisited;
|
const Slot *mOldestSlotVisited;
|
||||||
private:
|
private:
|
||||||
bool tryExtractSlotId(const std::string &slotName, int &extractedIdll);
|
bool tryExtractSlotId(const std::string &slotName, unsigned int &extractedIdll);
|
||||||
bool isSlotIdValid(int slotId);
|
bool isSlotIdValid(unsigned int slotId);
|
||||||
bool shouldCreateNewSlot();
|
bool shouldCreateNewSlot();
|
||||||
bool isOldestSave(const Slot *compare);
|
bool isOldestSave(const Slot *compare);
|
||||||
int calcNextSlotId();
|
int calcNextSlotId();
|
||||||
public:
|
public:
|
||||||
QuickSaveManager(std::string &saveName, int maxSaves);
|
QuickSaveManager(std::string &saveName, unsigned int maxSaves);
|
||||||
///< A utility class to manage multiple quicksave slots
|
///< A utility class to manage multiple quicksave slots
|
||||||
///
|
///
|
||||||
/// \param saveName The name of the save ("QuickSave", "AutoSave", etc)
|
/// \param saveName The name of the save ("QuickSave", "AutoSave", etc)
|
||||||
|
|
Loading…
Reference in a new issue