mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-13 07:10:57 +00:00
(svn r215) -Feature: direct connect now allows selecting a port and a playername [ip/host]:[port]#[player]
This commit is contained in:
parent
99687cf513
commit
9be6a4cea4
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user