[Tux4kids-commits] r1279 - tuxmath/branches/lan/server
akash gangil
gangil-guest at alioth.debian.org
Sun Jul 26 20:24:49 UTC 2009
Author: gangil-guest
Date: 2009-07-26 20:24:48 +0000 (Sun, 26 Jul 2009)
New Revision: 1279
Modified:
tuxmath/branches/lan/server/testclient.c
Log:
Can choose in between multiple servers via command line
Modified: tuxmath/branches/lan/server/testclient.c
===================================================================
--- tuxmath/branches/lan/server/testclient.c 2009-07-26 19:51:07 UTC (rev 1278)
+++ tuxmath/branches/lan/server/testclient.c 2009-07-26 20:24:48 UTC (rev 1279)
@@ -66,6 +66,7 @@
char buf[NET_BUF_LEN]; // for network messages from server
char buffer[NET_BUF_LEN]; // for command-line input
int servers_found = 0;
+ int server_number=-1;
Uint32 server_ip = 0;
Uint16 server_port = DEFAULT_PORT;
@@ -91,16 +92,25 @@
}
else // More than one server - will have to get player selection
{
- //Display list so player can choose
- // TO BE IMPLEMENTED
+ printf("Following are the server's available\n");
+ print_server_list();
+ printf("Enter the SERVER NUMBER you would like to connect to:\n");
+ scanf("%d",&server_number);
-
- /* Connect to server, create socket set, get player nickname, etc: */
- if(!LAN_Setup(server_ip, server_port))
+ if(!LAN_AutoSetup(server_number)) //i.e.first (and only) entry in list
{
printf("setup_client() failed - exiting.\n");
exit(EXIT_FAILURE);
}
+
+ printf("connected\n");
+
+// /* Connect to server, create socket set, get player nickname, etc: */
+// if(!LAN_Setup(server_ip, server_port))
+// {
+// printf("setup_client() failed - exiting.\n");
+// exit(EXIT_FAILURE);
+// }
}
@@ -521,4 +531,4 @@
}
//if we don't find a matching question:
return NULL;
-}
\ No newline at end of file
+}
More information about the Tux4kids-commits
mailing list