diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index fe357660dd..ea7b442593 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -286,11 +286,11 @@ void MapWindow::addVisitedLocation(const std::string& name, int x, int y) { const int cellSize = 24; - Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().getByName("GlobalMap.png"); + int size = 24 * 61; MyGUI::IntCoord widgetCoord( (x+30)*cellSize+6, - (tex->getHeight()-1) - (y+30)*cellSize+6, + (size-1) - (y+30)*cellSize+6, 12, 12); @@ -351,9 +351,10 @@ void MapWindow::open() { mGlobalMapImage->setImageTexture("GlobalMap.png"); - Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().getByName("GlobalMap.png"); - mGlobalMap->setCanvasSize (tex->getWidth(), tex->getHeight()); - mGlobalMapImage->setSize(tex->getWidth(), tex->getHeight()); + int size = 24 * 61; + + mGlobalMap->setCanvasSize (size, size); + mGlobalMapImage->setSize(size, size); for (unsigned int i=0; igetChildCount (); ++i) { @@ -372,7 +373,7 @@ void MapWindow::open() /// \todo save this last position in the savegame? if (MWBase::Environment::get().getWorld ()->isCellExterior ()) { - mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(tex->getWidth() * worldX - 16, tex->getHeight() * worldY - 16)); + mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(size * worldX - 16, size * worldY - 16)); MyGUI::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain(); MyGUI::RotatingSkin* rotatingSubskin = main->castType(); diff --git a/apps/openmw/mwgui/map_window.hpp b/apps/openmw/mwgui/map_window.hpp index e9c473a299..a8b5b9cb90 100644 --- a/apps/openmw/mwgui/map_window.hpp +++ b/apps/openmw/mwgui/map_window.hpp @@ -82,9 +82,6 @@ namespace MWGui MyGUI::Button* mEventBoxGlobal; MyGUI::Button* mEventBoxLocal; - int mGlobalMapSizeX; - int mGlobalMapSizeY; - protected: virtual void onPinToggled(); }; diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index 90fd25aff3..72adb75792 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -1,5 +1,7 @@ #include "globalmap.hpp" +#include + #include #include #include @@ -23,10 +25,9 @@ namespace MWRender void GlobalMap::render () { + Ogre::TexturePtr tex; - Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().getByName ("GlobalMap.png"); - - if (tex.isNull ()) + if (!boost::filesystem::exists(mCacheDir + "/GlobalMap.png")) { int cellSize = 24; @@ -138,6 +139,9 @@ namespace MWRender Ogre::TEX_TYPE_2D, width, height, 0, Ogre::PF_B8G8R8, Ogre::TU_DEFAULT); tex->loadImage(image); } + else + tex = Ogre::TextureManager::getSingleton ().getByName ("GlobalMap.png"); + tex->load(); }