1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 10:06:42 +00:00

Fix minor exploit when map window is shown with transparency

This commit is contained in:
scrawl 2014-09-13 07:59:29 +02:00
parent 2b5adb325b
commit 2c58a879ec
4 changed files with 19 additions and 2 deletions

View file

@ -844,6 +844,15 @@ namespace MWGui
} }
} }
void MapWindow::setAlpha(float alpha)
{
NoDrop::setAlpha(alpha);
// can't allow showing map with partial transparency, as the fog of war will also go transparent
// and reveal parts of the map you shouldn't be able to see
for (std::vector<MyGUI::ImageBox*>::iterator it = mMapWidgets.begin(); it != mMapWidgets.end(); ++it)
(*it)->setVisible(alpha == 1);
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
EditNoteDialog::EditNoteDialog() EditNoteDialog::EditNoteDialog()

View file

@ -171,6 +171,8 @@ namespace MWGui
void setCellName(const std::string& cellName); void setCellName(const std::string& cellName);
virtual void setAlpha(float alpha);
void renderGlobalMap(Loading::Listener* loadingListener); void renderGlobalMap(Loading::Listener* loadingListener);
// adds the marker to the global map // adds the marker to the global map

View file

@ -96,11 +96,16 @@ void NoDrop::onFrame(float dt)
if (mTransparent) if (mTransparent)
{ {
mWidget->setNeedMouseFocus(false); // Allow click-through mWidget->setNeedMouseFocus(false); // Allow click-through
mWidget->setAlpha(std::max(0.13f, mWidget->getAlpha() - dt*5)); setAlpha(std::max(0.13f, mWidget->getAlpha() - dt*5));
} }
else else
{ {
mWidget->setNeedMouseFocus(true); mWidget->setNeedMouseFocus(true);
mWidget->setAlpha(std::min(1.0f, mWidget->getAlpha() + dt*5)); setAlpha(std::min(1.0f, mWidget->getAlpha() + dt*5));
} }
} }
void NoDrop::setAlpha(float alpha)
{
mWidget->setAlpha(alpha);
}

View file

@ -55,6 +55,7 @@ namespace MWGui
NoDrop(DragAndDrop* drag, MyGUI::Widget* widget); NoDrop(DragAndDrop* drag, MyGUI::Widget* widget);
void onFrame(float dt); void onFrame(float dt);
virtual void setAlpha(float alpha);
private: private:
MyGUI::Widget* mWidget; MyGUI::Widget* mWidget;