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

Function MultiSendGuidebotMenuSelection

Descent3/buddymenu.cpp:227–255  ·  view source on GitHub ↗

TODO -- Call this function when the client selects a menu item

Source from the content-addressed store, hash-verified

225
226// TODO -- Call this function when the client selects a menu item
227void MultiSendGuidebotMenuSelection(gb_com *command) {
228 int size_offset;
229 int count = 0;
230 uint8_t data[MAX_GAME_DATA_SIZE];
231
232 // Only process this if we are the client
233 if (Netgame.local_role != LR_CLIENT) {
234 Int3(); // We shouldn't be here... get Kevin
235 return;
236 }
237
238 size_offset = START_DATA(MP_GUIDEBOTMENU_REQUEST, data, &count);
239 MultiAddByte(GB_MENU_REQ_SELECT, data, &count);
240
241 MultiAddInt(command->action, data, &count);
242 MultiAddInt(command->index, data, &count);
243
244 if (command->ptr) {
245 int len = strlen((char *)command->ptr) + 1;
246 MultiAddShort(len, data, &count);
247 memcpy(data + count, command->ptr, len);
248 count += len;
249 } else {
250 MultiAddShort(0, data, &count);
251 }
252
253 END_DATA(count, data, size_offset);
254 nw_SendReliable(NetPlayers[Player_num].reliable_socket, data, count);
255}
256
257static void MultiSendGuidebotMenuText(gb_menu *menu, int slot) {
258 int size_offset;

Callers 2

ProcessGuidebotKeysFunction · 0.85
BuddyProcessCommandFunction · 0.85

Calls 6

START_DATAFunction · 0.85
MultiAddByteFunction · 0.85
MultiAddIntFunction · 0.85
MultiAddShortFunction · 0.85
END_DATAFunction · 0.85
nw_SendReliableFunction · 0.85

Tested by

no test coverage detected