1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-12 13:13:27 +00:00

remove useless member, fix map rendering crash

This commit is contained in:
scrawl 2012-09-20 18:23:27 +02:00
parent 98c1dc1151
commit a161b34c67
3 changed files with 14 additions and 12 deletions

View File

@ -286,11 +286,11 @@ void MapWindow::addVisitedLocation(const std::string& name, int x, int y)
{ {
const int cellSize = 24; const int cellSize = 24;
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().getByName("GlobalMap.png"); int size = 24 * 61;
MyGUI::IntCoord widgetCoord( MyGUI::IntCoord widgetCoord(
(x+30)*cellSize+6, (x+30)*cellSize+6,
(tex->getHeight()-1) - (y+30)*cellSize+6, (size-1) - (y+30)*cellSize+6,
12, 12); 12, 12);
@ -351,9 +351,10 @@ void MapWindow::open()
{ {
mGlobalMapImage->setImageTexture("GlobalMap.png"); mGlobalMapImage->setImageTexture("GlobalMap.png");
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().getByName("GlobalMap.png"); int size = 24 * 61;
mGlobalMap->setCanvasSize (tex->getWidth(), tex->getHeight());
mGlobalMapImage->setSize(tex->getWidth(), tex->getHeight()); mGlobalMap->setCanvasSize (size, size);
mGlobalMapImage->setSize(size, size);
for (unsigned int i=0; i<mGlobalMapImage->getChildCount (); ++i) for (unsigned int i=0; i<mGlobalMapImage->getChildCount (); ++i)
{ {
@ -372,7 +373,7 @@ void MapWindow::open()
/// \todo save this last position in the savegame? /// \todo save this last position in the savegame?
if (MWBase::Environment::get().getWorld ()->isCellExterior ()) 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::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain();
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>(); MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();

View File

@ -82,9 +82,6 @@ namespace MWGui
MyGUI::Button* mEventBoxGlobal; MyGUI::Button* mEventBoxGlobal;
MyGUI::Button* mEventBoxLocal; MyGUI::Button* mEventBoxLocal;
int mGlobalMapSizeX;
int mGlobalMapSizeY;
protected: protected:
virtual void onPinToggled(); virtual void onPinToggled();
}; };

View File

@ -1,5 +1,7 @@
#include "globalmap.hpp" #include "globalmap.hpp"
#include <boost/filesystem.hpp>
#include <OgreImage.h> #include <OgreImage.h>
#include <OgreTextureManager.h> #include <OgreTextureManager.h>
#include <OgreColourValue.h> #include <OgreColourValue.h>
@ -23,10 +25,9 @@ namespace MWRender
void GlobalMap::render () void GlobalMap::render ()
{ {
Ogre::TexturePtr tex;
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().getByName ("GlobalMap.png"); if (!boost::filesystem::exists(mCacheDir + "/GlobalMap.png"))
if (tex.isNull ())
{ {
int cellSize = 24; int cellSize = 24;
@ -138,6 +139,9 @@ namespace MWRender
Ogre::TEX_TYPE_2D, width, height, 0, Ogre::PF_B8G8R8, Ogre::TU_DEFAULT); Ogre::TEX_TYPE_2D, width, height, 0, Ogre::PF_B8G8R8, Ogre::TU_DEFAULT);
tex->loadImage(image); tex->loadImage(image);
} }
else
tex = Ogre::TextureManager::getSingleton ().getByName ("GlobalMap.png");
tex->load(); tex->load();
} }