equal
deleted
inserted
replaced
32 // Function: Sends info about a client |
32 // Function: Sends info about a client |
33 // Data: |
33 // Data: |
34 // uint16: The index of the client (always unique on a server. 1 = server) |
34 // uint16: The index of the client (always unique on a server. 1 = server) |
35 // uint8: As which player the client is playing |
35 // uint8: As which player the client is playing |
36 // String: The name of the client |
36 // String: The name of the client |
|
37 // String: The unique id of the client |
37 // |
38 // |
38 |
39 |
39 Packet *p; |
40 Packet *p; |
40 |
41 |
41 if (ci->client_index != NETWORK_EMPTY_INDEX) { |
42 if (ci->client_index != NETWORK_EMPTY_INDEX) { |
42 p = NetworkSend_Init(PACKET_SERVER_CLIENT_INFO); |
43 p = NetworkSend_Init(PACKET_SERVER_CLIENT_INFO); |
43 NetworkSend_uint16(p, ci->client_index); |
44 NetworkSend_uint16(p, ci->client_index); |
44 NetworkSend_uint8 (p, ci->client_playas); |
45 NetworkSend_uint8 (p, ci->client_playas); |
45 NetworkSend_string(p, ci->client_name); |
46 NetworkSend_string(p, ci->client_name); |
|
47 NetworkSend_string(p, ci->unique_id); |
46 |
48 |
47 NetworkSend_Packet(p, cs); |
49 NetworkSend_Packet(p, cs); |
48 } |
50 } |
49 } |
51 } |
50 |
52 |
562 } |
564 } |
563 |
565 |
564 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN) |
566 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN) |
565 { |
567 { |
566 char name[NETWORK_NAME_LENGTH]; |
568 char name[NETWORK_NAME_LENGTH]; |
|
569 char unique_id[NETWORK_NAME_LENGTH]; |
567 NetworkClientInfo *ci; |
570 NetworkClientInfo *ci; |
568 char test_name[NETWORK_NAME_LENGTH]; |
571 char test_name[NETWORK_NAME_LENGTH]; |
569 byte playas; |
572 byte playas; |
570 NetworkLanguage client_lang; |
573 NetworkLanguage client_lang; |
571 char client_revision[NETWORK_REVISION_LENGTH]; |
574 char client_revision[NETWORK_REVISION_LENGTH]; |
587 #endif |
590 #endif |
588 |
591 |
589 NetworkRecv_string(p, name, sizeof(name)); |
592 NetworkRecv_string(p, name, sizeof(name)); |
590 playas = NetworkRecv_uint8(p); |
593 playas = NetworkRecv_uint8(p); |
591 client_lang = NetworkRecv_uint8(p); |
594 client_lang = NetworkRecv_uint8(p); |
|
595 NetworkRecv_string(p, unique_id, sizeof(unique_id)); |
592 |
596 |
593 // Check if someone else already has that name |
597 // Check if someone else already has that name |
594 snprintf(test_name, sizeof(test_name), "%s", name); |
598 snprintf(test_name, sizeof(test_name), "%s", name); |
595 |
599 |
596 if (test_name[0] == '\0') { |
600 if (test_name[0] == '\0') { |
605 } |
609 } |
606 |
610 |
607 ci = DEREF_CLIENT_INFO(cs); |
611 ci = DEREF_CLIENT_INFO(cs); |
608 |
612 |
609 snprintf(ci->client_name, sizeof(ci->client_name), "%s", test_name); |
613 snprintf(ci->client_name, sizeof(ci->client_name), "%s", test_name); |
|
614 snprintf(ci->unique_id, sizeof(ci->unique_id), "%s", unique_id); |
610 ci->client_playas = playas; |
615 ci->client_playas = playas; |
611 ci->client_lang = client_lang; |
616 ci->client_lang = client_lang; |
612 |
617 |
613 // We now want a password from the client |
618 // We now want a password from the client |
614 // else we do not allow him in! |
619 // else we do not allow him in! |