| 30316 | } |
| 30317 | |
| 30318 | void CalloutRadialMenu::sendCalloutText(CalloutRadialMenu::CalloutCommand cmd) |
| 30319 | { |
| 30320 | if ( cmd == CALLOUT_CMD_CANCEL || cmd == CALLOUT_CMD_END ) |
| 30321 | { |
| 30322 | return; |
| 30323 | } |
| 30324 | if ( multiplayer == CLIENT ) |
| 30325 | { |
| 30326 | strcpy((char*)net_packet->data, "CALL"); |
| 30327 | net_packet->data[4] = getPlayer(); |
| 30328 | SDLNet_Write32(lockOnEntityUid, &net_packet->data[5]); |
| 30329 | net_packet->data[9] = (Uint8)cmd; |
| 30330 | SDLNet_Write32(clientCalloutHelpFlags, &net_packet->data[10]); |
| 30331 | net_packet->len = 14; |
| 30332 | if ( lockOnEntityUid == 0 ) |
| 30333 | { |
| 30334 | Uint16 _x = std::min<Uint16>(std::max<int>(0.0, moveToX / 16), map.width - 1); |
| 30335 | Uint16 _y = std::min<Uint16>(std::max<int>(0.0, moveToY / 16), map.height - 1); |
| 30336 | SDLNet_Write16(_x, &net_packet->data[14]); |
| 30337 | SDLNet_Write16(_y, &net_packet->data[16]); |
| 30338 | net_packet->len = 18; |
| 30339 | } |
| 30340 | net_packet->address.host = net_server.host; |
| 30341 | net_packet->address.port = net_server.port; |
| 30342 | sendPacketSafe(net_sock, -1, net_packet, 0); |
| 30343 | } |
| 30344 | else |
| 30345 | { |
| 30346 | for ( int i = 0; i < MAXPLAYERS; ++i ) |
| 30347 | { |
| 30348 | std::string text = setCalloutText(nullptr, getCalloutKeyForCommand(cmd).c_str(), 0, cmd, SET_CALLOUT_WORLD_TEXT, i); |
| 30349 | if ( text != "" ) |
| 30350 | { |
| 30351 | messagePlayerColor(i, MESSAGE_INTERACTION, playerColor(getPlayer(), colorblind_lobby, false), |
| 30352 | text.c_str()); |
| 30353 | } |
| 30354 | } |
| 30355 | } |
| 30356 | } |
| 30357 | |
| 30358 | std::string CalloutRadialMenu::getCalloutKeyForCommand(CalloutRadialMenu::CalloutCommand cmd) |
| 30359 | { |
no test coverage detected