# HG changeset patch # User signde # Date 2004-09-12 16:03:40 # Node ID 315143c5d296b144c6f0a60c4bb46a17a3942211 # Parent 7915f9302282aa0e095779e2322a4ce29e1c5e2c (svn r215) -Feature: direct connect now allows selecting a port and a playername [ip/host]:[port]#[player] diff --git a/network_gui.c b/network_gui.c --- a/network_gui.c +++ b/network_gui.c @@ -172,9 +172,35 @@ static void NetworkGameWindowWndProc(Win 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: {