From 52468262f3ef8436fee1d0b83057b694e88f0cf2 Mon Sep 17 00:00:00 2001 From: Maru Date: Fri, 2 Mar 2018 08:25:48 -0300 Subject: [PATCH] More style stuff; --- src/servers/sapphire_zone/Math/CalcBattle.cpp | 2 +- src/servers/sapphire_zone/Math/CalcStats.cpp | 6 ++-- .../Network/Handlers/ActionHandler.cpp | 2 +- .../Network/Handlers/EventHandlers.cpp | 2 +- .../sapphire_zone/Script/ScriptLoader.cpp | 28 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/servers/sapphire_zone/Math/CalcBattle.cpp b/src/servers/sapphire_zone/Math/CalcBattle.cpp index 3241aa6f..6c94db6c 100644 --- a/src/servers/sapphire_zone/Math/CalcBattle.cpp +++ b/src/servers/sapphire_zone/Math/CalcBattle.cpp @@ -35,7 +35,7 @@ uint32_t CalcBattle::calculateHealValue( PlayerPtr pPlayer, uint32_t potency ) auto classInfo = g_framework.getExdDataGen().get< Core::Data::ClassJob >( static_cast< uint8_t >( pPlayer->getClass() ) ); auto paramGrowthInfo = g_framework.getExdDataGen().get< Core::Data::ParamGrow >( pPlayer->getLevel() ); - if ( !classInfo || !paramGrowthInfo ) + if( !classInfo || !paramGrowthInfo ) return 0; //auto jobModVal = classInfoIt->second; diff --git a/src/servers/sapphire_zone/Math/CalcStats.cpp b/src/servers/sapphire_zone/Math/CalcStats.cpp index 5e2f3615..12c4042e 100644 --- a/src/servers/sapphire_zone/Math/CalcStats.cpp +++ b/src/servers/sapphire_zone/Math/CalcStats.cpp @@ -39,7 +39,7 @@ float CalcStats::calculateBaseStat( PlayerPtr pPlayer ) uint8_t level = pPlayer->getLevel(); // SB Base Stat Formula (Aligned) - if ( level > 60 ) + if( level > 60 ) { base = static_cast< float >( ( ( ( level == 61 ) ? 224 : 220 ) + ( level - 61 ) * 8) ); } @@ -65,7 +65,7 @@ uint32_t CalcStats::calculateMaxHp( PlayerPtr pPlayer ) auto classInfo = g_framework.getExdDataGen().get< Core::Data::ClassJob >( static_cast< uint8_t >( pPlayer->getClass() ) ); auto paramGrowthInfo = g_framework.getExdDataGen().get< Core::Data::ParamGrow >( pPlayer->getLevel() ); - if ( !classInfo || !paramGrowthInfo ) + if( !classInfo || !paramGrowthInfo ) return 0; uint8_t level = pPlayer->getLevel(); @@ -98,7 +98,7 @@ uint32_t CalcStats::calculateMaxMp( PlayerPtr pPlayer ) auto classInfo = g_framework.getExdDataGen().get< Core::Data::ClassJob >( static_cast< uint8_t >( pPlayer->getClass() ) ); auto paramGrowthInfo = g_framework.getExdDataGen().get< Core::Data::ParamGrow >( pPlayer->getLevel() ); - if ( !classInfo || !paramGrowthInfo ) + if( !classInfo || !paramGrowthInfo ) return 0; float baseStat = calculateBaseStat( pPlayer ); diff --git a/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp index 2c14dca2..789da330 100644 --- a/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp @@ -209,7 +209,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::GamePacket& in auto fromAetheryte = g_framework.getExdDataGen().get< Core::Data::Aetheryte >( g_framework.getExdDataGen().get< Core::Data::TerritoryType >( player.getZoneId() )->aetheryte ); // calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets - auto cost = static_cast< uint16_t > ( ( sqrt( pow( fromAetheryte->aetherstreamX - targetAetheryte->aetherstreamX, 2 ) + + auto cost = static_cast< uint16_t >( ( sqrt( pow( fromAetheryte->aetherstreamX - targetAetheryte->aetherstreamX, 2 ) + pow( fromAetheryte->aetherstreamY - targetAetheryte->aetherstreamY, 2 ) ) / 2 ) + 100 ); // cap at 999 gil diff --git a/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp index 3a511907..6a95de0b 100644 --- a/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp @@ -56,7 +56,7 @@ void Core::Network::GameConnection::eventHandlerTalk( const Packets::GamePacket& eventType == Event::EventHandler::EventHandlerType::Quest ) { auto questInfo = g_framework.getExdDataGen().get< Core::Data::Quest >( eventId ); - if ( questInfo ) + if( questInfo ) player.sendUrgent( "Quest not implemented: " + questInfo->name + " (" + questInfo->id + ")" ); } diff --git a/src/servers/sapphire_zone/Script/ScriptLoader.cpp b/src/servers/sapphire_zone/Script/ScriptLoader.cpp index edc951f2..a55e11bd 100644 --- a/src/servers/sapphire_zone/Script/ScriptLoader.cpp +++ b/src/servers/sapphire_zone/Script/ScriptLoader.cpp @@ -34,7 +34,7 @@ bool Core::Scripting::ScriptLoader::unloadModule( ModuleHandle handle ) bool success = dlclose( handle ) == 0; #endif - if ( !success ) + if( !success ) { g_framework.getLogger().error( "Failed to unload module @ 0x" + boost::str( boost::format( "%|08X|" ) % handle ) ); @@ -50,7 +50,7 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st { fs::path f( path ); - if ( isModuleLoaded( f.stem().string() ) ) + if( isModuleLoaded( f.stem().string() ) ) { g_framework.getLogger().error( "Unable to load module '" + f.stem().string() + "' as it is already loaded" ); return nullptr; @@ -65,7 +65,7 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st { fs::copy_file( f, dest, fs::copy_option::overwrite_if_exists ); } - catch ( const boost::filesystem::filesystem_error& err ) + catch( const boost::filesystem::filesystem_error& err ) { g_framework.getLogger().error( "Error copying file to cache: " + err.code().message() ); @@ -79,7 +79,7 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st ModuleHandle handle = dlopen( dest.string().c_str(), RTLD_LAZY ); #endif - if ( !handle ) + if( !handle ) { g_framework.getLogger().error( "Failed to load module from: " + path ); @@ -109,7 +109,7 @@ ScriptObject** Core::Scripting::ScriptLoader::getScripts( ModuleHandle handle ) getScripts func = reinterpret_cast< getScripts >( dlsym( handle, "getScripts" ) ); #endif - if ( func ) + if( func ) { auto ptr = func(); @@ -128,13 +128,13 @@ bool Core::Scripting::ScriptLoader::unloadScript( Core::Scripting::ScriptInfo* i bool Core::Scripting::ScriptLoader::unloadScript( ModuleHandle handle ) { - for ( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) + for( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) { - if ( it->second->handle == handle ) + if( it->second->handle == handle ) { auto info = it->second; - if ( unloadModule( handle ) ) + if( unloadModule( handle ) ) { m_scriptMap.erase( it ); @@ -157,9 +157,9 @@ bool Core::Scripting::ScriptLoader::unloadScript( ModuleHandle handle ) bool Core::Scripting::ScriptLoader::isModuleLoaded( std::string name ) { - for ( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) + for( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) { - if ( boost::iequals( it->second->library_name, name ) ) + if( boost::iequals( it->second->library_name, name ) ) return true; } @@ -168,9 +168,9 @@ bool Core::Scripting::ScriptLoader::isModuleLoaded( std::string name ) Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::getScriptInfo( std::string name ) { - for ( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) + for( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) { - if ( it->second->library_name == name ) + if( it->second->library_name == name ) { return it->second; } @@ -181,9 +181,9 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::getScriptInfo( std:: void Core::Scripting::ScriptLoader::findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search ) { - for ( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) + for( auto it = m_scriptMap.begin(); it != m_scriptMap.end(); ++it ) { - if ( it->second->library_name.find( search ) != std::string::npos ) + if( it->second->library_name.find( search ) != std::string::npos ) { scripts.insert( it->second ); }