From 60a12b3dee7004ec64c388dbe519f40b5837ab81 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 5 Mar 2016 20:00:51 +0100 Subject: [PATCH] Use MyGUI's castType function --- apps/openmw/mwgui/windowmanagerimp.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f5d78aee6..1b2c45520 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1635,9 +1635,7 @@ namespace MWGui layout->mMainWidget->setPosition(pos); layout->mMainWidget->setSize(size); - MyGUI::Window* window = dynamic_cast(layout->mMainWidget); - if (!window) - throw std::runtime_error("Attempting to track size of a non-resizable window"); + MyGUI::Window* window = layout->mMainWidget->castType(); window->eventWindowChangeCoord += MyGUI::newDelegate(this, &WindowManager::onWindowChangeCoord); mTrackedWindows[window] = name; } @@ -2010,7 +2008,7 @@ namespace MWGui while (enumerator.next()) { MyGUI::IResource* resource = enumerator.current().second; - ResourceImageSetPointerFix* imgSetPointer = dynamic_cast(resource); + ResourceImageSetPointerFix* imgSetPointer = resource->castType(false); if (!imgSetPointer) continue; std::string tex_name = imgSetPointer->getImageSet()->getIndexInfo(0,0).texture;