forked from teamnwah/openmw-tes3coop
Move createCharacter inside the try block
This commit is contained in:
parent
a0cc9de088
commit
50acdf3e47
1 changed files with 10 additions and 9 deletions
|
@ -174,17 +174,18 @@ void MWState::StateManager::endGame()
|
||||||
void MWState::StateManager::saveGame (const std::string& description, const Slot *slot)
|
void MWState::StateManager::saveGame (const std::string& description, const Slot *slot)
|
||||||
{
|
{
|
||||||
MWState::Character* character = getCurrentCharacter();
|
MWState::Character* character = getCurrentCharacter();
|
||||||
if (!character)
|
|
||||||
{
|
|
||||||
MWWorld::ConstPtr player = MWMechanics::getPlayer();
|
|
||||||
std::string name = player.get<ESM::NPC>()->mBase->mName;
|
|
||||||
|
|
||||||
character = mCharacterManager.createCharacter(name);
|
|
||||||
mCharacterManager.setCurrentCharacter(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (!character)
|
||||||
|
{
|
||||||
|
MWWorld::ConstPtr player = MWMechanics::getPlayer();
|
||||||
|
std::string name = player.get<ESM::NPC>()->mBase->mName;
|
||||||
|
|
||||||
|
character = mCharacterManager.createCharacter(name);
|
||||||
|
mCharacterManager.setCurrentCharacter(character);
|
||||||
|
}
|
||||||
|
|
||||||
ESM::SavedGame profile;
|
ESM::SavedGame profile;
|
||||||
|
|
||||||
MWBase::World& world = *MWBase::Environment::get().getWorld();
|
MWBase::World& world = *MWBase::Environment::get().getWorld();
|
||||||
|
@ -299,7 +300,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
||||||
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons);
|
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons);
|
||||||
|
|
||||||
// If no file was written, clean up the slot
|
// If no file was written, clean up the slot
|
||||||
if (slot && !boost::filesystem::exists(slot->mPath))
|
if (character && slot && !boost::filesystem::exists(slot->mPath))
|
||||||
{
|
{
|
||||||
character->deleteSlot(slot);
|
character->deleteSlot(slot);
|
||||||
character->cleanup();
|
character->cleanup();
|
||||||
|
|
Loading…
Reference in a new issue