Mercurial > hg > openttd
diff src/openttd.cpp @ 11956:6ec97548e188 draft
(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.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 19 May 2009 21:20:14 +0000 |
parents | 92364e306ac7 |
children | fd10870d74d4 |
line wrap: on
line diff
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -675,26 +675,24 @@ if (network_conn != NULL) { const char *port = NULL; const char *company = NULL; - uint16 rport; - - rport = NETWORK_DEFAULT_PORT; - _network_playas = COMPANY_NEW_COMPANY; + uint16 rport = NETWORK_DEFAULT_PORT; + CompanyID join_as = COMPANY_NEW_COMPANY; ParseConnectionString(&company, &port, network_conn); if (company != NULL) { - _network_playas = (CompanyID)atoi(company); + join_as = (CompanyID)atoi(company); - if (_network_playas != COMPANY_SPECTATOR) { - _network_playas--; - if (_network_playas >= MAX_COMPANIES) return false; + if (join_as != COMPANY_SPECTATOR) { + join_as--; + if (join_as >= MAX_COMPANIES) return false; } } if (port != NULL) rport = atoi(port); LoadIntroGame(); _switch_mode = SM_NONE; - NetworkClientConnectGame(NetworkAddress(network_conn, rport)); + NetworkClientConnectGame(NetworkAddress(network_conn, rport), join_as); } } #endif /* ENABLE_NETWORK */ @@ -1197,8 +1195,7 @@ if (_network_reconnect > 0 && --_network_reconnect == 0) { /* This means that we want to reconnect to the last host * We do this here, because it means that the network is really closed */ - _network_playas = COMPANY_SPECTATOR; - NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); + NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), COMPANY_SPECTATOR); } /* Singleplayer */ StateGameLoop();