Merge pull request #122 from mjkzy/develop

/reconnect changes
This commit is contained in:
Maurice Heumann 2021-04-25 20:21:09 +02:00 committed by GitHub
commit 4c75728575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ namespace party
{
game::netadr_s host{};
std::string challenge{};
bool hostDefined{false};
} connect_state;
std::string sv_motd;
@ -186,6 +187,7 @@ namespace party
connect_state.host = target;
connect_state.challenge = utils::cryptography::random::get_challenge();
connect_state.hostDefined = true;
network::send(target, "getInfo", connect_state.challenge);
}
@ -309,6 +311,11 @@ namespace party
command::add("reconnect", [](const command::params& argument)
{
if (!connect_state.hostDefined)
{
console::info("Cannot connect to server.\n");
return;
}
connect(connect_state.host);
});