MCPcopy Create free account
hub / github.com/SapphireServer/Sapphire / loadScript

Method loadScript

src/world/Script/NativeScriptMgr.cpp:10–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8{
9
10 bool NativeScriptMgr::loadScript( const std::string& path )
11 {
12 auto module = m_loader.loadModule( path );
13 if( !module )
14 return false;
15
16 auto scripts = m_loader.getScripts( module->handle );
17 if( !scripts )
18 {
19 m_loader.unloadScript( module );
20 return false;
21 }
22
23 //
24 bool success = false;
25
26 for( int i = 0;; i++ )
27 {
28 if( scripts[ i ] == nullptr )
29 break;
30
31 auto script = scripts[ i ];
32 module->scripts.push_back( script );
33
34 m_scripts[ script->getType() ][ script->getId() ] = script;
35
36 success = true;
37 }
38
39 if( !success )
40 {
41 m_loader.unloadScript( module->handle );
42 return false;
43 }
44
45 return true;
46 }
47
48 const std::string NativeScriptMgr::getModuleExtension()
49 {

Callers 3

initMethod · 0.80
watchDirectoriesMethod · 0.80
scriptMethod · 0.80

Calls 5

loadModuleMethod · 0.80
getScriptsMethod · 0.80
unloadScriptMethod · 0.45
getTypeMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected