Skip to content

Commit

Permalink
Also reload modcache; reset menu UI on terrn load err
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Jul 19, 2024
1 parent d23ea93 commit 1c44d38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion source/main/AppContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ void AppContext::ReinitRendering()
m_overlay_system = nullptr;

LOG("[RoR|Rendering] Reinitializing rendering system: destroying scene manager");
App::GetGfxScene()->GetEnvMap().ShutdownEnvMap();
App::GetGfxScene()->Shutdown();

LOG("[RoR|Rendering] Reinitializing rendering system: destroying camera manager");
Expand All @@ -498,7 +499,6 @@ void AppContext::ReinitRendering()
this->SetUpOverlaySystem();

LOG("[RoR|Rendering] Reinitializing rendering system: create manual resources");
// BEGIN copypasta
Ogre::ConfigOptionMap ropts = App::GetAppContext()->GetOgreRoot()->getRenderSystem()->getConfigOptions();
int resolution = Ogre::StringConverter::parseInt(Ogre::StringUtil::split(ropts["Video Mode"].currentValue, " x ")[0], 1024);
int fsaa = 2 * (Ogre::StringConverter::parseInt(ropts["FSAA"].currentValue, 0) / 4);
Expand Down Expand Up @@ -558,6 +558,8 @@ void AppContext::ReinitRendering()

LOG("[RoR|Rendering] Reinitializing rendering system: setting up menu wallpaper");
App::GetGuiManager()->SetUpMenuWallpaper();

App::GetGameContext()->PushMessage(Message(MSG_APP_MODCACHE_LOAD_REQUESTED));
}

// --------------------------
Expand Down
2 changes: 1 addition & 1 deletion source/main/gfx/EnvironmentMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void RoR::GfxEnvmap::SetupEnvMap()
}
}

RoR::GfxEnvmap::~GfxEnvmap()
void RoR::GfxEnvmap::ShutdownEnvMap()
{
for (int face = 0; face < NUM_FACES; face++)
{
Expand Down
2 changes: 1 addition & 1 deletion source/main/gfx/EnvironmentMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class GfxEnvmap
public:

GfxEnvmap();
~GfxEnvmap();

void SetupEnvMap();
void UpdateEnvMap(Ogre::Vector3 center, GfxActor* gfx_actor, bool full = false);
void ShutdownEnvMap();

private:

Expand Down
10 changes: 5 additions & 5 deletions source/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,8 @@ int main(int argc, char *argv[])
{
try
{
if (!App::GetCacheSystem()->IsModCacheLoaded()) // If not already loaded...
{
App::GetGuiManager()->SetMouseCursorVisibility(GUIManager::MouseCursorVisibility::HIDDEN);
App::GetContentManager()->InitModCache(CacheValidity::UNKNOWN);
}
App::GetGuiManager()->SetMouseCursorVisibility(GUIManager::MouseCursorVisibility::HIDDEN);
App::GetContentManager()->InitModCache(CacheValidity::UNKNOWN);
}
catch (...)
{
Expand Down Expand Up @@ -887,6 +884,9 @@ int main(int argc, char *argv[])
catch (...)
{
HandleMsgQueueException(m.type);
App::GetGuiManager()->LoadingWindow.SetVisible(false);
App::GetGuiManager()->GameMainMenu.SetVisible(true);
App::GetGuiManager()->ShowMessageBox(_L("Internal error"), _L("Internal error while loading terrain, see RoR.log"));
}
break;
}
Expand Down

0 comments on commit 1c44d38

Please sign in to comment.