Skip to content

Commit

Permalink
Excluded some checks & logging when using the editor or local server.…
Browse files Browse the repository at this point in the history
… Added check for JSON precision modification.
  • Loading branch information
ccw808 committed Apr 20, 2017
1 parent c50ccb0 commit 54302e7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
35 changes: 28 additions & 7 deletions Server/mods/deathmatch/logic/CGame.cpp
Expand Up @@ -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;
Expand All @@ -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 );

Expand Down Expand Up @@ -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: <owner_email_address> not set\n");
}
}

// Done
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CGame.h
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions Server/mods/deathmatch/logic/CMainConfig.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 54302e7

Please sign in to comment.