From: Mikko Rasa Date: Sun, 11 Jun 2023 13:21:12 +0000 (+0300) Subject: Use Networking::set_state in start_server and connect_to_server X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=19eca3f3eccb9bfab3041d7a1805b69c9d1be9db;p=libs%2Fgame.git Use Networking::set_state in start_server and connect_to_server This gets the event appropriately emitted. --- diff --git a/source/game/networking.cpp b/source/game/networking.cpp index 30f6b48..fdc0095 100644 --- a/source/game/networking.cpp +++ b/source/game/networking.cpp @@ -25,8 +25,8 @@ void Networking::start_server(unsigned port) server_socket->signal_data_available.connect(sigc::mem_fun(this, &Networking::incoming_connection)); io_disp.add(*server_socket); - state = SERVER; next_id = 1; + set_state(SERVER); } void Networking::connect_to_server(const string &host) @@ -38,8 +38,8 @@ void Networking::connect_to_server(const string &host) connection = make_unique(*this, *addr); connection->get_communicator().signal_protocol_ready.connect(sigc::mem_fun(this, &Networking::protocol_ready)); - state = CONNECTING; next_id = ID_PENDING+1; + set_state(CONNECTING); } void Networking::disable()