Tell a client about the objects Server only
| 2463 | // Tell a client about the objects |
| 2464 | // Server only |
| 2465 | void MultiDoRequestWorldStates(uint8_t *data) { |
| 2466 | int count = 0; |
| 2467 | |
| 2468 | // Skip header stuff |
| 2469 | SKIP_HEADER(data, &count); |
| 2470 | uint8_t slot = MultiGetByte(data, &count); |
| 2471 | |
| 2472 | uint8_t rxdigest[16]; |
| 2473 | for (int i = 0; i < 16; i++) { |
| 2474 | rxdigest[i] = MultiGetByte(data, &count); |
| 2475 | } |
| 2476 | |
| 2477 | char dbgmsg[1024]; |
| 2478 | char expectedstr[50] = ""; |
| 2479 | char gotstr[50] = ""; |
| 2480 | for (int j = 0; j < 16; j++) { |
| 2481 | char bstr[10]; |
| 2482 | snprintf(bstr, sizeof(bstr), "%.2x", rxdigest[j] & 0xff); |
| 2483 | strcat(gotstr, bstr); |
| 2484 | snprintf(bstr, sizeof(bstr), "%.2x", NetPlayers[slot].digest[j] & 0xff); |
| 2485 | strcat(expectedstr, bstr); |
| 2486 | } |
| 2487 | snprintf(dbgmsg, sizeof(dbgmsg), "Expected %s for the digest, got %s for player %d\n", expectedstr, gotstr, slot); |
| 2488 | |
| 2489 | for (int i = 0; i < 16; i++) { |
| 2490 | // We got the digest from the player previously. Now see if it matches. |
| 2491 | if (rxdigest[i] != NetPlayers[slot].digest[i]) { |
| 2492 | // send 'bad checksum message.' |
| 2493 | MultiSendBadChecksum(slot); |
| 2494 | |
| 2495 | // Bad checksum, kick the player out. |
| 2496 | NetPlayers[slot].sequence = NETSEQ_PREGAME; |
| 2497 | NetPlayers[slot].flags |= NPF_CONNECTED; |
| 2498 | return; |
| 2499 | } |
| 2500 | } |
| 2501 | if (!(NetPlayers[slot].flags & NPF_CONNECTED)) { |
| 2502 | mprintf(1, "ERROR! We got a request world states packet from a disconnected player!\n"); |
| 2503 | Int3(); // Get Jason |
| 2504 | return; |
| 2505 | } |
| 2506 | |
| 2507 | NetPlayers[slot].sequence = NETSEQ_REQUEST_WORLD; |
| 2508 | } |
| 2509 | |
| 2510 | // The server is telling me about a player in the game |
| 2511 | // Client only |
no test coverage detected