diff options
author | rubidium <rubidium@openttd.org> | 2009-05-19 21:20:14 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-19 21:20:14 +0000 |
commit | 9f4d64bda06a449e2b1c528e342be5bb12a1623b (patch) | |
tree | c7ae21e8a883df20254134a0e155ef468c61fef8 /src/console_cmds.cpp | |
parent | 00bc2659f24b07851291d56d170174ed27581bc7 (diff) | |
download | openttd-9f4d64bda06a449e2b1c528e342be5bb12a1623b.tar.xz |
(svn r16360) -Codechange: don't use _network_playas as a 'second' _local_company, but only as a storage location for the company you want to join in MP.
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r-- | src/console_cmds.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 66fa867e9..fc980a676 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -769,11 +769,6 @@ DEF_CONSOLE_CMD(ConNetworkClients) DEF_CONSOLE_CMD(ConNetworkConnect) { - char *ip; - const char *port = NULL; - const char *company = NULL; - uint16 rport; - if (argc == 0) { IConsoleHelp("Connect to a remote OTTD server and join the game. Usage: 'connect <ip>'"); IConsoleHelp("IP can contain port and company: 'IP[[#Company]:Port]', eg: 'server.ottd.org#2:443'"); @@ -784,23 +779,25 @@ DEF_CONSOLE_CMD(ConNetworkConnect) if (argc < 2) return false; if (_networking) NetworkDisconnect(); // we are in network-mode, first close it! - ip = argv[1]; + const char *port = NULL; + const char *company = NULL; + char *ip = argv[1]; /* Default settings: default port and new company */ - rport = NETWORK_DEFAULT_PORT; - _network_playas = COMPANY_NEW_COMPANY; + uint16 rport = NETWORK_DEFAULT_PORT; + CompanyID join_as = COMPANY_NEW_COMPANY; ParseConnectionString(&company, &port, ip); IConsolePrintF(CC_DEFAULT, "Connecting to %s...", ip); if (company != NULL) { - _network_playas = (CompanyID)atoi(company); - IConsolePrintF(CC_DEFAULT, " company-no: %d", _network_playas); + join_as = (CompanyID)atoi(company); + IConsolePrintF(CC_DEFAULT, " company-no: %d", join_as); /* From a user pov 0 is a new company, internally it's different and all * companies are offset by one to ease up on users (eg companies 1-8 not 0-7) */ - if (_network_playas != COMPANY_SPECTATOR) { - if (_network_playas > MAX_COMPANIES) return false; - _network_playas--; + if (join_as != COMPANY_SPECTATOR) { + if (join_as > MAX_COMPANIES) return false; + join_as--; } } if (port != NULL) { @@ -808,7 +805,7 @@ DEF_CONSOLE_CMD(ConNetworkConnect) IConsolePrintF(CC_DEFAULT, " port: %s", port); } - NetworkClientConnectGame(NetworkAddress(ip, rport)); + NetworkClientConnectGame(NetworkAddress(ip, rport), join_as); return true; } |