ConnectionlessPacket Responses to broadcasts, etc
(NetworkPacket packet)
| 724 | * Responses to broadcasts, etc |
| 725 | */ |
| 726 | private static void CL_ConnectionlessPacket(NetworkPacket packet) { |
| 727 | |
| 728 | List<String> args = Cmd.TokenizeString(packet.connectionlessMessage, false); |
| 729 | |
| 730 | String c = args.get(0); |
| 731 | |
| 732 | Com.Println(packet.from + ": " + c); |
| 733 | |
| 734 | ConnectionlessCommand cmd = ConnectionlessCommand.fromString(c); |
| 735 | |
| 736 | // server connection |
| 737 | switch (cmd) { |
| 738 | case client_connect: |
| 739 | if (ClientGlobals.cls.state == Defines.ca_connected) { |
| 740 | Com.Printf("Dup connect received. Ignored.\n"); |
| 741 | break; |
| 742 | } |
| 743 | ClientGlobals.cls.netchan.setup(Defines.NS_CLIENT, packet.from, ClientGlobals.cls.quakePort); |
| 744 | ClientGlobals.cls.netchan.reliablePending.add(new StringCmdMessage(StringCmdMessage.NEW)); |
| 745 | ClientGlobals.cls.state = Defines.ca_connected; |
| 746 | break; |
| 747 | |
| 748 | // server responding to a status broadcast |
| 749 | case info: |
| 750 | ParseStatusMessage(packet.from, packet.connectionlessParameters); |
| 751 | break; |
| 752 | |
| 753 | // print command from somewhere |
| 754 | case print: |
| 755 | if (packet.connectionlessParameters.length() > 0) |
| 756 | Com.Printf(packet.connectionlessParameters); |
| 757 | break; |
| 758 | |
| 759 | // ping from somewhere |
| 760 | case ping: |
| 761 | Netchan.sendConnectionlessPacket(Defines.NS_CLIENT, packet.from, ConnectionlessCommand.ack, ""); |
| 762 | break; |
| 763 | |
| 764 | // challenge from the server we are connecting to |
| 765 | case challenge: |
| 766 | ClientGlobals.cls.challenge = Lib.atoi(args.get(1)); |
| 767 | SendConnectPacket(); |
| 768 | break; |
| 769 | |
| 770 | default: |
| 771 | Com.Printf("Unknown ServerConnectionlessCommand: " + c + '\n'); |
| 772 | break; |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | |
| 777 | /** |
no test coverage detected