MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiDoGetPXOGameInfo

Function MultiDoGetPXOGameInfo

Descent3/multi.cpp:3920–4003  ·  view source on GitHub ↗

Someone is asking about our PXO game

Source from the content-addressed store, hash-verified

3918
3919// Someone is asking about our PXO game
3920void MultiDoGetPXOGameInfo(uint8_t *data, network_address *from_addr) {
3921 uint8_t outdata[MAX_GAME_DATA_SIZE];
3922 int count = 0;
3923 int size_offset;
3924 float ping_time;
3925 network_address my_addr;
3926
3927 // mprintf(0,"Got a request for knowledge about my game!\n");
3928
3929 if (!Game_is_master_tracker_game) {
3930 return;
3931 }
3932 // Get the time and stuff it back in the packet
3933 SKIP_HEADER(data, &count);
3934 ping_time = MultiGetFloat(data, &count);
3935 int version = MultiGetInt(data, &count);
3936
3937 if (version != MULTI_VERSION)
3938 return; // Versions don't match, so just return
3939
3940 count = 0;
3941
3942 if ((Netgame.local_role == LR_SERVER) && (Game_mode & GM_MULTI)) {
3943 size_offset = START_DATA(MP_GAME_INFO, outdata, &count);
3944 // Copies my address into the passed argument
3945 nw_GetMyAddress(&my_addr);
3946 memcpy(&outdata[count], &my_addr, sizeof(network_address));
3947 count += sizeof(network_address);
3948
3949 int len = strlen(Netgame.name) + 1;
3950 MultiAddByte(len, outdata, &count);
3951 memcpy(&outdata[count], Netgame.name, len);
3952 count += len;
3953
3954 len = strlen(Netgame.mission) + 1;
3955
3956 MultiAddByte(len, outdata, &count);
3957 memcpy(&outdata[count], Netgame.mission, len);
3958 count += len;
3959
3960 len = strlen(Netgame.mission_name) + 1;
3961
3962 MultiAddByte(len, outdata, &count);
3963 memcpy(&outdata[count], Netgame.mission_name, len);
3964 count += len;
3965
3966 len = strlen(Netgame.scriptname) + 1;
3967
3968 MultiAddByte(len, outdata, &count);
3969 memcpy(&outdata[count], Netgame.scriptname, len);
3970 count += len;
3971
3972 MultiAddShort(Current_mission.cur_level, outdata, &count);
3973 uint16_t icurrplayers = 0;
3974 int i = 0;
3975
3976 for (i = 0; i < MAX_NET_PLAYERS; i++) {
3977 if (Dedicated_server) {

Callers 1

MultiProcessDataFunction · 0.85

Calls 11

SKIP_HEADERFunction · 0.85
MultiGetFloatFunction · 0.85
MultiGetIntFunction · 0.85
START_DATAFunction · 0.85
nw_GetMyAddressFunction · 0.85
MultiAddByteFunction · 0.85
MultiAddShortFunction · 0.85
MultiAddFloatFunction · 0.85
MultiAddIntFunction · 0.85
END_DATAFunction · 0.85
nw_SendFunction · 0.85

Tested by

no test coverage detected