summaryrefslogtreecommitdiff
path: root/network_gui.c
diff options
context:
space:
mode:
authorsignde <signde@openttd.org>2004-09-12 16:03:40 +0000
committersignde <signde@openttd.org>2004-09-12 16:03:40 +0000
commit9be6a4cea40908a03b69c3d1e9bbf57397cc55ac (patch)
tree7563d73dbed05abd1cb41feb70d1069e7dde0202 /network_gui.c
parent99687cf513905a04ae18dfbcbe6fd13c6cbe9694 (diff)
downloadopenttd-9be6a4cea40908a03b69c3d1e9bbf57397cc55ac.tar.xz
(svn r215) -Feature: direct connect now allows selecting a port and a playername [ip/host]:[port]#[player]
Diffstat (limited to 'network_gui.c')
-rw-r--r--network_gui.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/network_gui.c b/network_gui.c
index 90a231dc4..e80c0b443 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -172,9 +172,35 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
break;
case WE_ON_EDIT_TEXT: {
- const byte *b = e->edittext.str;
- if (*b != 0)
- NetworkCoreConnectGame(b, _network_server_port);
+ byte *b = e->edittext.str;
+ if (*b != 0) {
+ byte * ip = NULL;
+ byte * port = NULL;
+ byte * player = NULL;
+ byte c;
+ uint16 rport;
+
+ rport = _network_server_port;
+ c = 0;
+ ip = b;
+
+ while (b[c] != 0) {
+ if (((char)b[c]) == '#') {
+ player = &b[c+1];
+ b[c] = 0;
+ }
+ if (((char)b[c]) == ':') {
+ port = &b[c+1];
+ b[c] = 0;
+ }
+ c++;
+ }
+
+ if (player!=NULL) _network_playas = atoi(player);
+ if (port!=NULL) rport = atoi(port);
+
+ NetworkCoreConnectGame(b, rport);
+ }
} break;
case WE_TICK: {