mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 09:20:59 +00:00
reference event callbacks by name, not by internal index.
This is needed to allow writing new callbacks.
This commit is contained in:
parent
47f09c61fc
commit
11f094c7fb
14 changed files with 92 additions and 20 deletions
|
@ -1639,6 +1639,23 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx)
|
|||
// don't go through the entire list if the types are the same.
|
||||
goto basereturn;
|
||||
}
|
||||
else if ((basex->ValueType == TypeString || basex->ValueType == TypeName) && ValueType == TypeVMFunction && basex->isConstant())
|
||||
{
|
||||
FxExpression* x = new FxStringCast(basex);
|
||||
x = x->Resolve(ctx);
|
||||
basex = nullptr;
|
||||
auto c = static_cast<FxConstant*>(x)->GetValue().GetString().GetChars();
|
||||
auto func = FindVMFunction(c);
|
||||
if (func == nullptr)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "VM function %s not found", c);
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
auto newx = new FxConstant(func, ScriptPosition);
|
||||
delete this;
|
||||
return newx->Resolve(ctx);
|
||||
}
|
||||
else if (basex->ValueType == TypeNullPtr && ValueType->isPointer())
|
||||
{
|
||||
goto basereturn;
|
||||
|
|
|
@ -506,6 +506,13 @@ public:
|
|||
isresolved = true;
|
||||
}
|
||||
|
||||
FxConstant(VMFunction* state, const FScriptPosition& pos) : FxExpression(EFX_Constant, pos)
|
||||
{
|
||||
value.pointer = state;
|
||||
ValueType = value.Type = TypeVMFunction;
|
||||
isresolved = true;
|
||||
}
|
||||
|
||||
FxConstant(const FScriptPosition &pos) : FxExpression(EFX_Constant, pos)
|
||||
{
|
||||
value.pointer = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue