| 2646 | void MultiSendNewPlayer(int slot) {} |
| 2647 | |
| 2648 | void MultiDoPlayerEnteredGame(uint8_t *data) { |
| 2649 | int count = 0; |
| 2650 | char ship_name[PAGENAME_LEN]; |
| 2651 | int length; |
| 2652 | |
| 2653 | mprintf(0, "Got player entered game packet!\n"); |
| 2654 | |
| 2655 | // Skip header stuff |
| 2656 | SKIP_HEADER(data, &count); |
| 2657 | |
| 2658 | // Get slot number for this player |
| 2659 | uint8_t slot = MultiGetByte(data, &count); |
| 2660 | |
| 2661 | if (slot > MAX_PLAYERS) |
| 2662 | return; |
| 2663 | |
| 2664 | ScoreAPIPlayerJoin(slot); |
| 2665 | // get name |
| 2666 | uint8_t len = MultiGetByte(data, &count); |
| 2667 | |
| 2668 | if (len > CALLSIGN_LEN) |
| 2669 | length = CALLSIGN_LEN; |
| 2670 | else |
| 2671 | length = len; |
| 2672 | |
| 2673 | memcpy(Players[slot].callsign, &data[count], length); |
| 2674 | count += len; |
| 2675 | |
| 2676 | // get ship name |
| 2677 | len = MultiGetByte(data, &count); |
| 2678 | memcpy(ship_name, &data[count], len); |
| 2679 | count += len; |
| 2680 | |
| 2681 | int ship_index = FindShipName(ship_name); |
| 2682 | if (ship_index < 0) |
| 2683 | ship_index = 0; |
| 2684 | |
| 2685 | // Get various flags |
| 2686 | Players[slot].flags = MultiGetInt(data, &count); |
| 2687 | NetPlayers[slot].flags = MultiGetInt(data, &count); |
| 2688 | |
| 2689 | // Verify object number |
| 2690 | int objnum = MultiGetShort(data, &count); |
| 2691 | |
| 2692 | MULTI_ASSERT(objnum == Players[slot].objnum, NULL); |
| 2693 | MULTI_ASSERT(Objects[objnum].id == slot, NULL); |
| 2694 | |
| 2695 | // Get the player's network address |
| 2696 | memcpy(&NetPlayers[slot].addr, data + count, sizeof(network_address)); |
| 2697 | count += sizeof(network_address); |
| 2698 | |
| 2699 | // Get PPS |
| 2700 | NetPlayers[slot].pps = MultiGetByte(data, &count); |
| 2701 | |
| 2702 | // pilot picture id |
| 2703 | NetPlayers[slot].pilot_pic_id = MultiGetUshort(data, &count); |
| 2704 | |
| 2705 | Players[slot].start_index = MultiGetShort(data, &count); |
no test coverage detected