From 51d3c95de0ff21193fc8db4a68ca1d15254b0f5d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Fri, 10 Jul 2020 20:33:05 +0200 Subject: [PATCH] for server name/city/country and licence, the command line overwrites the ini-file setting --- src/settings.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index c7ccd2a5..5b357fd8 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -799,17 +799,23 @@ if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) ) strLanguage = GetIniSetting ( IniXMLDocument, "server", "language", CLocale::FindSysLangTransFileName ( CLocale::GetAvailableTranslations() ).first ); - // name - pServer->SetServerName ( GetIniSetting ( IniXMLDocument, "server", "name" ) ); - - // city - pServer->SetServerCity ( GetIniSetting ( IniXMLDocument, "server", "city" ) ); - - // country - if ( GetNumericIniSet ( IniXMLDocument, "server", "country", - 0, static_cast ( QLocale::LastCountry ), iValue ) ) + // name/city/country (command line overwrites setting file, note that + // name/city/country are set by one single command line argument so we + // can treat them combined here and it is sufficient to just check the name) + if ( pServer->GetServerName().isEmpty() ) { - pServer->SetServerCountry ( static_cast ( iValue ) ); + // name + pServer->SetServerName ( GetIniSetting ( IniXMLDocument, "server", "name" ) ); + + // city + pServer->SetServerCity ( GetIniSetting ( IniXMLDocument, "server", "city" ) ); + + // country + if ( GetNumericIniSet ( IniXMLDocument, "server", "country", + 0, static_cast ( QLocale::LastCountry ), iValue ) ) + { + pServer->SetServerCountry ( static_cast ( iValue ) ); + } } // start minimized on OS start @@ -818,11 +824,14 @@ if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) ) pServer->SetAutoRunMinimized ( bValue ); } - // licence type - if ( GetNumericIniSet ( IniXMLDocument, "server", "licencetype", - 0, 1 /* LT_CREATIVECOMMONS */, iValue ) ) + // licence type (command line overwrites setting file) + if ( pServer->GetLicenceType() == LT_NO_LICENCE ) { - pServer->SetLicenceType ( static_cast ( iValue ) ); + if ( GetNumericIniSet ( IniXMLDocument, "server", "licencetype", + 0, 1 /* LT_CREATIVECOMMONS */, iValue ) ) + { + pServer->SetLicenceType ( static_cast ( iValue ) ); + } } // welcome message (command line overwrites setting file)