@@ -983,27 +983,33 @@ namespace CLEO
983
983
}
984
984
985
985
// [game root]\cleo
986
- std::string scriptsDir = CFileMgr::ms_rootDirName;
986
+ /* std::string scriptsDir = CFileMgr::ms_rootDirName;
987
987
if (!scriptsDir.empty() && scriptsDir.back() != '\\') scriptsDir.push_back('\\');
988
- scriptsDir += " cleo" ;
988
+ scriptsDir += "cleo";*/
989
+ std::string scriptsDir = " cleo" ; // TODO: restore to absolute path when ModLoader is updated to support CLEO5
989
990
990
991
TRACE (" Searching for cleo scripts" );
991
992
992
- FilesWalk (scriptsDir. c_str (), cs_ext, [ this ]( const char * fullPath, const char * filename) {
993
- auto cs = LoadScript (fullPath);
994
- cs-> SetDebugMode (NativeScriptsDebugMode); // inherit from global state
993
+ CCustomScript* cs = nullptr ;
994
+ FilesWalk (scriptsDir. c_str (), cs_ext, [&]( const char * fullPath, const char * filename) {
995
+ cs = LoadScript (fullPath);
995
996
});
996
997
997
- FilesWalk (scriptsDir.c_str (), cs4_ext, [this ](const char * fullPath, const char * filename) {
998
- auto cs = LoadScript (fullPath);
998
+ FilesWalk (scriptsDir.c_str (), cs4_ext, [& ](const char * fullPath, const char * filename) {
999
+ cs = LoadScript (fullPath);
999
1000
if (cs) cs->SetCompatibility (CLEO_VER_4);
1000
1001
});
1001
1002
1002
- FilesWalk (scriptsDir.c_str (), cs3_ext, [this ](const char * fullPath, const char * filename) {
1003
- auto cs = LoadScript (fullPath);
1003
+ FilesWalk (scriptsDir.c_str (), cs3_ext, [& ](const char * fullPath, const char * filename) {
1004
+ cs = LoadScript (fullPath);
1004
1005
if (cs) cs->SetCompatibility (CLEO_VER_3);
1005
1006
});
1006
1007
1008
+ if (cs != nullptr )
1009
+ {
1010
+ cs->SetDebugMode (NativeScriptsDebugMode); // inherit from global state
1011
+ }
1012
+
1007
1013
for (void * func : GetInstance ().GetCallbacks (eCallbackId::ScriptsLoaded))
1008
1014
{
1009
1015
typedef void WINAPI callback (void );
0 commit comments