Ordered languages alphabetically
This commit is contained in:
parent
187ecd53f2
commit
e7b6680895
@ -3,7 +3,7 @@
|
|||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <vector>
|
||||||
|
|
||||||
#define APP_NAME _T("Metin2 Config")
|
#define APP_NAME _T("Metin2 Config")
|
||||||
#define FILENAME_CONFIG "metin2.cfg"
|
#define FILENAME_CONFIG "metin2.cfg"
|
||||||
@ -164,12 +164,24 @@ BOOL CMainDialog::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
|
|||||||
m_comboShadow.SetCurSel(m_stConfig.iShadowLevel);
|
m_comboShadow.SetCurSel(m_stConfig.iShadowLevel);
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
ATL::CString language;
|
|
||||||
|
// Load the languages into an array
|
||||||
|
std::vector<ATL::CString> languages;
|
||||||
for (int i = 0; i < kLanguageMax; ++i) {
|
for (int i = 0; i < kLanguageMax; ++i) {
|
||||||
|
ATL::CString language;
|
||||||
language.LoadString(kLanguageConfig[i].stringId);
|
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_stConfig.language = std::clamp((int) m_stConfig.language, 0, kLanguageMax - 1);
|
||||||
|
|
||||||
m_comboLanguage.SetCurSel(m_stConfig.language);
|
m_comboLanguage.SetCurSel(m_stConfig.language);
|
||||||
|
BIN
src/Config/ui.rc
BIN
src/Config/ui.rc
Binary file not shown.
Loading…
Reference in New Issue
Block a user