Use first resolution in fullscreen if current is not supported (Fixes #4113)

new-script-api
scrawl 7 years ago
parent 64e27c032b
commit 5b10e3128e

@ -353,24 +353,31 @@ namespace MWGui
} }
bool supported = false; bool supported = false;
int fallbackX = 0, fallbackY = 0;
for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i) for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i)
{ {
std::string resStr = mResolutionList->getItemNameAt(i); std::string resStr = mResolutionList->getItemNameAt(i);
int resX, resY; int resX, resY;
parseResolution (resX, resY, resStr); parseResolution (resX, resY, resStr);
if (i == 0)
{
fallbackX = resX;
fallbackY = resY;
}
if (resX == Settings::Manager::getInt("resolution x", "Video") if (resX == Settings::Manager::getInt("resolution x", "Video")
&& resY == Settings::Manager::getInt("resolution y", "Video")) && resY == Settings::Manager::getInt("resolution y", "Video"))
supported = true; supported = true;
} }
if (!supported) if (!supported && mResolutionList->getItemCount())
{ {
std::string msg = "This resolution is not supported in Fullscreen mode. Please select a resolution from the list."; if (fallbackX != 0 && fallbackY != 0)
MWBase::Environment::get().getWindowManager()-> {
messageBox(msg); Settings::Manager::setInt("resolution x", "Video", fallbackX);
_sender->castType<MyGUI::Button>()->setCaption(off); Settings::Manager::setInt("resolution y", "Video", fallbackY);
return; }
} }
mWindowBorderButton->setEnabled(!newState); mWindowBorderButton->setEnabled(!newState);

Loading…
Cancel
Save