|
|
|
@ -184,9 +184,9 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|
|
|
|
encoded->read(&profile.mScreenshot[0], encoded->size());
|
|
|
|
|
|
|
|
|
|
if (!slot)
|
|
|
|
|
slot = mCharacterManager.getCurrentCharacter()->createSlot (profile);
|
|
|
|
|
slot = getCurrentCharacter()->createSlot (profile);
|
|
|
|
|
else
|
|
|
|
|
slot = mCharacterManager.getCurrentCharacter()->updateSlot (slot, profile);
|
|
|
|
|
slot = getCurrentCharacter()->updateSlot (slot, profile);
|
|
|
|
|
|
|
|
|
|
boost::filesystem::ofstream stream (slot->mPath, std::ios::binary);
|
|
|
|
|
|
|
|
|
@ -252,7 +252,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|
|
|
|
|
|
|
|
|
// If no file was written, clean up the slot
|
|
|
|
|
if (slot && !boost::filesystem::exists(slot->mPath))
|
|
|
|
|
mCharacterManager.getCurrentCharacter()->deleteSlot(slot);
|
|
|
|
|
getCurrentCharacter()->deleteSlot(slot);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -419,7 +419,10 @@ void MWState::StateManager::deleteGame(const MWState::Character *character, cons
|
|
|
|
|
|
|
|
|
|
MWState::Character *MWState::StateManager::getCurrentCharacter (bool create)
|
|
|
|
|
{
|
|
|
|
|
return mCharacterManager.getCurrentCharacter (create);
|
|
|
|
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
|
std::string name = player.getClass().getName(player);
|
|
|
|
|
|
|
|
|
|
return mCharacterManager.getCurrentCharacter (create, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MWState::StateManager::CharacterIterator MWState::StateManager::characterBegin()
|
|
|
|
@ -440,11 +443,12 @@ void MWState::StateManager::update (float duration)
|
|
|
|
|
if (mAskLoadRecent)
|
|
|
|
|
{
|
|
|
|
|
int iButton = MWBase::Environment::get().getWindowManager()->readPressedButton();
|
|
|
|
|
if(iButton==0)
|
|
|
|
|
MWState::Character *curCharacter = getCurrentCharacter(false);
|
|
|
|
|
if(iButton==0 && curCharacter)
|
|
|
|
|
{
|
|
|
|
|
mAskLoadRecent = false;
|
|
|
|
|
//Load last saved game for current character
|
|
|
|
|
MWState::Character *curCharacter = getCurrentCharacter();
|
|
|
|
|
|
|
|
|
|
MWState::Slot lastSave = *curCharacter->begin();
|
|
|
|
|
loadGame(curCharacter, &lastSave);
|
|
|
|
|
}
|
|
|
|
|