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

Method ServerProcessReliableMessage

neo/game/Game_network.cpp:791–865  ·  view source on GitHub ↗

================ idGameLocal::ServerProcessReliableMessage ================ */

Source from the content-addressed store, hash-verified

789================
790*/
791void idGameLocal::ServerProcessReliableMessage( int clientNum, const idBitMsg &msg ) {
792 int id;
793
794 id = msg.ReadByte();
795 switch( id ) {
796 case GAME_RELIABLE_MESSAGE_CHAT:
797 case GAME_RELIABLE_MESSAGE_TCHAT: {
798 char name[128];
799 char text[128];
800
801 msg.ReadString( name, sizeof( name ) );
802 msg.ReadString( text, sizeof( text ) );
803
804 mpGame.ProcessChatMessage( clientNum, id == GAME_RELIABLE_MESSAGE_TCHAT, name, text, NULL );
805
806 break;
807 }
808 case GAME_RELIABLE_MESSAGE_VCHAT: {
809 int index = msg.ReadInt();
810 bool team = msg.ReadBits( 1 ) != 0;
811 mpGame.ProcessVoiceChat( clientNum, team, index );
812 break;
813 }
814 case GAME_RELIABLE_MESSAGE_KILL: {
815 mpGame.WantKilled( clientNum );
816 break;
817 }
818 case GAME_RELIABLE_MESSAGE_DROPWEAPON: {
819 mpGame.DropWeapon( clientNum );
820 break;
821 }
822 case GAME_RELIABLE_MESSAGE_CALLVOTE: {
823 mpGame.ServerCallVote( clientNum, msg );
824 break;
825 }
826 case GAME_RELIABLE_MESSAGE_CASTVOTE: {
827 bool vote = ( msg.ReadByte() != 0 );
828 mpGame.CastVote( clientNum, vote );
829 break;
830 }
831#if 0
832 // uncomment this if you want to track when players are in a menu
833 case GAME_RELIABLE_MESSAGE_MENU: {
834 bool menuUp = ( msg.ReadBits( 1 ) != 0 );
835 break;
836 }
837#endif
838 case GAME_RELIABLE_MESSAGE_EVENT: {
839 entityNetEvent_t *event;
840
841 // allocate new event
842 event = eventQueue.Alloc();
843 eventQueue.Enqueue( event, idEventQueue::OUTOFORDER_DROP );
844
845 event->spawnId = msg.ReadBits( 32 );
846 event->event = msg.ReadByte();
847 event->time = msg.ReadInt();
848

Calls 15

WarningFunction · 0.85
ReadByteAlignMethod · 0.80
ReadByteMethod · 0.45
ReadStringMethod · 0.45
ProcessChatMessageMethod · 0.45
ReadIntMethod · 0.45
ReadBitsMethod · 0.45
ProcessVoiceChatMethod · 0.45
WantKilledMethod · 0.45
DropWeaponMethod · 0.45
ServerCallVoteMethod · 0.45
CastVoteMethod · 0.45

Tested by

no test coverage detected