fix the global map updating when pinned

This commit is contained in:
scrawl 2012-09-25 21:57:57 +02:00
parent 8daf790235
commit 71d04e16da
2 changed files with 16 additions and 0 deletions

View file

@ -224,6 +224,9 @@ void LocalMapBase::setPlayerPos(const float x, const float y)
{ {
if (x == mLastPositionX && y == mLastPositionY) if (x == mLastPositionX && y == mLastPositionY)
return; return;
notifyPlayerUpdate ();
MyGUI::IntSize size = mLocalMap->getCanvasSize(); MyGUI::IntSize size = mLocalMap->getCanvasSize();
MyGUI::IntPoint middle = MyGUI::IntPoint((1/3.f + x/3.f)*size.width,(1/3.f + y/3.f)*size.height); MyGUI::IntPoint middle = MyGUI::IntPoint((1/3.f + x/3.f)*size.width,(1/3.f + y/3.f)*size.height);
MyGUI::IntCoord viewsize = mLocalMap->getCoord(); MyGUI::IntCoord viewsize = mLocalMap->getCoord();
@ -239,6 +242,9 @@ void LocalMapBase::setPlayerDir(const float x, const float y)
{ {
if (x == mLastDirectionX && y == mLastDirectionY) if (x == mLastDirectionX && y == mLastDirectionY)
return; return;
notifyPlayerUpdate ();
MyGUI::ISubWidget* main = mCompass->getSubWidgetMain(); MyGUI::ISubWidget* main = mCompass->getSubWidgetMain();
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>(); MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
rotatingSubskin->setCenter(MyGUI::IntPoint(16,16)); rotatingSubskin->setCenter(MyGUI::IntPoint(16,16));
@ -407,3 +413,9 @@ void MapWindow::globalMapUpdatePlayer ()
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY); MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
mGlobalMap->setViewOffset(viewoffs); mGlobalMap->setViewOffset(viewoffs);
} }
void MapWindow::notifyPlayerUpdate ()
{
if (mGlobal)
globalMapUpdatePlayer ();
}

View file

@ -49,6 +49,8 @@ namespace MWGui
void onMarkerFocused(MyGUI::Widget* w1, MyGUI::Widget* w2); void onMarkerFocused(MyGUI::Widget* w1, MyGUI::Widget* w2);
void onMarkerUnfocused(MyGUI::Widget* w1, MyGUI::Widget* w2); void onMarkerUnfocused(MyGUI::Widget* w1, MyGUI::Widget* w2);
virtual void notifyPlayerUpdate() {}
OEngine::GUI::Layout* mLayout; OEngine::GUI::Layout* mLayout;
bool mMapDragAndDrop; bool mMapDragAndDrop;
@ -93,6 +95,8 @@ namespace MWGui
protected: protected:
virtual void onPinToggled(); virtual void onPinToggled();
virtual void notifyPlayerUpdate();
}; };
} }
#endif #endif