mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-22 07:29:07 +00:00
Remove all external usage of CmptPrivate. Header cleanup.
This removes usage of CmptPrivate outside of ScriptInterface.
ScriptRequest can now be used to safely recover the scriptInterface from
a JSContext instead of going through ScriptInterface, which allows more
code cleanup.
Follows 34b1920e7b
Differential Revision: https://code.wildfiregames.com/D3963
This was SVN commit r25442.
This commit is contained in:
@@ -24,25 +24,24 @@
|
||||
|
||||
extern void RestartEngine();
|
||||
|
||||
namespace
|
||||
namespace JSI_Mod
|
||||
{
|
||||
bool SetModsAndRestartEngine(ScriptInterface::CmptPrivate* pCmptPrivate, const std::vector<CStr>& mods)
|
||||
bool SetModsAndRestartEngine(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods)
|
||||
{
|
||||
Mod::ClearIncompatibleMods();
|
||||
if (!Mod::CheckAndEnableMods(*(pCmptPrivate->pScriptInterface), mods))
|
||||
if (!Mod::CheckAndEnableMods(scriptInterface, mods))
|
||||
return false;
|
||||
|
||||
RestartEngine();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool HasFailedMods(ScriptInterface::CmptPrivate* UNUSED(pCmptPrivate))
|
||||
bool HasFailedMods()
|
||||
{
|
||||
return Mod::GetFailedMods().size() > 0;
|
||||
}
|
||||
|
||||
void JSI_Mod::RegisterScriptFunctions(const ScriptRequest& rq)
|
||||
void RegisterScriptFunctions(const ScriptRequest& rq)
|
||||
{
|
||||
ScriptFunction::Register<&Mod::GetEngineInfo>(rq, "GetEngineInfo");
|
||||
ScriptFunction::Register<&Mod::GetAvailableMods>(rq, "GetAvailableMods");
|
||||
@@ -51,3 +50,4 @@ void JSI_Mod::RegisterScriptFunctions(const ScriptRequest& rq)
|
||||
ScriptFunction::Register<&Mod::GetFailedMods>(rq, "GetFailedMods");
|
||||
ScriptFunction::Register<&SetModsAndRestartEngine>(rq, "SetModsAndRestartEngine");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user