Simplify command invocation

This commit is contained in:
Paul Pacheco 2018-06-28 22:47:33 -05:00
parent ec7185ad49
commit eff9287236

View File

@ -345,21 +345,13 @@ internal bool InvokeCommandDelegate(int cmdHash, NetworkReader reader)
return false; return false;
} }
if (GetType() != inv.invokeClass) if (inv.invokeClass.IsInstanceOfType(this))
{ {
if (GetType().IsSubclassOf(inv.invokeClass))
{
// allowed, commands function is on a base class.
}
else
{
return false;
}
}
inv.invokeFunction(this, reader); inv.invokeFunction(this, reader);
return true; return true;
} }
return false;
}
internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader) internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader)
{ {
@ -374,21 +366,13 @@ internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader)
return false; return false;
} }
if (GetType() != inv.invokeClass) if (inv.invokeClass.IsInstanceOfType(this))
{ {
if (GetType().IsSubclassOf(inv.invokeClass))
{
// allowed, rpc function is on a base class.
}
else
{
return false;
}
}
inv.invokeFunction(this, reader); inv.invokeFunction(this, reader);
return true; return true;
} }
return false;
}
internal bool InvokeSyncEventDelegate(int cmdHash, NetworkReader reader) internal bool InvokeSyncEventDelegate(int cmdHash, NetworkReader reader)
{ {