MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / BuildDispatchTable

Method BuildDispatchTable

Code/CryEngine/CryAction/Network/ScriptRMI.cpp:254–379  ·  view source on GitHub ↗

build a script dispatch table - this table is the metatable for all dispatch proxy tables used (onClient, allClients, otherClients)

Source from the content-addressed store, hash-verified

252// build a script dispatch table - this table is the metatable for all
253// dispatch proxy tables used (onClient, allClients, otherClients)
254bool CScriptRMI::BuildDispatchTable(
255 SmartScriptTable methods,
256 SmartScriptTable classMethodTable,
257 SmartScriptTable cls,
258 const char* name)
259{
260 IScriptSystem* pSS = methods->GetScriptSystem();
261 SmartScriptTable dispatch(pSS);
262
263 uint8 funcID = 0;
264
265 IScriptTable::SUserFunctionDesc fd;
266 SFunctionInfo info;
267
268 IScriptTable::Iterator iter = methods->BeginIteration();
269 while (methods->MoveNext(iter))
270 {
271 if (iter.sKey)
272 {
273 const char* function = iter.sKey;
274
275 if (strlen(function) >= 2 && function[0] == '_' && function[1] == '_')
276 {
277 methods->EndIteration(iter);
278 pSS->RaiseError("In Net.Expose: can't expose functions beginning with '__' (function was %s)",
279 function);
280 return false;
281 }
282
283 SmartScriptTable specTable;
284 if (!methods->GetValue(function, specTable))
285 {
286 methods->EndIteration(iter);
287 pSS->RaiseError("In Net.Expose: function %s entry is not a table (in %s)",
288 function, name);
289 return false;
290 }
291
292 // fetch format
293 int count = specTable->Count();
294 if (count < 1)
295 {
296 methods->EndIteration(iter);
297 pSS->RaiseError("In Net.Expose: function %s entry is an empty table (in %s)",
298 function, name);
299 return false;
300 }
301 else if (count - 1 > MaxRMIParameters)
302 {
303 methods->EndIteration(iter);
304 pSS->RaiseError("In Net.Expose: function %s has too many parameters (%d) (in %s)",
305 function, count - 1, name);
306 return false;
307 }
308 int tempReliability;
309 if (!specTable->GetAt(1, tempReliability) || tempReliability < 0 || tempReliability >= eNRT_NumReliabilityTypes)
310 {
311 methods->EndIteration(iter);

Callers

nothing calls this directly

Calls 15

strlenFunction · 0.85
cry_strcpyFunction · 0.85
BeginIterationMethod · 0.80
EndIterationMethod · 0.80
RaiseErrorMethod · 0.80
AddFunctionMethod · 0.80
GameWarningFunction · 0.50
GetScriptSystemMethod · 0.45
MoveNextMethod · 0.45
GetValueMethod · 0.45
CountMethod · 0.45
GetAtMethod · 0.45

Tested by

no test coverage detected