1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 22:37:45 +00:00

change reload -> queue reload & some minor refactoring

This commit is contained in:
GokuWeedLord 2017-12-14 23:05:53 +11:00
parent 6e345a265b
commit c60b680a27
6 changed files with 21 additions and 20 deletions

View file

@ -8,16 +8,16 @@
<DataPath>H:\\SteamLibrary\\steamapps\\common\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
<Scripts>
<!-- where compiled scripts are placed -->
<Path>./compiledscripts/</Path>
<CachePath>./cache/</CachePath>
<!-- where compiled scripts are placed -->
<Path>./compiledscripts/</Path>
<CachePath>./cache/</CachePath>
<HotSwap>
<Enabled>1</Enabled>
<HotSwap>
<Enabled>1</Enabled>
<ScriptsDir>../scripts/native/</ScriptsDir>
<BuildDir>../cmake-build-debug/</BuildDir>
<BuildCmd>cmake --build %1% --target %2%</BuildCmd>
</HotSwap>
<BuildDir>../cmake-build-debug/</BuildDir>
<BuildCmd>cmake --build %1% --target %2%</BuildCmd>
</HotSwap>
</Scripts>
<!-- Path of Chai script files -->
@ -29,13 +29,13 @@
<Username>root</Username>
<Pass></Pass>
<Database>sapphire</Database>
<SyncThreads>2</SyncThreads>
<AsyncThreads>2</AsyncThreads>
<SyncThreads>2</SyncThreads>
<AsyncThreads>2</AsyncThreads>
</Mysql>
</General>
<Parameters>
<!-- Messages players see upon logging in - These *must* be smaller than 307 characters -->
<!-- Messages players see upon logging in - These *must* be smaller than 307 characters -->
<MotDArray>
<MotD>&lt;&lt;&lt;Welcome to Sapphire&gt;&gt;&gt;</MotD>
<MotD>This is a very good server</MotD>

View file

@ -589,14 +589,14 @@ void Core::DebugCommandHandler::script( char* data, Entity::Player &player, boos
}
}
else if( subCommand == "reload" || subCommand == "rl" )
else if( subCommand == "queuereload" || subCommand == "qrl" )
{
if( subCommand == params )
player.sendDebug( "Command failed: requires name of script to reload" );
else
{
g_scriptMgr.getNativeScriptHandler().reloadScript( params );
player.sendDebug( "Attempting to reload script: " + params );
g_scriptMgr.getNativeScriptHandler( ).queueScriptReload( params );
player.sendDebug( "Queued script reload for script: " + params );
}
}
else if( subCommand == "build" || subCommand == "b" )

View file

@ -137,7 +137,7 @@ namespace Core {
return m_loader.unloadScript( info );
}
void NativeScriptManager::reloadScript( const std::string &name )
void NativeScriptManager::queueScriptReload( const std::string &name )
{
auto info = m_loader.getScriptInfo( name );
if( !info )

View file

@ -42,7 +42,7 @@ namespace Scripting {
bool loadScript( const std::string& path );
bool unloadScript( const std::string& name );
void reloadScript( const std::string &name );
void queueScriptReload( const std::string& name );
void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search );
void processLoadQueue();

View file

@ -91,7 +91,7 @@ void Core::Scripting::ScriptManager::watchDirectories()
{
g_log.debug( "Reloading changed script: " + path.stem().string() );
m_nativeScriptManager->reloadScript( path.stem().string() );
m_nativeScriptManager->queueScriptReload( path.stem( ).string( ));
}
else
{
@ -103,14 +103,15 @@ void Core::Scripting::ScriptManager::watchDirectories()
});
}
void Core::Scripting::ScriptManager::loadDir( std::string dirname, std::set<std::string>& files, std::string ext )
void Core::Scripting::ScriptManager::loadDir( const std::string& dirname, std::set<std::string> &files, const std::string& ext )
{
g_log.info( "ScriptEngine: loading scripts from " + dirname );
boost::filesystem::path targetDir( dirname );
boost::filesystem::directory_iterator iter( targetDir ), eod;
boost::filesystem::directory_iterator iter( targetDir );
boost::filesystem::directory_iterator eod;
BOOST_FOREACH( boost::filesystem::path const& i, make_pair( iter, eod ) )
{

View file

@ -60,7 +60,7 @@ namespace Core
bool onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId );
void loadDir( std::string dirname, std::set<std::string>& files, std::string ext );
void loadDir( const std::string& dirname, std::set<std::string> &files, const std::string& ext );
NativeScriptManager& getNativeScriptHandler();
};