Fix non random client port (NetworkConfig initialized too early)
This commit is contained in:
parent
964757193b
commit
e1188c5532
@ -2031,6 +2031,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// ServerConfig will use stk_config for server version testing
|
// ServerConfig will use stk_config for server version testing
|
||||||
stk_config->load(file_manager->getAsset("stk_config.xml"));
|
stk_config->load(file_manager->getAsset("stk_config.xml"));
|
||||||
|
// Client port depends on user config file and stk_config
|
||||||
|
NetworkConfig::get()->initClientPort();
|
||||||
bool no_graphics = !CommandLine::has("--graphical-server");
|
bool no_graphics = !CommandLine::has("--graphical-server");
|
||||||
|
|
||||||
#ifndef SERVER_ONLY
|
#ifndef SERVER_ONLY
|
||||||
|
@ -67,14 +67,23 @@ NetworkConfig::NetworkConfig()
|
|||||||
m_done_adding_network_players = false;
|
m_done_adding_network_players = false;
|
||||||
m_cur_user_id = 0;
|
m_cur_user_id = 0;
|
||||||
m_cur_user_token = "";
|
m_cur_user_token = "";
|
||||||
m_client_port = UserConfigParams::m_random_client_port ?
|
m_client_port = 0;
|
||||||
0 : stk_config->m_client_port;
|
|
||||||
m_joined_server_version = 0;
|
m_joined_server_version = 0;
|
||||||
m_network_ai_tester = false;
|
m_network_ai_tester = false;
|
||||||
m_state_frequency = 10;
|
m_state_frequency = 10;
|
||||||
m_nat64_prefix_data.fill(-1);
|
m_nat64_prefix_data.fill(-1);
|
||||||
} // NetworkConfig
|
} // NetworkConfig
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Separated from constructor because this needs to be run after user config
|
||||||
|
* is load.
|
||||||
|
*/
|
||||||
|
void NetworkConfig::initClientPort()
|
||||||
|
{
|
||||||
|
m_client_port = UserConfigParams::m_random_client_port ?
|
||||||
|
0 : stk_config->m_client_port;
|
||||||
|
} // initClientPort
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Set that this is not a networked game.
|
/** Set that this is not a networked game.
|
||||||
*/
|
*/
|
||||||
|
@ -269,6 +269,8 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
const std::array<uint32_t, 8>& getNAT64PrefixData() const
|
const std::array<uint32_t, 8>& getNAT64PrefixData() const
|
||||||
{ return m_nat64_prefix_data; }
|
{ return m_nat64_prefix_data; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
void initClientPort();
|
||||||
}; // class NetworkConfig
|
}; // class NetworkConfig
|
||||||
|
|
||||||
#endif // HEADER_NETWORK_CONFIG
|
#endif // HEADER_NETWORK_CONFIG
|
||||||
|
Loading…
Reference in New Issue
Block a user