]> git.tdb.fi Git - libs/game.git/commitdiff
Use Networking::set_state in start_server and connect_to_server
authorMikko Rasa <tdb@tdb.fi>
Sun, 11 Jun 2023 13:21:12 +0000 (16:21 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 11 Jun 2023 14:13:56 +0000 (17:13 +0300)
This gets the event appropriately emitted.

source/game/networking.cpp

index 30f6b484cb0be6d510c839bc9efe6d03ed12dea2..fdc0095a2ac9ef695f35bc7352af6946b5881962 100644 (file)
@@ -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<ServerConnection>(*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()