From e7b6680895f9b10b7a069a6b72cf1da44cc485ad Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 15 Dec 2024 00:00:57 +0200 Subject: [PATCH] Ordered languages alphabetically --- src/Config/MainDialog.cpp | 18 +++++++++++++++--- src/Config/ui.rc | Bin 38444 -> 38444 bytes 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Config/MainDialog.cpp b/src/Config/MainDialog.cpp index e8bbcb14..8b819e6b 100644 --- a/src/Config/MainDialog.cpp +++ b/src/Config/MainDialog.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #define APP_NAME _T("Metin2 Config") #define FILENAME_CONFIG "metin2.cfg" @@ -164,12 +164,24 @@ BOOL CMainDialog::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) m_comboShadow.SetCurSel(m_stConfig.iShadowLevel); // Language - ATL::CString language; + + // Load the languages into an array + std::vector languages; for (int i = 0; i < kLanguageMax; ++i) { + ATL::CString language; language.LoadString(kLanguageConfig[i].stringId); - m_comboLanguage.InsertString(i, language); + languages.push_back(language); } + // Sort the array + std::sort(languages.begin(), languages.end(), [](const ATL::CString& a, const ATL::CString& b) { + return a.CompareNoCase(b) < 0; + }); + + // Add the languages to the combo + for (auto& language : languages) + m_comboLanguage.AddString(language); + m_stConfig.language = std::clamp((int) m_stConfig.language, 0, kLanguageMax - 1); m_comboLanguage.SetCurSel(m_stConfig.language); diff --git a/src/Config/ui.rc b/src/Config/ui.rc index 85d1ec664d5741678bb17fc86d8542331d9e959c..7ec6c0c815da6caca70588af4aa71b92e6ccd05f 100644 GIT binary patch delta 16 YcmZ3phH1?jrVX=<7}GY-Hkz0W06r}T3;+NC delta 16 YcmZ3phH1?jrVX=<7~M9{Hkz0W06lF6>;M1&