1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

use QVector<QPair<>>

This commit is contained in:
Laserlicht 2024-12-09 20:16:21 +01:00
parent b148994aa9
commit 1bf55958fb

View File

@ -295,7 +295,7 @@ bool FirstLaunchView::heroesDataDetect()
QString FirstLaunchView::getHeroesInstallDir()
{
#ifdef VCMI_WINDOWS
QHash<QString, QString> regKeys = {
QVector<QPair<QString, QString>> regKeys = {
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\GOG.com\\Games\\1207658787", "path" }, // Gog on x86 system
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\GOG.com\\Games\\1207658787", "path" }, // Gog on x64 system
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\New World Computing\\Heroes of Might and Magic® III\\1.0", "AppPath" }, // H3 Complete on x86 system
@ -304,13 +304,11 @@ QString FirstLaunchView::getHeroesInstallDir()
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\New World Computing\\Heroes of Might and Magic III\\1.0", "AppPath" }, // some localized H3 on x64 system
};
QHash<QString, QString>::const_iterator i = regKeys.constBegin();
while (i != regKeys.constEnd())
for(auto & regKey : regKeys)
{
QString path = QSettings(i.key(), QSettings::NativeFormat).value(i.value()).toString();
QString path = QSettings(regKey.first, QSettings::NativeFormat).value(regKey.second).toString();
if(!path.isEmpty())
return path;
++i;
}
#endif
return QString{};