Add check for valid RPC impl define usage

This commit is contained in:
Wojciech Figat
2022-11-22 15:18:52 +01:00
parent 073bd74b3c
commit 8e41711e82

View File

@@ -47,7 +47,15 @@ FORCE_INLINE void NetworkRpcInitArg(Array<void*, FixedAllocation<16>>& args, con
// Network RPC implementation (placed in the beginning of the method body)
#define NETWORK_RPC_IMPL(type, name, ...) \
{ \
const NetworkRpcInfo& rpcInfo = NetworkRpcInfo::RPCsTable[NetworkRpcName(type::TypeInitializer, StringAnsiView(#name))]; \
const NetworkRpcInfo* rpcInfoPtr = NetworkRpcInfo::RPCsTable.TryGet(NetworkRpcName(type::TypeInitializer, StringAnsiView(#name))); \
if (rpcInfoPtr == nullptr) \
{ \
if (Platform::IsDebuggerPresent()) \
PLATFORM_DEBUG_BREAK; \
Platform::Assert("Invalid RPC. Ensure to use proper type name and method name.", __FILE__, __LINE__); \
return; \
} \
const NetworkRpcInfo& rpcInfo = *rpcInfoPtr; \
const NetworkManagerMode networkMode = NetworkManager::Mode; \
if ((rpcInfo.Server && networkMode == NetworkManagerMode::Client) || (rpcInfo.Client && networkMode != NetworkManagerMode::Client)) \
{ \