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

Function MultiDoRequestCountermeasure

Descent3/multi.cpp:6073–6105  ·  view source on GitHub ↗

Server is telling us to create a countermeasure

Source from the content-addressed store, hash-verified

6071
6072// Server is telling us to create a countermeasure
6073void MultiDoRequestCountermeasure(uint8_t *data) {
6074 int count = 0;
6075
6076 mprintf(0, "Got request for countermeasure!\n");
6077
6078 SKIP_HEADER(data, &count);
6079
6080 uint16_t parent_objnum = MultiGetShort(data, &count);
6081
6082 if (Netgame.local_role != LR_SERVER) {
6083 parent_objnum = Server_object_list[parent_objnum];
6084 MULTI_ASSERT_NOMESSAGE(parent_objnum != 65535);
6085 }
6086
6087 uint32_t checksum = MultiGetUint(data, &count);
6088
6089 int id = MultiMatchWeapon(checksum);
6090
6091 if (id == -1) {
6092 mprintf(0, "Server data doesn't match!\n");
6093 Int3();
6094 MultiMatchWeapon(checksum);
6095
6096 return;
6097 }
6098
6099 int objnum = FireWeaponFromObject(&Objects[parent_objnum], id, 5);
6100
6101 if (objnum >= 0) {
6102 if (Netgame.local_role == LR_SERVER)
6103 MultiSendReliablyToAllExcept(Player_num, data, count, NETSEQ_PLAYERS, false);
6104 }
6105}
6106
6107// We're asking the server to create a countermeasure for us
6108void MultiSendRequestCountermeasure(int16_t objnum, int weapon_index) {

Callers 2

MultiProcessDataFunction · 0.85

Calls 6

SKIP_HEADERFunction · 0.85
MultiGetShortFunction · 0.85
MultiGetUintFunction · 0.85
MultiMatchWeaponFunction · 0.85
FireWeaponFromObjectFunction · 0.85

Tested by

no test coverage detected