From 82eaa9f1bc7af41be5193db065e67dbd26d4132a Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 11 Jan 2015 20:07:17 +0100 Subject: [PATCH] Fix loading crash (don't apply viewmode before player is set up) (Fixes #2272) --- apps/openmw/mwstate/statemanagerimp.cpp | 11 +++++++++-- apps/openmw/mwworld/worldimp.cpp | 6 ------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 9bd2dbd3e..54c3726bd 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -342,6 +342,8 @@ void MWState::StateManager::loadGame (const Character *character, const std::str Loading::ScopedLoad load(&listener); + bool firstPersonCam = false; + size_t total = reader.getFileSize(); int currentPercent = 0; while (reader.hasMoreRecs()) @@ -396,9 +398,11 @@ void MWState::StateManager::loadGame (const Character *character, const std::str case ESM::REC_ENAB: case ESM::REC_LEVC: case ESM::REC_LEVI: - case ESM::REC_CAM_: + MWBase::Environment::get().getWorld()->readRecord(reader, n.val, contentFileMap); + break; - MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap); + case ESM::REC_CAM_: + reader.getHNT(firstPersonCam, "FIRS"); break; case ESM::REC_GSCR: @@ -446,6 +450,9 @@ void MWState::StateManager::loadGame (const Character *character, const std::str MWBase::Environment::get().getWindowManager()->updatePlayer(); MWBase::Environment::get().getMechanicsManager()->playerLoaded(); + if (firstPersonCam != MWBase::Environment::get().getWorld()->isFirstPerson()) + MWBase::Environment::get().getWorld()->togglePOV(); + MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr(); ESM::CellId cellId = ptr.getCell()->getCell()->getCellId(); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 4c34f2a04..5e773f5d3 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -356,12 +356,6 @@ namespace MWWorld reader.getHNT(mTeleportEnabled, "TELE"); reader.getHNT(mLevitationEnabled, "LEVT"); return; - case ESM::REC_CAM_: - bool firstperson; - reader.getHNT(firstperson, "FIRS"); - if (firstperson != isFirstPerson()) - togglePOV(); - break; default: if (!mStore.readRecord (reader, type) && !mGlobalVariables.readRecord (reader, type) &&