From 34dad96017330d592d39aaa703b0419772b918b0 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 8 Dec 2015 17:25:19 +1100 Subject: [PATCH] Minor code cleanup. --- src/network/protocols/start_game_protocol.hpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/network/protocols/start_game_protocol.hpp b/src/network/protocols/start_game_protocol.hpp index fb906a41e..64eb27c9b 100644 --- a/src/network/protocols/start_game_protocol.hpp +++ b/src/network/protocols/start_game_protocol.hpp @@ -11,15 +11,25 @@ class NetworkPlayerProfile; */ class StartGameProtocol : public Protocol { -protected: - enum STATE { NONE, SYNCHRONIZATION_WAIT, LOADING, READY, EXITING }; +private: + /** State for the finite state machine, and also for + * remote clients. */ + enum STATE { NONE, SYNCHRONIZATION_WAIT, + LOADING, READY, EXITING }; + + /** State of the finite state machine. */ + STATE m_state; + + /** Keeps the state for all clients. */ std::map m_player_states; + /** Stores a handy pointer to the game setup structure. */ GameSetup* m_game_setup; - int m_ready_count; - double m_sending_time; - STATE m_state; + /** Counts how many clients have reported to be ready (which is then + * used to trigger the next state one all clients are ready). */ + int m_ready_count; + bool m_ready; public: