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,20 +345,12 @@ 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)) inv.invokeFunction(this, reader);
{ return true;
// allowed, commands function is on a base class.
}
else
{
return false;
}
} }
return false;
inv.invokeFunction(this, reader);
return true;
} }
internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader) internal bool InvokeRpcDelegate(int cmdHash, NetworkReader reader)
@ -374,20 +366,12 @@ 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)) inv.invokeFunction(this, reader);
{ return true;
// allowed, rpc function is on a base class.
}
else
{
return false;
}
} }
return false;
inv.invokeFunction(this, reader);
return true;
} }
internal bool InvokeSyncEventDelegate(int cmdHash, NetworkReader reader) internal bool InvokeSyncEventDelegate(int cmdHash, NetworkReader reader)