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

Style, cleanup

This commit is contained in:
goaaats 2018-01-08 23:38:27 +01:00
parent f6ed8125b0
commit 9f145c28c2
2 changed files with 26 additions and 18 deletions

View file

@ -111,9 +111,9 @@ void Core::Session::updateLastSqlTime()
m_lastSqlTime = static_cast< uint32_t >( Util::getTimeSeconds() );
}
void Core::Session::startReplay( const std::string& folderpath )
void Core::Session::startReplay( const std::string& path )
{
if( !boost::filesystem::exists( folderpath ) )
if( !boost::filesystem::exists( path ) )
{
getPlayer()->sendDebug( "Couldn't find folder." );
return;
@ -123,7 +123,8 @@ void Core::Session::startReplay( const std::string& folderpath )
std::vector< std::tuple< uint64_t, std::string > > loadedSets;
for( auto it = boost::filesystem::directory_iterator( boost::filesystem::path( folderpath ) ); it != boost::filesystem::directory_iterator(); ++it )
for( auto it = boost::filesystem::directory_iterator( boost::filesystem::path( path ) );
it != boost::filesystem::directory_iterator(); ++it )
{
// Get the filename of the current element
auto fileName = it->path().filename().string();
@ -135,7 +136,8 @@ void Core::Session::startReplay( const std::string& folderpath )
}
}
sort( loadedSets.begin(), loadedSets.end(), []( const std::tuple< uint64_t, std::string >& left, const std::tuple< uint64_t, std::string >& right)
sort( loadedSets.begin(), loadedSets.end(),
[]( const std::tuple< uint64_t, std::string >& left, const std::tuple< uint64_t, std::string >& right)
{
return std::get< 0 >( left ) < std::get< 0 >( right );
} );
@ -144,7 +146,9 @@ void Core::Session::startReplay( const std::string& folderpath )
for( auto set : loadedSets )
{
m_replayCache.push_back( std::tuple<uint64_t, std::string>( Util::getTimeSeconds() + ( std::get< 0 >( set ) - startTime ), std::get< 1 >( set ) ) );
m_replayCache.push_back( std::tuple< uint64_t, std::string >(
Util::getTimeSeconds() + ( std::get< 0 >( set ) - startTime ), std::get< 1 >( set ) ) );
g_log.info( "Registering " + std::get< 1 >( set ) + " for " + std::to_string( std::get< 0 >( set ) - startTime ) );
}
@ -158,9 +162,7 @@ void Core::Session::stopReplay()
m_replayCache.clear();
}
void Core::Session::update()
{
if( m_isReplaying )
void Core::Session::processReplay()
{
int at = 0;
for( const auto& set : m_replayCache )
@ -174,6 +176,11 @@ void Core::Session::update()
}
}
void Core::Session::update()
{
if( m_isReplaying )
processReplay();
if( m_pZoneConnection )
{
m_pZoneConnection->processInQueue();

View file

@ -28,6 +28,7 @@ namespace Core {
void startReplay( const std::string& folderpath );
void stopReplay();
void processReplay();
void close();