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

Function MultiSendStripPlayer

Descent3/multi.cpp:9237–9271  ·  view source on GitHub ↗

Strips a player bare of weapons

Source from the content-addressed store, hash-verified

9235
9236// Strips a player bare of weapons
9237void MultiSendStripPlayer(int slot) {
9238 if (Game_mode & GM_MULTI) {
9239 MULTI_ASSERT_NOMESSAGE(Netgame.local_role == LR_SERVER);
9240 } else {
9241 if (slot == -1) {
9242 // it's not a multiplayer game, bash to just us
9243 slot = Player_num;
9244 }
9245 }
9246
9247 int count = 0, save_count;
9248 uint8_t data[MAX_GAME_DATA_SIZE];
9249 int size_offset;
9250 size_offset = START_DATA(MP_STRIP_PLAYER, data, &count);
9251 save_count = count;
9252 MultiAddByte(slot, data, &count);
9253 END_DATA(count, data, size_offset);
9254
9255 if (slot != -1) {
9256 MultiDoStripPlayer(Player_num, data);
9257 if (slot != Player_num)
9258 nw_SendReliable(NetPlayers[slot].reliable_socket, data, count, false);
9259 } else {
9260 // strip all the players
9261 int i;
9262 for (i = 0; i < MAX_PLAYERS; i++) {
9263 if ((NetPlayers[i].flags & NPF_CONNECTED) && (NetPlayers[i].sequence != NETSEQ_PLAYING)) {
9264 MultiAddByte(i, data, &save_count); // change the value in the packet
9265 MultiDoStripPlayer(Player_num, data);
9266 if (i != Player_num)
9267 nw_SendReliable(NetPlayers[i].reliable_socket, data, count, false);
9268 }
9269 }
9270 }
9271}
9272
9273// Server is telling me about a player rank
9274void MultiDoInitialRank(uint8_t *data) {

Callers 1

osipf_PlayerValueFunction · 0.85

Calls 5

START_DATAFunction · 0.85
MultiAddByteFunction · 0.85
END_DATAFunction · 0.85
MultiDoStripPlayerFunction · 0.85
nw_SendReliableFunction · 0.85

Tested by

no test coverage detected