MCPcopy Create free account
hub / github.com/Segs/Segs / serializeto

Function serializeto

Projects/CoX/Servers/MapServer/EntityUpdateCodec.cpp:409–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409void serializeto(const Entity & src, ClientEntityStateBelief &belief, BitStream &bs )
410{
411 bool client_believes_ent_exists=belief.m_entity!=nullptr;
412 bool ent_exists = src.m_destroyed==false;
413 bool update_existence=client_believes_ent_exists!=ent_exists;
414
415 //////////////////////////////////////////////////////////////////////////
416 bs.StoreBits(1,update_existence);
417 if(update_existence)
418 storeCreation(src,bs);
419 belief.m_entity = ent_exists ? &src : nullptr;
420 if(!ent_exists)
421 return;
422 //////////////////////////////////////////////////////////////////////////
423 // creation ends here
424 PUTDEBUG("before entReceiveStateMode");
425
426 bs.StoreBits(1,src.m_update_anims); //var_C
427
428 if(src.m_update_anims)
429 bs.StoreBits(1,src.m_rare_update);
430
431 if(src.m_rare_update)
432 sendStateMode(src,bs);
433
434 storePosUpdate(src,update_existence && ent_exists, bs);
435
436 if(src.m_update_anims)
437 sendSeqMoveUpdate(src,bs);
438
439 if(src.m_rare_update)
440 sendSeqTriggeredMoves(src,bs);
441
442 // NPC -> m_pchar_things=0 ?
443 PUTDEBUG("before m_pchar_things");
444 bs.StoreBits(1,src.m_pchar_things);
445 if(src.m_pchar_things)
446 {
447 sendNetFx(src,bs);
448 }
449 if(src.m_rare_update)
450 {
451 sendCostumes(src,bs);
452 sendXLuency(bs,src.translucency);
453 bs.StoreBits(1, src.m_char->m_char_data.m_has_titles); // Does entity have titles?
454 if(src.m_char->m_char_data.m_has_titles)
455 src.m_char->sendTitles(bs,NameFlag::HasName,ConditionalFlag::Conditional);
456 }
457 if(src.m_pchar_things)
458 {
459 sendCharacterStats(src,bs);
460 sendBuffsConditional(src,bs);
461 sendTargetUpdate(src,bs);
462 }
463 if(src.m_rare_update)
464 {
465 sendOnOddSend(src,bs); // is one on client end
466 sendWhichSideOfTheForce(src,bs);

Callers 1

sendEntitiesMethod · 0.70

Calls 15

storeCreationFunction · 0.85
sendStateModeFunction · 0.85
storePosUpdateFunction · 0.85
sendSeqMoveUpdateFunction · 0.85
sendSeqTriggeredMovesFunction · 0.85
sendNetFxFunction · 0.85
sendCostumesFunction · 0.85
sendXLuencyFunction · 0.85
sendCharacterStatsFunction · 0.85
sendBuffsConditionalFunction · 0.85
sendTargetUpdateFunction · 0.85
sendOnOddSendFunction · 0.85

Tested by

no test coverage detected