Changed: More comments

This commit is contained in:
kervala 2015-11-08 13:43:02 +01:00
parent c3a6787196
commit 7ed54e8c76

View file

@ -1403,19 +1403,25 @@ bool getRyzomModes(std::vector<NL3D::UDriver::CMode> &videoModes, std::vector<st
// **** Init Video Modes // **** Init Video Modes
Driver->getModes(videoModes); Driver->getModes(videoModes);
// Remove modes under 800x600 and get the unique strings // Remove modes under 800x600 and get the unique strings
sint i, j; sint i, j;
for (i = 0; i < (sint)videoModes.size(); ++i) for (i = 0; i < (sint)videoModes.size(); ++i)
{ {
if ((videoModes[i].Width < 800) || (videoModes[i].Height < 600)) if ((videoModes[i].Width < 800) || (videoModes[i].Height < 600))
{ {
// discard modes under 800x600
videoModes.erase(videoModes.begin()+i); videoModes.erase(videoModes.begin()+i);
--i; --i;
} }
else else
{ {
bool bFound = false; bool bFound = false;
// create string format with width and height
string res = toString(videoModes[i].Width)+" x "+toString(videoModes[i].Height); string res = toString(videoModes[i].Width)+" x "+toString(videoModes[i].Height);
// check if video mode already found in list
for (j = 0; j < (sint)stringModeList.size(); ++j) for (j = 0; j < (sint)stringModeList.size(); ++j)
{ {
if (stringModeList[j] == res) if (stringModeList[j] == res)
@ -1424,12 +1430,17 @@ bool getRyzomModes(std::vector<NL3D::UDriver::CMode> &videoModes, std::vector<st
break; break;
} }
} }
// if not found
if (!bFound) if (!bFound)
{ {
// add it to the list
stringModeList.push_back(res); stringModeList.push_back(res);
// process all screen sizes less or equal to desired one
if ((videoModes[i].Width <= ClientCfg.Width) && (videoModes[i].Height <= ClientCfg.Height)) if ((videoModes[i].Width <= ClientCfg.Width) && (videoModes[i].Height <= ClientCfg.Height))
{ {
// take first one by default
if (nFoundStringMode == -1) if (nFoundStringMode == -1)
{ {
nFoundStringMode = j; nFoundStringMode = j;
@ -1437,6 +1448,7 @@ bool getRyzomModes(std::vector<NL3D::UDriver::CMode> &videoModes, std::vector<st
} }
else else
{ {
// then take the largest one
if ((videoModes[i].Width >= videoModes[nFoundMode].Width) && if ((videoModes[i].Width >= videoModes[nFoundMode].Width) &&
(videoModes[i].Height >= videoModes[nFoundMode].Height)) (videoModes[i].Height >= videoModes[nFoundMode].Height))
{ {
@ -1461,6 +1473,7 @@ bool getRyzomModes(std::vector<NL3D::UDriver::CMode> &videoModes, std::vector<st
// add frequencies to frequencies list // add frequencies to frequencies list
for (i = 0; i < (sint)videoModes.size(); ++i) for (i = 0; i < (sint)videoModes.size(); ++i)
{ {
// only take exact screen sizes
if (videoModes[i].Width == videoModes[nFoundMode].Width && videoModes[i].Height == videoModes[nFoundMode].Height) if (videoModes[i].Width == videoModes[nFoundMode].Width && videoModes[i].Height == videoModes[nFoundMode].Height)
{ {
uint freq = videoModes[i].Frequency; uint freq = videoModes[i].Frequency;