MCPcopy Create free account
hub / github.com/defold/defold / DispatchMessages

Function DispatchMessages

engine/gameobject/src/gameobject/gameobject.cpp:2519–2552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2517 }
2518
2519 static bool DispatchMessages(Collection* collection, dmMessage::HSocket* sockets, uint32_t socket_count)
2520 {
2521 DM_PROFILE("DispatchMessages");
2522
2523 DispatchMessagesContext ctx;
2524 ctx.m_Collection = collection;
2525 ctx.m_Success = true;
2526 bool iterate = true;
2527 uint32_t iteration_count = 0;
2528 while (iterate && iteration_count < MAX_DISPATCH_ITERATION_COUNT)
2529 {
2530 iterate = false;
2531 for (uint32_t i = 0; i < socket_count; ++i)
2532 {
2533 if (!dmMessage::HasMessages(sockets[i]))
2534 {
2535 continue; // no need to try to update or send anything
2536 }
2537 // Make sure the transforms are updated if we are about to dispatch messages
2538 if (collection->m_DirtyTransforms)
2539 {
2540 UpdateTransforms(collection);
2541 }
2542 uint32_t message_count = dmMessage::Dispatch(sockets[i], &DispatchMessagesFunction, (void*) &ctx);
2543 if (message_count)
2544 {
2545 iterate = true;
2546 }
2547 }
2548 ++iteration_count;
2549 }
2550
2551 return ctx.m_Success;
2552 }
2553
2554 bool DispatchMessages(HCollection hcollection, dmMessage::HSocket* sockets, uint32_t socket_count)
2555 {

Callers 5

InitCollectionFunction · 0.85
UpdateComponentFunctionFunction · 0.85
DispatchAllSocketsFunction · 0.85
StepFunction · 0.85
StepFunction · 0.85

Calls 3

HasMessagesFunction · 0.85
UpdateTransformsFunction · 0.70
DispatchFunction · 0.50

Tested by

no test coverage detected