From 54302e7e74c93e96892d0a3d5b7b78e7a26b3833 Mon Sep 17 00:00:00 2001 From: ccw808 Date: Thu, 20 Apr 2017 01:44:37 +0100 Subject: [PATCH] Excluded some checks & logging when using the editor or local server. Added check for JSON precision modification. --- Server/mods/deathmatch/logic/CGame.cpp | 35 ++++++++++++++++---- Server/mods/deathmatch/logic/CGame.h | 2 ++ Server/mods/deathmatch/logic/CMainConfig.cpp | 4 +++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index d7bdce2e6a..032df5e908 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -554,6 +554,15 @@ bool CGame::Start ( int iArgumentCount, char* szArguments [] ) return false; } + // Check json has precision mod - #8853 (toJSON passes wrong floats) + json_object* pJsonObject = json_object_new_double(5.12345678901234); + SString strJsonResult = json_object_to_json_string_ext(pJsonObject, JSON_C_TO_STRING_PLAIN); + json_object_put(pJsonObject); + if (strJsonResult != "5.12345678901234") + { + CLogger::ErrorPrintf("JSON built without precision modification\n"); + } + // Grab the path to the main config SString strBuffer; const char* szMainConfig; @@ -564,6 +573,7 @@ bool CGame::Start ( int iArgumentCount, char* szArguments [] ) else { strBuffer = g_pServerInterface->GetModManager ()->GetAbsolutePath ( "mtaserver.conf" ); + m_bUsingMtaServerConf = true; } m_pMainConfig->SetFileName ( strBuffer ); @@ -907,14 +917,25 @@ bool CGame::Start ( int iArgumentCount, char* szArguments [] ) // Flush any pending master server announce messages g_pNetServer->GetHTTPDownloadManager ( EDownloadMode::ASE )->ProcessQueuedFiles (); - if ( m_pMainConfig->GetAuthSerialEnabled() ) + // Warnings only if not editor or local server + if (IsUsingMtaServerConf()) { - CLogger::LogPrintf( "Authorized serial account protection is enabled for the ACL group(s): `%s` See http:""//mtasa.com/authserial\n", - *SString::Join( ",", m_pMainConfig->GetAuthSerialGroupList() ) ); - } - else - { - CLogger::LogPrint( "Authorized serial account protection is DISABLED. See http:""//mtasa.com/authserial\n" ); + // Authorized serial account protection + if ( m_pMainConfig->GetAuthSerialEnabled() ) + { + CLogger::LogPrintf( "Authorized serial account protection is enabled for the ACL group(s): `%s` See http:""//mtasa.com/authserial\n", + *SString::Join( ",", m_pMainConfig->GetAuthSerialGroupList() ) ); + } + else + { + CLogger::LogPrint( "Authorized serial account protection is DISABLED. See http:""//mtasa.com/authserial\n" ); + } + + // Owner email address + if (m_pMainConfig->GetOwnerEmailAddressList().empty()) + { + CLogger::LogPrintf("WARNING: not set\n"); + } } // Done diff --git a/Server/mods/deathmatch/logic/CGame.h b/Server/mods/deathmatch/logic/CGame.h index 4f1e923a4b..f20cdf463a 100644 --- a/Server/mods/deathmatch/logic/CGame.h +++ b/Server/mods/deathmatch/logic/CGame.h @@ -404,6 +404,7 @@ class CGame bool IsBelowMinimumClient ( const SString& strVersion ); bool IsBelowRecommendedClient ( const SString& strVersion ); void ApplyAseSetting ( void ); + bool IsUsingMtaServerConf ( void ) { return m_bUsingMtaServerConf; } private: void AddBuiltInEvents ( void ); @@ -517,6 +518,7 @@ class CGame float m_fAircraftMaxVelocity; float m_fAircraftMaxVelocity_Sq; bool m_bOcclusionsEnabled; + bool m_bUsingMtaServerConf; unsigned char m_ucTrafficLightState; bool m_bTrafficLightsLocked; diff --git a/Server/mods/deathmatch/logic/CMainConfig.cpp b/Server/mods/deathmatch/logic/CMainConfig.cpp index deb34eb740..292ac7a03c 100644 --- a/Server/mods/deathmatch/logic/CMainConfig.cpp +++ b/Server/mods/deathmatch/logic/CMainConfig.cpp @@ -863,6 +863,10 @@ bool CMainConfig::Save ( void ) // bool CMainConfig::AddMissingSettings(void) { + // Only mtaserver.conf is currently supported + if (!g_pGame->IsUsingMtaServerConf()) + return false; + // Load template const char *szTemplateText = #include MTA_SERVER_CONF_TEMPLATE