1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge branch 'develop' of https://github.com/vcmi/vcmi into develop

This commit is contained in:
DjWarmonger 2014-09-18 14:30:11 +02:00
commit a17e27bfc6
2 changed files with 32 additions and 7 deletions

View File

@ -357,17 +357,37 @@ int main(int argc, char** argv)
std::string driverName(info.name);
logGlobal->infoStream() << "\t" << driverName;
if(!preferredDriverName.empty() && driverName == preferredDriverName)
{
preferredDriverIndex = it;
logGlobal->infoStream() << "\t\twill select this";
}
logGlobal->infoStream() << "\t" << driverName << " (active)";
}
else
logGlobal->infoStream() << "\t" << driverName;
}
#endif // VCMI_SDL1
config::CConfigHandler::GuiOptionsMap::key_type resPair(res["width"].Float(), res["height"].Float());
if (conf.guiOptions.count(resPair) == 0)
{
// selected resolution was not found - complain & fallback to something that we do have.
logGlobal->errorStream() << "Selected resolution " << resPair.first << "x" << resPair.second << " was not found!";
if (conf.guiOptions.empty())
{
logGlobal->errorStream() << "Unable to continue - no valid resolutions found! Please reinstall VCMI to fix this";
exit(1);
}
else
{
Settings newRes = settings.write["video"]["screenRes"];
newRes["width"].Float() = conf.guiOptions.begin()->first.first;
newRes["height"].Float() = conf.guiOptions.begin()->first.second;
conf.SetResolution(newRes["width"].Float(), newRes["height"].Float());
logGlobal->errorStream() << "Falling back to " << newRes["width"].Float() << "x" << newRes["height"].Float();
}
}
setScreenRes(res["width"].Float(), res["height"].Float(), video["bitsPerPixel"].Float(), video["fullscreen"].Bool());
logGlobal->infoStream() <<"\tInitializing screen: "<<pomtime.getDiff();
}

View File

@ -170,8 +170,13 @@ namespace config
~CConfigHandler(void); //d-tor
GUIOptions *go() { return current; };
void SetResolution(int x, int y) {
current = &guiOptions[std::pair<int,int>(x, y)];
void SetResolution(int x, int y)
{
std::pair<int,int> index(x, y);
if (guiOptions.count(index) == 0)
current = nullptr;
else
current = &guiOptions.at(index);
}
};
}