1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

fix lobby config, add default values for ip/port, change blowfish back to uintptr_t

This commit is contained in:
Tahir Akhlaq 2017-08-11 23:13:00 +01:00
parent 70d17607c7
commit 5136b1a397
4 changed files with 14 additions and 12 deletions

View file

@ -21,7 +21,7 @@
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/json_parser.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
Core::Logger g_log; Core::Logger g_log;
@ -91,7 +91,7 @@ namespace Core {
try try
{ {
arg = std::string( args[i] ); arg = boost::to_lower_copy( std::string( args[i] ) );
val = std::string( args[i + 1] ); val = std::string( args[i + 1] );
// trim '-' from start of arg // trim '-' from start of arg
@ -100,7 +100,7 @@ namespace Core {
if( arg == "ip" ) if( arg == "ip" )
{ {
// todo: ip addr in config // todo: ip addr in config
m_pConfig->setValue< std::string >( "Settings.General.ListenIP", val ); m_pConfig->setValue< std::string >( "Settings.General.ListenIp", val );
} }
else if( arg == "p" || arg == "port" ) else if( arg == "p" || arg == "port" )
{ {
@ -110,11 +110,11 @@ namespace Core {
{ {
m_pConfig->setValue< std::string>( "Settings.General.AuthPort", val ); m_pConfig->setValue< std::string>( "Settings.General.AuthPort", val );
} }
else if( arg == "worldIP" || arg == "worldIp" ) else if( arg == "worldip" || arg == "worldip" )
{ {
m_pConfig->setValue < std::string >( "Settings.General.WorldIp", val ); m_pConfig->setValue < std::string >( "Settings.General.WorldIp", val );
} }
else if( arg == "worldPort" ) else if( arg == "worldport" )
{ {
m_pConfig->setValue< std::string >( "Settings.General.WorldPort", val ); m_pConfig->setValue< std::string >( "Settings.General.WorldPort", val );
} }
@ -126,8 +126,8 @@ namespace Core {
} }
} }
m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort" ); m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp" ); m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );
g_restConnector.restHost = m_pConfig->getValue< std::string >( "Settings.General.RestHost" ); g_restConnector.restHost = m_pConfig->getValue< std::string >( "Settings.General.RestHost" );
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ); g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" );

View file

@ -104,7 +104,7 @@ void BlowFish::initialize (BYTE key[], int32_t keybytes)
int32_t v10 = keybytes; int32_t v10 = keybytes;
int32_t v9 = (int32_t)key; int32_t v9 = (uintptr_t)key;
int32_t v8 = 0; int32_t v8 = 0;
int32_t v11 = 0; int32_t v11 = 0;
do { do {

View file

@ -27,6 +27,7 @@
#include "Forwards.h" #include "Forwards.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/algorithm/string.hpp>
Core::Logger g_log; Core::Logger g_log;
@ -120,7 +121,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
{ {
m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val ); m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val );
} }
else if( arg == "exdPath" || arg == "dataPath" ) else if( arg == "exdpath" || arg == "datapath" )
{ {
m_pConfig->setValue< std::string >( "Settings.General.DataPath", val ); m_pConfig->setValue< std::string >( "Settings.General.DataPath", val );
} }
@ -175,8 +176,8 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
} }
m_serverId = m_serverId ? m_serverId : m_pConfig->getValue< uint16_t >( "Settings.General.ServerId" ); m_serverId = m_serverId ? m_serverId : m_pConfig->getValue< uint16_t >( "Settings.General.ServerId" );
m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort" ); m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54992 );
m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp" );; m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );;
g_log.info( "Server ID: " + std::to_string( m_serverId ) ); g_log.info( "Server ID: " + std::to_string( m_serverId ) );

View file

@ -1,6 +1,7 @@
#include <iostream> #include <iostream>
#include "ServerZone.h" #include "ServerZone.h"
#include <boost/algorithm/string.hpp>
Core::ServerZone g_serverZone( "config/settings_zone.xml" ); Core::ServerZone g_serverZone( "config/settings_zone.xml" );
@ -9,7 +10,7 @@ int main( int32_t argc, char* argv[] )
// i hate to do this, but we need to set this first... // i hate to do this, but we need to set this first...
for(auto i = 1; i < argc; ++i ) for(auto i = 1; i < argc; ++i )
{ {
std::string arg( argv[i] ); auto arg = boost::to_lower_copy( std::string( argv[i] ) );
// trim '-' from start of arg // trim '-' from start of arg
arg = arg.erase( 0, arg.find_first_not_of( '-' ) ); arg = arg.erase( 0, arg.find_first_not_of( '-' ) );