diff --git a/res/fsgame.ltx b/res/fsgame.ltx index 98caf0b4a44..4082c5030bd 100644 --- a/res/fsgame.ltx +++ b/res/fsgame.ltx @@ -1,6 +1,5 @@ ;abbreviation = recurs|notif| root| add| ext| description $app_data_root$ = true| false| $fs_root$| _appdata_\ -$game_versions$ = true| false| $fs_root$| versions\ $arch_dir$ = false| false| $fs_root$ $game_arch_mp$ = false| false| $fs_root$| mp\ $arch_dir_levels$ = false| false| $fs_root$| levels\ diff --git a/res/gamedata/configs/text/eng/openxray.xml b/res/gamedata/configs/text/eng/openxray.xml index 7d11350be53..ddb06f0af6c 100644 --- a/res/gamedata/configs/text/eng/openxray.xml +++ b/res/gamedata/configs/text/eng/openxray.xml @@ -81,9 +81,6 @@ Field of view - - Do you really want to launch another version of the game? - Language diff --git a/res/gamedata/configs/text/pol/openxray.xml b/res/gamedata/configs/text/pol/openxray.xml index c516a182339..71a475336a3 100644 --- a/res/gamedata/configs/text/pol/openxray.xml +++ b/res/gamedata/configs/text/pol/openxray.xml @@ -78,9 +78,6 @@ Pole widzenia - - Czy na pewno chcesz uruchomic kolejna wersje gry? - Jкzyk diff --git a/res/gamedata/configs/text/rus/openxray.xml b/res/gamedata/configs/text/rus/openxray.xml index 98fff6386d2..4a500525a93 100644 --- a/res/gamedata/configs/text/rus/openxray.xml +++ b/res/gamedata/configs/text/rus/openxray.xml @@ -87,9 +87,6 @@ Поле зрения - - Вы действительно хотите запустить другую версию игры? - Язык diff --git a/res/gamedata/configs/ui/message_box.xml b/res/gamedata/configs/ui/message_box.xml index 28f3d5444d1..317a5937edb 100644 --- a/res/gamedata/configs/ui/message_box.xml +++ b/res/gamedata/configs/ui/message_box.xml @@ -583,21 +583,4 @@ ui_inGame2_Mp_bigbuttone - - - ui_inGame2_message_box - - st_switch_version_invitation - - - button_yes - Btn_Yes - ui_inGame2_Mp_bigbuttone - - - button_no - Btn_No - ui_inGame2_Mp_bigbuttone - - diff --git a/res/gamedata/configs/ui/message_box_16.xml b/res/gamedata/configs/ui/message_box_16.xml index 1014593a153..5573c5d75c0 100644 --- a/res/gamedata/configs/ui/message_box_16.xml +++ b/res/gamedata/configs/ui/message_box_16.xml @@ -584,21 +584,4 @@ ui_inGame2_Mp_bigbuttone - - - ui_inGame2_message_box - - st_switch_version_invitation - - - button_yes - Btn_Yes - ui_inGame2_Mp_bigbuttone - - - button_no - Btn_No - ui_inGame2_Mp_bigbuttone - - diff --git a/res/gamedata/configs/ui/ui_mm_versions_dlg.xml b/res/gamedata/configs/ui/ui_mm_versions_dlg.xml deleted file mode 100644 index 22fe91f1b1b..00000000000 --- a/res/gamedata/configs/ui/ui_mm_versions_dlg.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - ui\video_voroni_crop - - - ui\video_water_crop - - - ui_inGame2_background - - - ui_save_load_back - - - -
- ui_inGame2_main_window_small - - - - - - - - - - ui_inGame2_Mp_bigbuttone - ui_mm_cancel - - - - ui_inGame2_Mp_bigbuttone - ui_mm_apply - - - - - - - - ui_inGame2_servers_list_frame - -
- ui_inGame2_servers_list_button - - version - -
-
- -
diff --git a/res/gamedata/configs/ui/ui_mm_versions_dlg_16.xml b/res/gamedata/configs/ui/ui_mm_versions_dlg_16.xml deleted file mode 100644 index a9a40c7c9d4..00000000000 --- a/res/gamedata/configs/ui/ui_mm_versions_dlg_16.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - ui\video_voroni_crop - - - ui\video_water_crop - - - ui_inGame2_background - - - ui_inGame2_left_widepanel - - - ui_inGame2_right_widepanel - - - ui_save_load_back - - - -
- ui_inGame2_main_window_small - - - - - - - - - - ui_inGame2_Mp_bigbuttone - ui_mm_cancel - - - - ui_inGame2_Mp_bigbuttone - ui_mm_apply - - - - - - - - ui_inGame2_servers_list_frame - -
- ui_inGame2_servers_list_button - - version - -
-
- -
diff --git a/res/gamedata/scripts/ui_main_menu.script b/res/gamedata/scripts/ui_main_menu.script index 85b8b66b3fb..db6b0443923 100644 --- a/res/gamedata/scripts/ui_main_menu.script +++ b/res/gamedata/scripts/ui_main_menu.script @@ -30,10 +30,9 @@ function main_menu:InitControls() self.message_box = CUIMessageBoxEx() self:Register (self.message_box, "msg_box") - local _ver = xml:Init3tButton ("static_version",self) + local _ver = xml:InitStatic ("static_version",self) local mm = _G.main_menu.get_main_menu() _ver:TextControl():SetText ("ver. " .. mm:GetGSVer()) - self:Register(_ver, 'btn_version'); self.l_mgr = mm:GetLoginMngr() self.acc_mgr = mm:GetAccountMngr() @@ -86,8 +85,6 @@ function main_menu:InitCallBacks() self:AddCallback("msg_box", ui_events.MESSAGE_BOX_NO_CLICKED, self.OnMsgNo, self) self:AddCallback("msg_box", ui_events.MESSAGE_BOX_QUIT_GAME_CLICKED,self.OnMessageQuitGame, self) self:AddCallback("msg_box", ui_events.MESSAGE_BOX_QUIT_WIN_CLICKED, self.OnMessageQuitWin, self) - - self:AddCallback("btn_version", ui_events.BUTTON_CLICKED, self.OnButton_version_clicked, self) self:Register(self, "self") self:AddCallback("self", ui_events.MAIN_MENU_RELOADED, self.OnMenuReloaded, self) @@ -323,19 +320,6 @@ function main_menu:OnButton_localnet_clicked() console:execute ("check_for_updates 0") end -function main_menu:OnButton_version_clicked() - if self.ver_dlg ==nil then - self.ver_dlg = ui_versions_dialog.versions_dialog() - self.ver_dlg.owner = self - end - - if self.ver_dlg:NeedToBeShown() then - self.ver_dlg:ShowDialog(true) - self:HideDialog() - self:Show(false) - end -end - function main_menu:Dispatch(cmd, param) --virtual function if cmd == 2 then self:OnButton_multiplayer_clicked() diff --git a/res/gamedata/scripts/ui_versions_dialog.script b/res/gamedata/scripts/ui_versions_dialog.script deleted file mode 100644 index 31f29ed24ed..00000000000 --- a/res/gamedata/scripts/ui_versions_dialog.script +++ /dev/null @@ -1,70 +0,0 @@ -class "versions_dialog" (CUIScriptWnd) - -function versions_dialog:__init() super() - self:InitControls() - self:InitCallBacks() -end - -function versions_dialog:__finalize() -end - -function versions_dialog:InitControls() - self:SetWndRect (Frect():set(0,0,1024,768)) - - local xml = CScriptXmlInit() - xml:ParseFile ("ui_mm_versions_dlg.xml") - xml:InitStatic ("background",self) - - self.form = xml:InitStatic("form",self) - self.caption = xml:InitStatic ("form:caption",self.form) - self.description = xml:InitTextWnd ("form:description",self.form) - - self.btn_cancel = xml:Init3tButton ("form:btn_cancel", self.form) - self:Register (self.btn_cancel, "button_back") - - self.btn_start = xml:Init3tButton ("form:btn_start", self.form) - self:Register (self.btn_start, "button_start") - - self.ver_list = xml:InitVerList ("form:ver_list", self.form) - self:Register (self.ver_list, "ver_list") - -end - -function versions_dialog:InitCallBacks() - self:AddCallback("button_back", ui_events.BUTTON_CLICKED, self.OnButton_back_clicked, self) - self:AddCallback("button_start", ui_events.BUTTON_CLICKED, self.OnButton_start_clicked, self) - self:AddCallback("ver_list", ui_events.LIST_ITEM_CLICKED, self.OnListClicked, self) - self:AddCallback("ver_list", ui_events.WINDOW_LBUTTON_DB_CLICK, self.OnListDblClicked, self) -end - -function versions_dialog:OnListClicked() - local descr = self.ver_list:GetCurrentVersionDescr(); - self.description:SetText(descr) -end - -function versions_dialog:OnListDblClicked() - self:OnButton_start_clicked(); -end - -function versions_dialog:OnButton_start_clicked() - self.ver_list:SwitchToSelectedVersion() -end - -function versions_dialog:OnButton_back_clicked() - self.owner:ShowDialog(true) - self:HideDialog() - self.owner:Show(true) -end - -function versions_dialog:NeedToBeShown() - return self.ver_list:GetItemsCount() > 0 -end - -function versions_dialog:OnKeyboard(dik, keyboard_action) - CUIScriptWnd.OnKeyboard(self,dik,keyboard_action) - local bind = dik_to_bind(dik) - if bind == key_bindings.kQUIT then - self:OnButton_back_clicked() - end - return true -end diff --git a/src/xrGame/CMakeLists.txt b/src/xrGame/CMakeLists.txt index a0850bdbc35..4f7d4dcdee0 100644 --- a/src/xrGame/CMakeLists.txt +++ b/src/xrGame/CMakeLists.txt @@ -1591,8 +1591,6 @@ target_sources(xrGame PRIVATE UITimeDilator.h UIZoneMap.cpp UIZoneMap.h - VersionSwitcher.cpp - VersionSwitcher.h vision_client.cpp vision_client.h vision_client_inline.h @@ -2471,8 +2469,6 @@ target_sources(xrGame PRIVATE ui/UITradeBar.h ui/UITradeWnd.cpp ui/UITradeWnd.h - ui/UIVersionList.cpp - ui/UIVersionList.h ui/UIVote.cpp ui/UIVote.h ui/UIVoteStatusWnd.cpp diff --git a/src/xrGame/ScriptXMLInit.cpp b/src/xrGame/ScriptXMLInit.cpp index b4ef8c71623..46911dba27a 100644 --- a/src/xrGame/ScriptXMLInit.cpp +++ b/src/xrGame/ScriptXMLInit.cpp @@ -11,7 +11,6 @@ #include "ui/UILabel.h" #include "ui/ServerList.h" #include "ui/UIMapList.h" -#include "ui/UIVersionList.h" #include "ui/UIKeyBinding.h" #include "xrUICore/EditBox/UIEditBox.h" #include "xrUICore/Static/UIAnimatedStatic.h" @@ -202,14 +201,6 @@ CUIMapList* CScriptXmlInit::InitMapList(LPCSTR path, CUIWindow* parent) return pWnd; } -CUIVersionList* CScriptXmlInit::InitVerList(LPCSTR path, CUIWindow* parent) -{ - CUIVersionList* pWnd = xr_new(); - pWnd->InitFromXml(m_xml, path); - _attach_child(pWnd, parent); - return pWnd; -} - CUIMMShniaga* CScriptXmlInit::InitMMShniaga(LPCSTR path, CUIWindow* parent) { CUIMMShniaga* pWnd = xr_new(); @@ -297,7 +288,6 @@ SCRIPT_EXPORT(CScriptXmlInit, (), .def("InitTab", &CScriptXmlInit::InitTab) .def("InitServerList", &CScriptXmlInit::InitServerList) .def("InitMapList", &CScriptXmlInit::InitMapList) - .def("InitVerList", &CScriptXmlInit::InitVerList) .def("InitMapInfo", &CScriptXmlInit::InitMapInfo) .def("InitTrackBar", &CScriptXmlInit::InitTrackBar) .def("InitCDkey", &CScriptXmlInit::InitCDkey) diff --git a/src/xrGame/ScriptXMLInit.h b/src/xrGame/ScriptXMLInit.h index 1d338c8e19f..737816abe4d 100644 --- a/src/xrGame/ScriptXMLInit.h +++ b/src/xrGame/ScriptXMLInit.h @@ -21,7 +21,6 @@ class CUIAnimatedStatic; class CUISleepStatic; class CServerList; class CUIMapList; -class CUIVersionList; class CUITrackBar; class CUIMapInfo; class CUIMMShniaga; @@ -53,7 +52,6 @@ class CScriptXmlInit CUITabControl* InitTab(LPCSTR path, CUIWindow* parent); CServerList* InitServerList(LPCSTR path, CUIWindow* parent); CUIMapList* InitMapList(LPCSTR path, CUIWindow* parent); - CUIVersionList* InitVerList(LPCSTR path, CUIWindow* parent); CUIMapInfo* InitMapInfo(LPCSTR path, CUIWindow* parent); CUITrackBar* InitTrackBar(LPCSTR path, CUIWindow* parent); CUIEditBox* InitCDkey(LPCSTR path, CUIWindow* parent); diff --git a/src/xrGame/VersionSwitcher.cpp b/src/xrGame/VersionSwitcher.cpp deleted file mode 100644 index 95af330ede3..00000000000 --- a/src/xrGame/VersionSwitcher.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "StdAfx.h" -#include "VersionSwitcher.h" -#include "xrEngine/XR_IOConsole.h" - -static CVersionSwitcher s_switcher; - -extern ENGINE_API string512 g_sLaunchOnExit_app; -extern ENGINE_API string512 g_sLaunchOnExit_params; -extern ENGINE_API string_path g_sLaunchWorkingFolder; - -size_t CVersionSwitcher::GetVerCount() -{ - if (!s_switcher.inited) - s_switcher.Init(); - return s_switcher.GetVerCountInternal(); -} - -size_t CVersionSwitcher::GetVerCountInternal() const { return versions.size(); } - -const SVersionDescription& CVersionSwitcher::GetVerDesc(size_t idx) -{ - if (!s_switcher.inited) - s_switcher.Init(); - return s_switcher.GetVerDescInternal(idx); -} - -const SVersionDescription& CVersionSwitcher::GetVerDescInternal(size_t idx) const -{ - R_ASSERT(idx < versions.size()); - return versions[idx]; -} - -void CVersionSwitcher::SwitchToGameVer(size_t idx, CVersionSwitcher::EVersionSwitchMode mode) -{ - R_ASSERT(s_switcher.inited); - const SVersionDescription& desc = s_switcher.GetVerDescInternal(idx); - pcstr args = (mode == SWITCH_TO_SERVER) ? desc.arguments_mp.c_str() : desc.arguments_mm.c_str(); - s_switcher.SwitchToGameVerInternal(desc.exe_path.c_str(), desc.working_dir.c_str(), args); -} - -void CVersionSwitcher::SwitchToGameVer(pcstr name, EVersionSwitchMode mode) -{ - size_t idx = FindVersionIdByName(name); - R_ASSERT(idx != CVersionSwitcher::VERSION_NOT_FOUND); - SwitchToGameVer(idx, mode); -} - -void CVersionSwitcher::SwitchToGameVerInternal(xr_string appexe, xr_string working_dir, xr_string args) const -{ - // Command line specifiers: - // %SERVER% - address and port of the selected server (for multiplayer mode) - // %PLAYERNAME% - nickname of the player in multiplayer - // %SERVERPASSWORD% - password for connection to the server - // %USERPASSWORD% - password for connection to the server with user's list - - args = xr_substrreplace(args, "%SERVER%", server); - args = xr_substrreplace(args, "%PLAYERNAME%", name); - args = xr_substrreplace(args, "%SERVERPASSWORD%", server_password); - args = xr_substrreplace(args, "%USERPASSWORD%", user_password); - - xr_strcpy(g_sLaunchWorkingFolder, working_dir.c_str()); - xr_strcpy(g_sLaunchOnExit_app, appexe.c_str()); - xr_strcpy(g_sLaunchOnExit_params, appexe.c_str()); - xr_strcpy(g_sLaunchOnExit_params, " "); - xr_strcat(g_sLaunchOnExit_params, args.c_str()); - - Console->Execute("quit"); -} - -size_t CVersionSwitcher::FindVersionIdByName(pcstr version) -{ - if (!s_switcher.inited) - s_switcher.Init(); - - return s_switcher.FindVersionIdByNameInternal(version); -} - -size_t CVersionSwitcher::FindVersionIdByNameInternal(pcstr version) -{ - size_t result = VERSION_NOT_FOUND; - for (size_t i = 0; i < versions.size(); ++i) - { - if (xr_strcmp(versions[i].name.c_str(), version) == 0) - { - result = i; - break; - } - } - return result; -} - -void CVersionSwitcher::SetupMPParams(pcstr name, pcstr srvpsw, pcstr userpsw, pcstr server) -{ - R_ASSERT(s_switcher.inited); - s_switcher.SetupMPParamsInternal(name, srvpsw, userpsw, server); -} - -void CVersionSwitcher::SetupMPParamsInternal(pcstr nick, pcstr srvpsw, pcstr userpsw, pcstr srv) -{ - server = srv; - name = nick; - server_password = srvpsw; - user_password = userpsw; -} - -void CVersionSwitcher::ParseVersionConfig(const string_path& cfg) -{ - const char* SECTION = "ver_desc"; - CInifile ini(cfg); - SVersionDescription desc; - - desc.name = READ_IF_EXISTS(&ini, r_string, SECTION, "name", ""); - desc.description = READ_IF_EXISTS(&ini, r_string_wb, SECTION, "description", ""); - desc.exe_path = READ_IF_EXISTS(&ini, r_string_wb, SECTION, "exe_path", ""); - desc.arguments_mm = READ_IF_EXISTS(&ini, r_string_wb, SECTION, "arguments_mm", ""); - desc.arguments_mp = READ_IF_EXISTS(&ini, r_string_wb, SECTION, "arguments_mp", ""); - - if (desc.name.size() > 0) - { - xr_string dir = cfg; - size_t pos = dir.rfind(_DELIMITER); - dir = dir.substr(0, pos); - - if (desc.exe_path.size() < 1) - { - // Use current engine - xr_string exe_path = Core.ApplicationPath; - - // TODO: Create a cross-platform way to restart the current engine, also should be useful for dedicated - // server (maybe use xrCore class) - exe_path += "xrEngine.exe"; - - desc.exe_path = exe_path.c_str(); - desc.working_dir = dir.c_str(); - } - else - { - xr_string exe_path = dir + _DELIMITER + desc.exe_path.c_str(); - desc.exe_path = exe_path.c_str(); - desc.working_dir = dir.c_str(); - } - - versions.push_back(desc); - } -} - -void CVersionSwitcher::ReloadInternal() -{ - const char* VERSIONS_ROOT = "$game_versions$"; - - if (FS.path_exist(VERSIONS_ROOT)) - { - FS_FileSet vers; - FS.file_list(vers, VERSIONS_ROOT, FS_ListFiles, "*verdesc.ltx"); - - for (const FS_File& cfg : vers) - { - string_path file_name; - FS.update_path(file_name, VERSIONS_ROOT, cfg.name.c_str()); - ParseVersionConfig(file_name); - } - } -} - -void CVersionSwitcher::Init() -{ - ReloadInternal(); - inited = true; -} diff --git a/src/xrGame/VersionSwitcher.h b/src/xrGame/VersionSwitcher.h deleted file mode 100644 index ba6ff11bb47..00000000000 --- a/src/xrGame/VersionSwitcher.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -#include "xrCore/xrstring.h" -#include "xrCommon/xr_vector.h" - -struct SVersionDescription -{ - shared_str name; - shared_str description; - shared_str exe_path; - shared_str working_dir; - shared_str arguments_mm; - shared_str arguments_mp; -}; - -class CVersionSwitcher -{ -public: - static size_t GetVerCount(); - static const SVersionDescription& GetVerDesc(size_t idx); - - enum EVersionSwitchMode - { - SWITCH_TO_MAINMENU, - SWITCH_TO_SERVER, - SWITCH_COUNT, - }; - static void SwitchToGameVer(size_t idx, EVersionSwitchMode mode); - static void SwitchToGameVer(pcstr name, EVersionSwitchMode mode); - static void SetupMPParams(pcstr name, pcstr srvpsw, pcstr userpsw, pcstr server); - - static size_t FindVersionIdByName(pcstr version); - static const size_t VERSION_NOT_FOUND = size_t(-1); - -private: - size_t GetVerCountInternal() const; - const SVersionDescription& GetVerDescInternal(size_t idx) const; - void SwitchToGameVerInternal(xr_string appexe, xr_string working_dir, xr_string args) const; - void SetupMPParamsInternal(pcstr nick, pcstr srvpsw, pcstr userpsw, pcstr srv); - size_t FindVersionIdByNameInternal(pcstr version); - - void ReloadInternal(); - void Init(); - void ParseVersionConfig(const string_path& cfg); - - bool inited; - xr_vector versions; - - xr_string server; - xr_string name; - xr_string server_password; - xr_string user_password; -}; diff --git a/src/xrGame/ui/ServerList.cpp b/src/xrGame/ui/ServerList.cpp index 908bf5c457a..68585dfb4ce 100644 --- a/src/xrGame/ui/ServerList.cpp +++ b/src/xrGame/ui/ServerList.cpp @@ -11,7 +11,6 @@ #include "xrGameSpy/GameSpy_Keys.h" #include "xrGameSpy/GameSpy_Full.h" #include "Spectator.h" -#include "VersionSwitcher.h" LPCSTR GameTypeToStringEx(u32 gt, bool bShort); @@ -52,18 +51,6 @@ CServerList::CServerList() m_message_box->InitMessageBox("message_box_password"); m_message_box->SetMessageTarget(this); - if (CVersionSwitcher::GetVerCount() > 0) - { - m_version_switch_msgbox = xr_new(); - m_version_switch_msgbox->SetMessageTarget(this); - if (!m_version_switch_msgbox->InitMessageBox("message_box_version_switch")) - xr_delete(m_version_switch_msgbox); - } - else - { - m_version_switch_msgbox = nullptr; - } - m_b_local = false; m_last_retreived_index = u32(-1); @@ -73,7 +60,6 @@ CServerList::CServerList() CServerList::~CServerList() { - xr_delete(m_version_switch_msgbox); xr_delete(m_message_box); auto bro = browser_LL(); @@ -187,27 +173,13 @@ void CServerList::SendMessage(CUIWindow* pWnd, s16 msg, void* pData) if (!item) return; - if (m_version_switch_msgbox != nullptr && pWnd == m_version_switch_msgbox) + if (pWnd == m_message_box) { - pcstr srvpsw = (item->GetInfo()->info.icons.pass) ? m_message_box->GetPassword() : ""; - pcstr upsw = (item->GetInfo()->info.icons.user_pass) ? m_message_box->m_pMessageBox->GetUserPassword() : ""; - CVersionSwitcher::SetupMPParams(m_playerName.c_str(), srvpsw, upsw, m_itemInfo.info.address.c_str()); - CVersionSwitcher::SwitchToGameVer(m_itemInfo.info.version.c_str(), CVersionSwitcher::SWITCH_TO_SERVER); - } - else if (pWnd == m_message_box) - { - if (m_version_switch_msgbox != nullptr && - xr_strcmp(item->GetInfo()->info.version, MainMenu()->GetGSVer()) != 0) - { - m_version_switch_msgbox->ShowDialog(true); - } - else - { - xr_string command; - item->CreateConsoleCommand(command, m_playerName.c_str(), - m_message_box->m_pMessageBox->GetUserPassword(), m_message_box->GetPassword()); - Console->Execute(command.c_str()); - } + xr_string command; + item->CreateConsoleCommand(command, m_playerName.c_str(), + m_message_box->m_pMessageBox->GetUserPassword(), + m_message_box->GetPassword()); + Console->Execute(command.c_str()); } } else if (WINDOW_LBUTTON_DB_CLICK == msg && &m_list[LST_SERVER] == pWnd) @@ -631,12 +603,7 @@ void CServerList::ConnectToSelected() return; } - pcstr ver = item->GetInfo()->info.version.c_str(); - bool dif_ver = xr_strcmp(ver, MainMenu()->GetGSVer()) != 0; - - if (dif_ver && - (m_version_switch_msgbox == nullptr || - CVersionSwitcher::FindVersionIdByName(ver) == CVersionSwitcher::VERSION_NOT_FOUND)) + if (xr_strcmp(item->GetInfo()->info.version, MainMenu()->GetGSVer())) { MainMenu()->SetErrorDialog(CMainMenu::ErrDifferentVersion); return; @@ -650,16 +617,9 @@ void CServerList::ConnectToSelected() } else { - if (dif_ver) - { - m_version_switch_msgbox->ShowDialog(true); - } - else - { - xr_string command; - item->CreateConsoleCommand(command, m_playerName.c_str(), "", ""); - Console->Execute(command.c_str()); - } + xr_string command; + item->CreateConsoleCommand(command, m_playerName.c_str(), "", ""); + Console->Execute(command.c_str()); } #endif } diff --git a/src/xrGame/ui/ServerList.h b/src/xrGame/ui/ServerList.h index 543598805c6..49d714a70be 100644 --- a/src/xrGame/ui/ServerList.h +++ b/src/xrGame/ui/ServerList.h @@ -135,7 +135,6 @@ class CServerList final : public CUIWindow bool m_b_local; CUIMessageBoxEx* m_message_box; - CUIMessageBoxEx* m_version_switch_msgbox; ESortingMode m_sort_mode; bool m_sort_ascending; diff --git a/src/xrGame/ui/UIVersionList.cpp b/src/xrGame/ui/UIVersionList.cpp deleted file mode 100644 index 54e2f1d526f..00000000000 --- a/src/xrGame/ui/UIVersionList.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "StdAfx.h" -#include "UIVersionList.h" -#include "VersionSwitcher.h" -#include "xrUICore/ListBox/UIListBoxItem.h" - -CUIVersionList::CUIVersionList() - : CUIWindow("CUIVersionList") -{ - itemsCount = 0; - - versionsList = xr_new(); - frame = xr_new("Frame"); - header = xr_new("Header"); - - versionsList->SetAutoDelete(true); - frame->SetAutoDelete(true); - header->SetAutoDelete(true); - - AttachChild(versionsList); - AttachChild(frame); - AttachChild(header); -} - -void CUIVersionList::InitFromXml(CUIXml& xml_doc, const char* path) -{ - CUIXmlInit::InitWindow(xml_doc, path, 0, this); - string256 buf; - CUIXmlInit::InitListBox(xml_doc, strconcat(sizeof(buf), buf, path, ":list_versions"), 0, versionsList); - CUIXmlInit::InitFrameLine(xml_doc, strconcat(sizeof(buf), buf, path, ":header"), 0, header); - CUIXmlInit::InitFrameWindow(xml_doc, strconcat(sizeof(buf), buf, path, ":frame"), 0, frame); - - UpdateVersionList(); -} - -void CUIVersionList::UpdateVersionList() -{ - versionsList->Clear(); - - itemsCount = CVersionSwitcher::GetVerCount(); - - for (size_t i = 0; i < itemsCount; ++i) - { - const SVersionDescription desc = CVersionSwitcher::GetVerDesc(i); - - CUIListBoxItem* itm = versionsList->AddTextItem(desc.name.c_str()); - itm->SetData(reinterpret_cast(i)); - itm->Enable(true); - } -} - -const SVersionDescription* CUIVersionList::GetCurrentItem() const -{ - CUIListBoxItem* itm = versionsList->GetSelectedItem(); - if (!itm) - return nullptr; - return &CVersionSwitcher::GetVerDesc(reinterpret_cast(itm->GetData())); -} - -pcstr CUIVersionList::GetCurrentVersionName() const -{ - const SVersionDescription* desc = GetCurrentItem(); - return desc ? desc->name.c_str() : ""; -} - -pcstr CUIVersionList::GetCurrentVersionDescr() const -{ - const SVersionDescription* desc = GetCurrentItem(); - return desc ? desc->description.c_str() : ""; -} - -size_t CUIVersionList::GetItemsCount() const { return itemsCount; } - -void CUIVersionList::SendMessage(CUIWindow* pWnd, s16 msg, void* pData) -{ - if (pWnd == versionsList) - { - switch (msg) - { - case LIST_ITEM_CLICKED: - { - GetMessageTarget()->SendMessage(this, LIST_ITEM_CLICKED, pData); - break; - } - case WINDOW_LBUTTON_DB_CLICK: - { - GetMessageTarget()->SendMessage(this, WINDOW_LBUTTON_DB_CLICK, pData); - break; - } - } - } -} - -void CUIVersionList::SwitchToSelectedVersion() const -{ - CUIListBoxItem* itm = versionsList->GetSelectedItem(); - if (itm) - { - size_t idx = reinterpret_cast(itm->GetData()); - CVersionSwitcher::SwitchToGameVer(idx, CVersionSwitcher::SWITCH_TO_MAINMENU); - } -} diff --git a/src/xrGame/ui/UIVersionList.h b/src/xrGame/ui/UIVersionList.h deleted file mode 100644 index a7a79c4c9eb..00000000000 --- a/src/xrGame/ui/UIVersionList.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include "xrUICore/Windows/UIWindow.h" -#include "xrUICore/ListBox/UIListBox.h" - -struct SVersionDescription; - -class CUIVersionList final : public CUIWindow -{ - CUIListBox* versionsList; - CUIFrameLineWnd* header; - CUIFrameWindow* frame; - - size_t itemsCount; - -public: - CUIVersionList(); - void InitFromXml(CUIXml& xml_doc, const char* path); - pcstr GetCurrentVersionName() const; - pcstr GetCurrentVersionDescr() const; - void SwitchToSelectedVersion() const; - const SVersionDescription* GetCurrentItem() const; - size_t GetItemsCount() const; - - virtual void SendMessage(CUIWindow* pWnd, s16 msg, void* pData); - - pcstr GetDebugType() override { return "CUIVersionList"; } - -private: - void UpdateVersionList(); -}; diff --git a/src/xrGame/ui/UIWindow_script.cpp b/src/xrGame/ui/UIWindow_script.cpp index 8705c5df9a3..132679010ab 100644 --- a/src/xrGame/ui/UIWindow_script.cpp +++ b/src/xrGame/ui/UIWindow_script.cpp @@ -10,7 +10,6 @@ #include "UIMapInfo.h" #include "xrUICore/ComboBox/UIComboBox.h" #include "UIMapList.h" -#include "UIVersionList.h" #include "ScriptXMLInit.h" #include "xrScriptEngine/ScriptExporter.hpp" @@ -173,21 +172,6 @@ SCRIPT_EXPORT(CUIMapList, (CUIWindow), ]; }); -SCRIPT_EXPORT(CUIVersionList, (CUIWindow), -{ - using namespace luabind; - - module(luaState) - [ - class_("CUIVersionList") - .def(constructor<>()) - .def("GetCurrentVersionName", &CUIVersionList::GetCurrentVersionName) - .def("GetCurrentVersionDescr", &CUIVersionList::GetCurrentVersionDescr) - .def("GetItemsCount", &CUIVersionList::GetItemsCount) - .def("SwitchToSelectedVersion", &CUIVersionList::SwitchToSelectedVersion) - ]; -}); - SCRIPT_EXPORT(EnumGameIDs, (), { using namespace luabind; diff --git a/src/xrGame/xrGame.vcxproj b/src/xrGame/xrGame.vcxproj index 762c7b46e36..1fc2352e6c6 100644 --- a/src/xrGame/xrGame.vcxproj +++ b/src/xrGame/xrGame.vcxproj @@ -1390,7 +1390,6 @@ - @@ -1399,7 +1398,6 @@ - @@ -3365,7 +3363,6 @@ - @@ -3385,7 +3382,6 @@ pch_script.h $(IntDir)$(ProjectName)_script.pch - pch_script.h diff --git a/src/xrGame/xrGame.vcxproj.filters b/src/xrGame/xrGame.vcxproj.filters index ba820c81759..6ec15dde90f 100644 --- a/src/xrGame/xrGame.vcxproj.filters +++ b/src/xrGame/xrGame.vcxproj.filters @@ -2233,9 +2233,6 @@ {f7b72e14-4fc5-4054-98a9-cff48b3fc45b} - - {04c90fd3-e247-4f21-b715-8dc556986837} - {e4a3fb7b-b6ee-40f3-a25a-be388178d29e} @@ -6452,10 +6449,6 @@ Core\Server\Games\server\base - - - UI\Multiplayer\MM_MP\VersionList - UI\Common\Inventory @@ -9820,10 +9813,6 @@ Core\Server\Games\client\base - - - UI\Multiplayer\MM_MP\VersionList - UI\Common\Inventory