Sends a new player to existing players Sends to "slot" and describes player "which" Server only
| 2741 | // Sends to "slot" and describes player "which" |
| 2742 | // Server only |
| 2743 | void MultiSendPlayerEnteredGame(int which) { |
| 2744 | MULTI_ASSERT(Netgame.local_role == LR_SERVER, NULL); |
| 2745 | |
| 2746 | uint8_t data[MAX_GAME_DATA_SIZE]; |
| 2747 | int count = 0; |
| 2748 | int size_offset; |
| 2749 | |
| 2750 | size_offset = START_DATA(MP_PLAYER_ENTERED_GAME, data, &count, 1); |
| 2751 | |
| 2752 | MultiAddByte(which, data, &count); |
| 2753 | |
| 2754 | // Add name |
| 2755 | int len = strlen(Players[which].callsign) + 1; |
| 2756 | MultiAddByte(len, data, &count); |
| 2757 | memcpy(&data[count], Players[which].callsign, len); |
| 2758 | count += len; |
| 2759 | |
| 2760 | // Add ship name |
| 2761 | len = strlen(Ships[Players[which].ship_index].name) + 1; |
| 2762 | MultiAddByte(len, data, &count); |
| 2763 | memcpy(&data[count], Ships[Players[which].ship_index].name, len); |
| 2764 | count += len; |
| 2765 | |
| 2766 | // Add flags |
| 2767 | MultiAddInt(Players[which].flags, data, &count); |
| 2768 | MultiAddInt(NetPlayers[which].flags, data, &count); |
| 2769 | |
| 2770 | // Just for safety sake send the object number |
| 2771 | MultiAddShort(Players[which].objnum, data, &count); |
| 2772 | |
| 2773 | // Add the player's network address. |
| 2774 | memcpy(data + count, &NetPlayers[which].addr, sizeof(network_address)); |
| 2775 | count += sizeof(network_address); |
| 2776 | |
| 2777 | // Add pps |
| 2778 | MultiAddByte(NetPlayers[which].pps, data, &count); |
| 2779 | |
| 2780 | // pilot picture id |
| 2781 | MultiAddUshort(NetPlayers[which].pilot_pic_id, data, &count); |
| 2782 | |
| 2783 | // Add start position |
| 2784 | MultiAddShort(Players[which].start_index, data, &count); |
| 2785 | |
| 2786 | // Send ranking |
| 2787 | MultiAddFloat(Players[which].rank, data, &count); |
| 2788 | |
| 2789 | // Send tracker id |
| 2790 | if (Game_is_master_tracker_game) { |
| 2791 | int len = strlen(Players[which].tracker_id) + 1; |
| 2792 | MultiAddByte(len, data, &count); |
| 2793 | memcpy(&data[count], Players[which].tracker_id, len); |
| 2794 | count += len; |
| 2795 | } |
| 2796 | |
| 2797 | END_DATA(count, data, size_offset); |
| 2798 | |
| 2799 | // Send it out |
| 2800 |
no test coverage detected