Tell the server about my info, such as name, ship type, etc
| 157 | |
| 158 | // Tell the server about my info, such as name, ship type, etc |
| 159 | void MultiSendMyInfo() { |
| 160 | int size; |
| 161 | uint8_t data[MAX_GAME_DATA_SIZE]; |
| 162 | int count = 0; |
| 163 | |
| 164 | mprintf(0, "Sending my info\n"); |
| 165 | char pshipmodel[PAGENAME_LEN]; |
| 166 | Current_pilot.get_ship(pshipmodel); |
| 167 | |
| 168 | int ship_index = FindShipName(pshipmodel); |
| 169 | if (ship_index < 0) |
| 170 | ship_index = 0; |
| 171 | |
| 172 | size = START_DATA(MP_MY_INFO, data, &count); |
| 173 | |
| 174 | // Do callsign name |
| 175 | MultiAddByte(Player_num, data, &count); |
| 176 | int len = strlen(Players[Player_num].callsign) + 1; |
| 177 | MultiAddByte(len, data, &count); |
| 178 | memcpy(&data[count], Players[Player_num].callsign, len); |
| 179 | count += len; |
| 180 | |
| 181 | // Do ship name |
| 182 | len = strlen(Ships[ship_index].name) + 1; |
| 183 | MultiAddByte(len, data, &count); |
| 184 | memcpy(&data[count], Ships[ship_index].name, len); |
| 185 | count += len; |
| 186 | |
| 187 | if (Game_is_master_tracker_game) { |
| 188 | MultiAddUint(MASTER_TRACKER_SIG, data, &count); |
| 189 | strcpy(Players[Player_num].tracker_id, Tracker_id); |
| 190 | len = strlen(Players[Player_num].tracker_id) + 1; |
| 191 | MultiAddByte(len, data, &count); |
| 192 | memcpy(&data[count], Players[Player_num].tracker_id, len); |
| 193 | count += len; |
| 194 | } |
| 195 | int ser = 0; |
| 196 | GetInternalSerializationNumber(&ser); |
| 197 | MultiAddInt(ser, data, &count); |
| 198 | |
| 199 | // Send packets per second |
| 200 | int pps = nw_ReccomendPPS(); |
| 201 | if ((Netgame.flags & NF_PERMISSABLE) && pps < 8) |
| 202 | pps = 8; // If permissable game, can't be lower than 8 |
| 203 | |
| 204 | MultiAddByte(pps, data, &count); |
| 205 | |
| 206 | // pilot picture id |
| 207 | uint16_t ppic_id; |
| 208 | Current_pilot.get_multiplayer_data(NULL, NULL, NULL, &ppic_id); |
| 209 | MultiAddUshort(ppic_id, data, &count); |
| 210 | |
| 211 | // Copy the guidebot name out |
| 212 | char guidebot_name[32]; |
| 213 | Current_pilot.get_guidebot_name(guidebot_name); |
| 214 | len = strlen(guidebot_name) + 1; |
| 215 | MultiAddByte(len, data, &count); |
| 216 | memcpy(&data[count], guidebot_name, len); |
no test coverage detected