MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ServerSendEvent

Method ServerSendEvent

neo/d3xp/Entity.cpp:4918–4953  ·  view source on GitHub ↗

================ idEntity::ServerSendEvent Saved events are also sent to any client that connects late so all clients always receive the events nomatter what time they join the game. ================ */

Source from the content-addressed store, hash-verified

4916================
4917*/
4918void idEntity::ServerSendEvent( int eventId, const idBitMsg *msg, bool saveEvent, int excludeClient ) const {
4919 idBitMsg outMsg;
4920 byte msgBuf[MAX_GAME_MESSAGE_SIZE];
4921
4922 if ( !gameLocal.isServer ) {
4923 return;
4924 }
4925
4926 // prevent dupe events caused by frame re-runs
4927 if ( !gameLocal.isNewFrame ) {
4928 return;
4929 }
4930
4931 outMsg.Init( msgBuf, sizeof( msgBuf ) );
4932 outMsg.BeginWriting();
4933 outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT );
4934 outMsg.WriteBits( gameLocal.GetSpawnId( this ), 32 );
4935 outMsg.WriteByte( eventId );
4936 outMsg.WriteInt( gameLocal.time );
4937 if ( msg ) {
4938 outMsg.WriteBits( msg->GetSize(), idMath::BitsForInteger( MAX_EVENT_PARAM_SIZE ) );
4939 outMsg.WriteData( msg->GetData(), msg->GetSize() );
4940 } else {
4941 outMsg.WriteBits( 0, idMath::BitsForInteger( MAX_EVENT_PARAM_SIZE ) );
4942 }
4943
4944 if ( excludeClient != -1 ) {
4945 networkSystem->ServerSendReliableMessageExcluding( excludeClient, outMsg );
4946 } else {
4947 networkSystem->ServerSendReliableMessage( -1, outMsg );
4948 }
4949
4950 if ( saveEvent ) {
4951 gameLocal.SaveEntityNetworkEvent( this, eventId, msg );
4952 }
4953}
4954
4955/*
4956================

Callers 2

Player.cppFile · 0.45

Calls 12

BeginWritingMethod · 0.80
InitMethod · 0.45
WriteByteMethod · 0.45
WriteBitsMethod · 0.45
GetSpawnIdMethod · 0.45
WriteIntMethod · 0.45
GetSizeMethod · 0.45
WriteDataMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected