From b589d48e4b61793c2609e4f0c7ad80bc58d5b267 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 19 Oct 2010 14:22:10 +0200 Subject: [PATCH] Changed: Use of getRyzomModes --- .../src/interface_v3/action_handler_game.cpp | 53 +---------------- code/ryzom/client/src/login.cpp | 57 ++----------------- 2 files changed, 6 insertions(+), 104 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index be0e50b5e..4b0fa1212 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2904,59 +2904,10 @@ public: { if (Driver == NULL) return; - // **** Init Video Modes VideoModes.clear(); - Driver->getModes(VideoModes); - // Remove modes under 800x600 and get the unique string vector stringModeList; - sint i, j, nFoundMode = -1; - for (i=0; i < (sint)VideoModes.size(); ++i) - { - if ((VideoModes[i].Width < 800) || (VideoModes[i].Height < 600)) - { - VideoModes.erase(VideoModes.begin()+i); - --i; - } - else - { - bool bFound = false; - string tmp = toString(VideoModes[i].Width)+" x "+toString(VideoModes[i].Height); - for (j = 0; j < (sint)stringModeList.size(); ++j) - if (stringModeList[j] == tmp) - { - bFound = true; - break; - } - if (!bFound) - { - stringModeList.push_back(tmp); - if ((VideoModes[i].Width <= ClientCfg.Width) && (VideoModes[i].Height <= ClientCfg.Height)) - { - if (nFoundMode == -1) - { - nFoundMode = j; - } - else - { - if ((VideoModes[i].Width >= VideoModes[nFoundMode].Width) && - (VideoModes[i].Height >= VideoModes[nFoundMode].Height)) - nFoundMode = j; - } - } - } - } - } - // If no modes are available, display a message and exit - if (!ClientCfg.Windowed && nFoundMode == -1) - { - Driver->systemMessageBox("No Video Modes available!\n" - "Minimum Video mode to play Ryzom is 800x600.\n", - "No Video Mode!", - NL3D::UDriver::okType, - NL3D::UDriver::exclamationIcon); - exit(EXIT_SUCCESS); - } + sint nFoundMode = getRyzomModes(VideoModes, stringModeList); // Initialize interface combo box CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -2964,7 +2915,7 @@ public: if( pCB ) { pCB->resetTexts(); - for (j = 0; j < (sint)stringModeList.size(); j++) + for (sint j = 0; j < (sint)stringModeList.size(); j++) pCB->addText(ucstring(stringModeList[j])); } // -1 is important to indicate we set this value in edit mode diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index aad1a3a3e..35d7e00be 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -31,6 +31,7 @@ #include "nel/net/tcp_sock.h" #include "nel/3d/u_driver.h" +#include "nel/misc/big_file.h" #include "interface_v3/interface_manager.h" #include "interface_v3/input_handler_manager.h" @@ -1893,61 +1894,11 @@ class CAHInitResLod : public IActionHandler //nlinfo("CAHInitResLod called"); if (Driver == NULL) return; - // **** Init Video Modes VideoModes.clear(); - Driver->getModes(VideoModes); + StringModeList.clear(); StringModeList.push_back("uiConfigWindowed"); - // Remove modes under 800x600 and get the unique strings - sint i, j; - for (i=0; i < (sint)VideoModes.size(); ++i) - { - if ((VideoModes[i].Width < 800) || (VideoModes[i].Height < 600)) - { - VideoModes.erase(VideoModes.begin()+i); - --i; - } - else - { - bool bFound = false; - string tmp = toString(VideoModes[i].Width)+" x "+toString(VideoModes[i].Height); - for (j = 0; j < (sint)StringModeList.size(); ++j) - { - if (StringModeList[j] == tmp) - { - bFound = true; - break; - } - } - if (!bFound) - { - StringModeList.push_back(tmp); - if ((VideoModes[i].Width <= ClientCfg.Width) && (VideoModes[i].Height <= ClientCfg.Height)) - { - if (CurrentMode == -1) - { - CurrentMode = j; - } - else - { - if ((VideoModes[i].Width >= VideoModes[CurrentMode].Width) && - (VideoModes[i].Height >= VideoModes[CurrentMode].Height)) - CurrentMode = j; - } - } - } - } - } - - // If no modes are available, display a message and exit - if (VideoModes.empty()) - { - Driver->systemMessageBox("No Video Modes available!\n" - "Minimum Video mode to play Ryzom is 800x600.\n", - "No Video Mode!", - NL3D::UDriver::okType, - NL3D::UDriver::exclamationIcon); - exit(EXIT_SUCCESS); - } + + CurrentMode = getRyzomModes(VideoModes, StringModeList); // If the client is in windowed mode, still in windowed mode and do not change anything if (ClientCfg.Windowed)