forked from Mirrors/openclonk
Replace the other C4AulScript::GetSFunc with C4PropList::GetFunc/Call
parent
db926e3f53
commit
b6fb634bd3
|
@ -1608,23 +1608,8 @@ bool AlgoGradient(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
|
|||
|
||||
bool AlgoScript(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
|
||||
{
|
||||
// get script function
|
||||
C4AulFunc *pFunc = ::GameScript.GetSFunc(FormatString("ScriptAlgo%s", pOvrl->Name).getData());
|
||||
// failsafe
|
||||
if (!pFunc) return false;
|
||||
// ok, call func
|
||||
C4AulParSet Pars( C4VInt(iX), C4VInt(iY), C4VInt(pOvrl->Alpha.Evaluate(C4MC_SizeRes)), C4VInt(pOvrl->Beta.Evaluate(C4MC_SizeRes)));
|
||||
// catch error (damn insecure C4Aul)
|
||||
try
|
||||
{
|
||||
return !! pFunc->Exec(0, &Pars);
|
||||
}
|
||||
catch (C4AulError *err)
|
||||
{
|
||||
// do nothing
|
||||
delete err;
|
||||
}
|
||||
return false;
|
||||
return ::GameScript.Call(FormatString("ScriptAlgo%s", pOvrl->Name).getData(), &Pars).getBool();
|
||||
}
|
||||
|
||||
bool AlgoRndAll(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
|
||||
|
|
|
@ -4524,8 +4524,8 @@ bool C4Object::PutAwayUnusedObject(C4Object *pToMakeRoomForObject)
|
|||
{
|
||||
// get unused object
|
||||
C4Object *pUnusedObject;
|
||||
C4AulFunc *pFnObj2Drop;
|
||||
if ((pFnObj2Drop = Def->Script.GetSFunc(PSF_GetObject2Drop)))
|
||||
C4AulFunc *pFnObj2Drop = GetFunc(PSF_GetObject2Drop);
|
||||
if (pFnObj2Drop)
|
||||
pUnusedObject = pFnObj2Drop->Exec(this, pToMakeRoomForObject ? &C4AulParSet(C4VObj(pToMakeRoomForObject)) : NULL).getObj();
|
||||
else
|
||||
{
|
||||
|
|
|
@ -298,17 +298,6 @@ C4AulFunc *C4AulScript::GetFunc(const char *pIdtf)
|
|||
return f;
|
||||
}
|
||||
|
||||
C4AulScriptFunc *C4AulScript::GetSFunc(const char *pIdtf)
|
||||
{
|
||||
// get func by name; return script func
|
||||
if (!pIdtf) return NULL;
|
||||
if (!pIdtf[0]) return NULL;
|
||||
if (pIdtf[0] == '~') pIdtf++;
|
||||
C4AulFunc *f = GetFunc(pIdtf);
|
||||
if (!f) return NULL;
|
||||
return f->SFunc();
|
||||
}
|
||||
|
||||
std::string C4AulScript::Translate(const std::string &text) const
|
||||
{
|
||||
const C4AulScript *cursor = this;
|
||||
|
|
|
@ -384,7 +384,6 @@ public:
|
|||
virtual C4PropList * GetPropList() { return 0; }
|
||||
virtual C4ScriptHost * GetScriptHost() { return 0; }
|
||||
C4AulFunc *GetFuncRecursive(const char *pIdtf); // search function by identifier, including global funcs
|
||||
C4AulScriptFunc *GetSFunc(const char *pIdtf); // get local script function by name
|
||||
|
||||
void AddFunc(const char *pIdtf, C4ScriptFnDef* Def); // add def def func to table
|
||||
|
||||
|
|
Loading…
Reference in New Issue