forked from teamnwah/openmw-tes3coop
Bug #1148: Workaround for broken images in some MW versions
This commit is contained in:
parent
52f89e9a17
commit
d0c6ecd03a
1 changed files with 12 additions and 0 deletions
|
@ -12,6 +12,8 @@
|
||||||
#include <boost/range/algorithm/copy.hpp>
|
#include <boost/range/algorithm/copy.hpp>
|
||||||
#include <OgreUTFString.h>
|
#include <OgreUTFString.h>
|
||||||
|
|
||||||
|
#include <OgreResourceGroupManager.h>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
int convertFromHex(std::string hex)
|
int convertFromHex(std::string hex)
|
||||||
|
@ -288,6 +290,16 @@ namespace MWGui
|
||||||
MyGUI::ImageBox* box = mParent->createWidget<MyGUI::ImageBox> ("ImageBox",
|
MyGUI::ImageBox* box = mParent->createWidget<MyGUI::ImageBox> ("ImageBox",
|
||||||
MyGUI::IntCoord(0, mHeight, width, height), MyGUI::Align::Left | MyGUI::Align::Top,
|
MyGUI::IntCoord(0, mHeight, width, height), MyGUI::Align::Left | MyGUI::Align::Top,
|
||||||
mParent->getName() + boost::lexical_cast<std::string>(mParent->getChildCount()));
|
mParent->getName() + boost::lexical_cast<std::string>(mParent->getChildCount()));
|
||||||
|
|
||||||
|
// Apparently a bug with some morrowind versions, they reference the image without the size suffix.
|
||||||
|
// So if the image isn't found, try appending the size.
|
||||||
|
if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup("bookart\\"+image))
|
||||||
|
{
|
||||||
|
std::stringstream str;
|
||||||
|
str << image.substr(0, image.rfind(".")) << "_" << width << "_" << height << image.substr(image.rfind("."));
|
||||||
|
image = str.str();
|
||||||
|
}
|
||||||
|
|
||||||
box->setImageTexture("bookart\\" + image);
|
box->setImageTexture("bookart\\" + image);
|
||||||
box->setProperty("NeedMouse", "false");
|
box->setProperty("NeedMouse", "false");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue