From 6297d8c65d04d89100b964663cd04a43d772b59b Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 27 Oct 2015 08:23:59 +1100 Subject: [PATCH] Removed NetworkManager and ClientNetworkManager. --- sources.cmake | 2 +- src/items/item_manager.cpp | 2 +- src/karts/kart.cpp | 2 +- src/main.cpp | 8 +- src/modes/standard_race.cpp | 2 +- src/network/client_network_manager.cpp | 114 ------------------ src/network/client_network_manager.hpp | 64 ---------- src/network/event.cpp | 3 +- src/network/network_interface.hpp | 1 - src/network/network_manager.cpp | 33 ----- src/network/network_manager.hpp | 66 ---------- src/network/network_world.cpp | 2 +- src/network/protocol.cpp | 3 +- src/network/protocol_manager.cpp | 3 +- .../protocols/client_lobby_room_protocol.cpp | 4 +- src/network/protocols/connect_to_peer.cpp | 1 - src/network/protocols/connect_to_server.cpp | 1 - .../protocols/controller_events_protocol.cpp | 4 +- .../protocols/game_events_protocol.cpp | 4 +- src/network/protocols/get_peer_address.cpp | 2 +- src/network/protocols/get_public_address.cpp | 4 +- src/network/protocols/ping_protocol.cpp | 2 +- src/network/protocols/quick_join_protocol.cpp | 2 +- .../protocols/server_lobby_room_protocol.cpp | 4 +- src/network/protocols/show_public_address.cpp | 2 +- src/network/protocols/start_game_protocol.cpp | 3 +- src/network/protocols/start_server.cpp | 2 +- src/network/protocols/stop_server.cpp | 2 +- .../protocols/synchronization_protocol.cpp | 3 +- src/network/server_console.cpp | 6 +- src/network/stk_host.cpp | 7 +- src/network/stk_host.hpp | 2 +- src/network/stk_peer.cpp | 2 +- .../dialogs/race_paused_dialog.cpp | 1 - .../dialogs/select_challenge.cpp | 1 - src/states_screens/network_kart_selection.cpp | 2 +- 36 files changed, 46 insertions(+), 320 deletions(-) delete mode 100644 src/network/client_network_manager.cpp delete mode 100644 src/network/client_network_manager.hpp delete mode 100644 src/network/network_manager.cpp delete mode 100644 src/network/network_manager.hpp diff --git a/sources.cmake b/sources.cmake index 30bc85848..e63fbe6de 100644 --- a/sources.cmake +++ b/sources.cmake @@ -1,5 +1,5 @@ # Modify this file to change the last-modified date when you add/remove a file. -# This will then trigger a new cmake run automatically. +# This will then trigger a new cmake run automatically. file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp") file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp") file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*") diff --git a/src/items/item_manager.cpp b/src/items/item_manager.cpp index 32e7c695e..5361556a9 100644 --- a/src/items/item_manager.cpp +++ b/src/items/item_manager.cpp @@ -29,8 +29,8 @@ #include "io/file_manager.hpp" #include "karts/abstract_kart.hpp" #include "modes/linear_world.hpp" -#include "network/network_manager.hpp" #include "network/network_world.hpp" +#include "network/stk_host.hpp" #include "tracks/quad_graph.hpp" #include "tracks/track.hpp" #include "utils/string_utils.hpp" diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 216d5ec6c..202fc9bd7 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -55,7 +55,7 @@ #include "karts/skidding.hpp" #include "modes/linear_world.hpp" #include "network/network_world.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "physics/btKart.hpp" #include "physics/btKartRaycast.hpp" #include "physics/physics.hpp" diff --git a/src/main.cpp b/src/main.cpp index 5d2adc3eb..e08f63f54 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,12 +174,7 @@ #include "karts/kart_properties_manager.hpp" #include "modes/demo_world.hpp" #include "modes/profile_world.hpp" -#include "network/network_manager.hpp" -#include "network/protocol_manager.hpp" -#include "network/protocols/server_lobby_room_protocol.hpp" -#include "network/server_console.hpp" -#include "network/protocol_manager.hpp" -#include "network/protocols/server_lobby_room_protocol.hpp" +#include "network/stk_host.hpp" #include "online/profile_manager.hpp" #include "online/request_manager.hpp" #include "online/servers_manager.hpp" @@ -1623,7 +1618,6 @@ static void cleanSuperTuxKart() // moved further up? Online::ServersManager::deallocate(); STKHost::destroy(); - NetworkManager::kill(); cleanUserConfig(); diff --git a/src/modes/standard_race.cpp b/src/modes/standard_race.cpp index 2ee18938f..7282e5a7a 100644 --- a/src/modes/standard_race.cpp +++ b/src/modes/standard_race.cpp @@ -21,7 +21,7 @@ #include "items/powerup_manager.hpp" #include "karts/abstract_kart.hpp" #include "karts/controller/controller.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" //----------------------------------------------------------------------------- StandardRace::StandardRace() : LinearWorld() diff --git a/src/network/client_network_manager.cpp b/src/network/client_network_manager.cpp deleted file mode 100644 index 60ca5c4dd..000000000 --- a/src/network/client_network_manager.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2013-2015 SuperTuxKart-Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include "network/client_network_manager.hpp" - -#include "network/protocols/get_public_address.hpp" -#include "network/protocols/hide_public_address.hpp" -#include "network/protocols/show_public_address.hpp" -#include "network/protocols/get_peer_address.hpp" -#include "network/protocols/connect_to_server.hpp" -#include "network/protocols/client_lobby_room_protocol.hpp" -#include "network/protocols/synchronization_protocol.hpp" -#include "network/stk_host.hpp" - -#include "utils/log.hpp" - -#include -#include -#include - -void* waitInput(void* data) -{ - std::string str = ""; - bool stop = false; - - while(!stop) - { - getline(std::cin, str); - if (str == "quit") - { - stop = true; - } - } - - exit(0); - - return NULL; -} - -ClientNetworkManager::ClientNetworkManager() -{ - m_thread_keyboard = NULL; - m_connected = false; -} - -ClientNetworkManager::~ClientNetworkManager() -{ - // On windows in release mode there is no console, and the - // thread is not created. - if(m_thread_keyboard) - pthread_cancel(*m_thread_keyboard); -} - -void ClientNetworkManager::run() -{ - if (enet_initialize() != 0) - { - Log::error("ClientNetworkManager", "Could not initialize enet.\n"); - return; - } - STKHost::get()->setupClient(1, 2, 0, 0); - STKHost::get()->startListening(); - - Log::info("ClientNetworkManager", "Host initialized."); - - m_thread_keyboard = NULL; - // This code can cause crashes atm (see #1529): if the - // client_network_manager receives input after the network manager - // has been deleted, stk will crash. And this happens on windows - // in release mode (since there is no console, so no stdin), and - // apparently on osx at shutdown time - getline returns an empty string - // (not sure if it has an error condition). -#ifdef RE_ENABLE_LATER - // On windows in release mode the console is suppressed, so nothing can - // be read from std::cin. Since getline(std::cin,...) then returns - // an empty string, the waitInput thread is running all the time, consuming - // CPU. Therefore don't start the console thread in this case. -#if defined(WIN32) && defined(_MSC_VER) && !defined(DEBUG) - m_thread_keyboard = NULL; -#else - // listen keyboard console input - m_thread_keyboard = (pthread_t*)(malloc(sizeof(pthread_t))); - pthread_create(m_thread_keyboard, NULL, waitInput, NULL); -#endif -#endif - - Log::info("ClientNetworkManager", "Ready !"); -} - -void ClientNetworkManager::reset() -{ - STKHost::get()->reset(); - - m_connected = false; - STKHost::create(/*is_server*/false); - STKHost::get()->setupClient(1, 2, 0, 0); - STKHost::get()->startListening(); - -} diff --git a/src/network/client_network_manager.hpp b/src/network/client_network_manager.hpp deleted file mode 100644 index 6cffbd6ed..000000000 --- a/src/network/client_network_manager.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2013-2015 SuperTuxKart-Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -/*! \file client_network_manager.hpp - * \brief Defines a Client Network manager, that will connect to a server. - */ - -#ifndef CLIENT_NETWORK_MANAGER_HPP -#define CLIENT_NETWORK_MANAGER_HPP - -#include "pthread.h" - -class STKPeer; - -/*! \class ClientNetworkManager - * \ingroup network - */ -class ClientNetworkManager -{ - public: - /*! \brief Initializes network. - * This starts the threads and initializes network libraries. - */ - virtual void run(); - /*! \brief Resets the network socket. */ - virtual void reset(); - - /*! \brief Get the peer (the server) - * \return The peer with whom we're connected (if it exists). NULL elseway. - */ - STKPeer* getPeer(); - /*! \brief Function used to notice the manager that we're connected to a server. - * \param value : True if we're connected, false elseway. - */ - void setConnected(bool value) { m_connected = value; } - /*! \brief Function to know if we're a server. - * \return Returns true if we're on a server. False if we're a client. - */ - bool isConnected() { return m_connected; } - - protected: - ClientNetworkManager(); - virtual ~ClientNetworkManager(); - - bool m_connected; //!< Is the user connected to a server - pthread_t* m_thread_keyboard; //!< The thread listening for keyboard console input. -}; - -#endif // CLIENT_NETWORK_MANAGER_HPP diff --git a/src/network/event.cpp b/src/network/event.cpp index 4d80aa4bd..3db7c6955 100644 --- a/src/network/event.cpp +++ b/src/network/event.cpp @@ -17,8 +17,9 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "network/event.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "utils/log.hpp" #include diff --git a/src/network/network_interface.hpp b/src/network/network_interface.hpp index 180fd9e49..b41339029 100644 --- a/src/network/network_interface.hpp +++ b/src/network/network_interface.hpp @@ -24,7 +24,6 @@ #define NETWORK_INTERFACE_H #include "network/types.hpp" -#include "network/network_manager.hpp" #include "utils/singleton.hpp" #include diff --git a/src/network/network_manager.cpp b/src/network/network_manager.cpp deleted file mode 100644 index 47df2f1c9..000000000 --- a/src/network/network_manager.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2013-2015 SuperTuxKart-Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include "network/network_manager.hpp" - -#include "network/event.hpp" -#include "network/game_setup.hpp" -#include "network/protocol_manager.hpp" -#include "utils/log.hpp" - -#include -#include - -//----------------------------------------------------------------------------- - -NetworkManager::NetworkManager() -{ -} // NetworkManager diff --git a/src/network/network_manager.hpp b/src/network/network_manager.hpp deleted file mode 100644 index 7333ee436..000000000 --- a/src/network/network_manager.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2013-2015 SuperTuxKart-Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -/*! \file network_manager.hpp - * \brief Instantiates the generic functionnalities of a network manager. - */ - -#ifndef NETWORKMANAGER_HPP -#define NETWORKMANAGER_HPP - -#include "network/stk_peer.hpp" -#include "network/stk_host.hpp" - -#include "network/protocol_manager.hpp" -#include "network/types.hpp" -#include "utils/singleton.hpp" -#include "utils/synchronised.hpp" - -#include - -class Event; -class GameSetup; - -/** \class NetworkManager - * \brief Gives the general functions to use network communication. - * This class is in charge of storing the peers connected to this host. - * It also stores the host, and brings the functions to send messages to peers. - * It automatically dispatches the events or packets it receives. This class - * also stores the public address when known and the player login. - * Here are defined some functions that will be specifically implemented by - * the ServerNetworkManager and the ClientNetworkManager. - */ -class NetworkManager : public AbstractSingleton -{ -protected: - NetworkManager(); - virtual ~NetworkManager() {}; - - -private: - - PlayerLogin m_player_login; - - - friend class AbstractSingleton; -public: - - -}; // class NetworkManager - -#endif // NETWORKMANAGER_HPP diff --git a/src/network/network_world.cpp b/src/network/network_world.cpp index 11934b28e..1a1c8357d 100644 --- a/src/network/network_world.cpp +++ b/src/network/network_world.cpp @@ -1,10 +1,10 @@ #include "network/network_world.hpp" -#include "network/network_manager.hpp" #include "network/protocol_manager.hpp" #include "network/protocols/synchronization_protocol.hpp" #include "network/protocols/controller_events_protocol.hpp" #include "network/protocols/game_events_protocol.hpp" +#include "network/stk_host.hpp" #include "modes/world.hpp" #include "karts/controller/controller.hpp" diff --git a/src/network/protocol.cpp b/src/network/protocol.cpp index 804ee94c9..05a5d48e6 100644 --- a/src/network/protocol.cpp +++ b/src/network/protocol.cpp @@ -19,8 +19,9 @@ #include "network/protocol.hpp" #include "network/event.hpp" -#include "network/network_manager.hpp" #include "network/protocol_manager.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" /** \brief Constructor * Sets the basic protocol parameters, as the callback object and the diff --git a/src/network/protocol_manager.cpp b/src/network/protocol_manager.cpp index c4eb41ca0..1df873e30 100644 --- a/src/network/protocol_manager.cpp +++ b/src/network/protocol_manager.cpp @@ -19,8 +19,9 @@ #include "network/protocol_manager.hpp" #include "network/event.hpp" -#include "network/network_manager.hpp" #include "network/protocol.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "utils/log.hpp" #include "utils/time.hpp" diff --git a/src/network/protocols/client_lobby_room_protocol.cpp b/src/network/protocols/client_lobby_room_protocol.cpp index bb0d5ab23..cc4060156 100644 --- a/src/network/protocols/client_lobby_room_protocol.cpp +++ b/src/network/protocols/client_lobby_room_protocol.cpp @@ -21,9 +21,11 @@ #include "config/player_manager.hpp" #include "modes/world_with_rank.hpp" #include "network/event.hpp" -#include "network/network_manager.hpp" #include "network/network_world.hpp" #include "network/protocols/start_game_protocol.hpp" +#include "network/protocol_manager.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "online/online_profile.hpp" #include "states_screens/network_kart_selection.hpp" #include "states_screens/state_manager.hpp" diff --git a/src/network/protocols/connect_to_peer.cpp b/src/network/protocols/connect_to_peer.cpp index 34286986a..12b63cce0 100644 --- a/src/network/protocols/connect_to_peer.cpp +++ b/src/network/protocols/connect_to_peer.cpp @@ -18,7 +18,6 @@ #include "network/protocols/connect_to_peer.hpp" -#include "network/client_network_manager.hpp" #include "network/event.hpp" #include "network/protocols/get_public_address.hpp" #include "network/protocols/get_peer_address.hpp" diff --git a/src/network/protocols/connect_to_server.cpp b/src/network/protocols/connect_to_server.cpp index d80853fb6..3b28a7cb0 100644 --- a/src/network/protocols/connect_to_server.cpp +++ b/src/network/protocols/connect_to_server.cpp @@ -18,7 +18,6 @@ #include "network/protocols/connect_to_server.hpp" -#include "network/client_network_manager.hpp" #include "network/event.hpp" #include "network/protocols/get_public_address.hpp" #include "network/protocols/get_peer_address.hpp" diff --git a/src/network/protocols/controller_events_protocol.cpp b/src/network/protocols/controller_events_protocol.cpp index f77d28bd4..ba65054d5 100644 --- a/src/network/protocols/controller_events_protocol.cpp +++ b/src/network/protocols/controller_events_protocol.cpp @@ -5,8 +5,10 @@ #include "karts/controller/controller.hpp" #include "network/event.hpp" #include "network/game_setup.hpp" -#include "network/network_manager.hpp" #include "network/network_world.hpp" +#include "network/protocol_manager.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "utils/log.hpp" //----------------------------------------------------------------------------- diff --git a/src/network/protocols/game_events_protocol.cpp b/src/network/protocols/game_events_protocol.cpp index 44c1c174b..d071fd138 100644 --- a/src/network/protocols/game_events_protocol.cpp +++ b/src/network/protocols/game_events_protocol.cpp @@ -8,7 +8,9 @@ #include "modes/world.hpp" #include "network/event.hpp" #include "network/game_setup.hpp" -#include "network/network_manager.hpp" +#include "network/protocol_manager.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include diff --git a/src/network/protocols/get_peer_address.cpp b/src/network/protocols/get_peer_address.cpp index 8cdf30ae4..e70a29fd6 100644 --- a/src/network/protocols/get_peer_address.cpp +++ b/src/network/protocols/get_peer_address.cpp @@ -21,7 +21,7 @@ #include "config/player_manager.hpp" #include "config/user_config.hpp" #include "network/protocol_manager.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "online/request_manager.hpp" #include "utils/log.hpp" diff --git a/src/network/protocols/get_public_address.cpp b/src/network/protocols/get_public_address.cpp index 1ddf9ee03..3c5a488b6 100644 --- a/src/network/protocols/get_public_address.cpp +++ b/src/network/protocols/get_public_address.cpp @@ -19,10 +19,10 @@ #include "network/protocols/get_public_address.hpp" #include "config/user_config.hpp" -#include "network/client_network_manager.hpp" +#include "network/network.hpp" #include "network/network_interface.hpp" -#include "network/network_manager.hpp" #include "network/protocols/connect_to_server.hpp" +#include "network/stk_host.hpp" #include "utils/log.hpp" #include diff --git a/src/network/protocols/ping_protocol.cpp b/src/network/protocols/ping_protocol.cpp index 919f4748e..15b6790d5 100644 --- a/src/network/protocols/ping_protocol.cpp +++ b/src/network/protocols/ping_protocol.cpp @@ -18,7 +18,7 @@ #include "network/protocols/ping_protocol.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "utils/time.hpp" PingProtocol::PingProtocol(const TransportAddress& ping_dst, double delay_between_pings) diff --git a/src/network/protocols/quick_join_protocol.cpp b/src/network/protocols/quick_join_protocol.cpp index b3bf54ded..515438474 100644 --- a/src/network/protocols/quick_join_protocol.cpp +++ b/src/network/protocols/quick_join_protocol.cpp @@ -20,7 +20,7 @@ #include "config/player_manager.hpp" #include "config/user_config.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "online/request_manager.hpp" #include "utils/log.hpp" diff --git a/src/network/protocols/server_lobby_room_protocol.cpp b/src/network/protocols/server_lobby_room_protocol.cpp index 88b941829..998753397 100644 --- a/src/network/protocols/server_lobby_room_protocol.cpp +++ b/src/network/protocols/server_lobby_room_protocol.cpp @@ -22,14 +22,16 @@ #include "config/user_config.hpp" #include "modes/world.hpp" #include "network/event.hpp" -#include "network/network_manager.hpp" #include "network/network_world.hpp" #include "network/protocols/get_public_address.hpp" #include "network/protocols/show_public_address.hpp" #include "network/protocols/connect_to_peer.hpp" #include "network/protocols/start_server.hpp" #include "network/protocols/start_game_protocol.hpp" +#include "network/protocol_manager.hpp" #include "network/server_console.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "online/online_profile.hpp" #include "online/request_manager.hpp" #include "utils/log.hpp" diff --git a/src/network/protocols/show_public_address.cpp b/src/network/protocols/show_public_address.cpp index a5d7d3084..5db5799a0 100644 --- a/src/network/protocols/show_public_address.cpp +++ b/src/network/protocols/show_public_address.cpp @@ -20,7 +20,7 @@ #include "config/player_manager.hpp" #include "config/user_config.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "online/request_manager.hpp" #include "utils/log.hpp" diff --git a/src/network/protocols/start_game_protocol.cpp b/src/network/protocols/start_game_protocol.cpp index f5defff6e..be9349293 100644 --- a/src/network/protocols/start_game_protocol.cpp +++ b/src/network/protocols/start_game_protocol.cpp @@ -8,10 +8,11 @@ #include "modes/world.hpp" #include "network/event.hpp" #include "network/game_setup.hpp" -#include "network/network_manager.hpp" #include "network/network_world.hpp" #include "network/protocol_manager.hpp" #include "network/protocols/synchronization_protocol.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "online/online_profile.hpp" #include "race/race_manager.hpp" #include "states_screens/kart_selection.hpp" diff --git a/src/network/protocols/start_server.cpp b/src/network/protocols/start_server.cpp index fcb4192e0..fd12c3e6e 100644 --- a/src/network/protocols/start_server.cpp +++ b/src/network/protocols/start_server.cpp @@ -20,7 +20,7 @@ #include "config/player_manager.hpp" #include "config/user_config.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "online/request_manager.hpp" StartServer::StartServer() : Protocol(NULL, PROTOCOL_SILENT) diff --git a/src/network/protocols/stop_server.cpp b/src/network/protocols/stop_server.cpp index feaaa4a9d..f34c6deab 100644 --- a/src/network/protocols/stop_server.cpp +++ b/src/network/protocols/stop_server.cpp @@ -20,7 +20,7 @@ #include "config/player_manager.hpp" #include "config/user_config.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "online/request_manager.hpp" StopServer::StopServer() : Protocol(NULL, PROTOCOL_SILENT) diff --git a/src/network/protocols/synchronization_protocol.cpp b/src/network/protocols/synchronization_protocol.cpp index e09606e19..80020fb08 100644 --- a/src/network/protocols/synchronization_protocol.cpp +++ b/src/network/protocols/synchronization_protocol.cpp @@ -1,10 +1,11 @@ #include "network/protocols/synchronization_protocol.hpp" #include "network/event.hpp" -#include "network/network_manager.hpp" #include "network/protocols/kart_update_protocol.hpp" #include "network/protocols/controller_events_protocol.hpp" #include "network/protocols/game_events_protocol.hpp" +#include "network/stk_host.hpp" +#include "network/stk_peer.hpp" #include "utils/time.hpp" //----------------------------------------------------------------------------- diff --git a/src/network/server_console.cpp b/src/network/server_console.cpp index db06721f3..6d2c7e708 100644 --- a/src/network/server_console.cpp +++ b/src/network/server_console.cpp @@ -19,12 +19,12 @@ #include "network/server_console.hpp" #include "main_loop.hpp" -#include "network/network_manager.hpp" #include "network/protocol_manager.hpp" #include "network/stk_host.hpp" #include "network/protocols/client_lobby_room_protocol.hpp" #include "network/protocols/server_lobby_room_protocol.hpp" #include "network/protocols/stop_server.hpp" +#include "network/stk_peer.hpp" #include "utils/log.hpp" #include "utils/time.hpp" @@ -170,10 +170,10 @@ void* ServerConsole::mainLoop(void* data) } std::cout << "\n"; } + // FIXME // If STK shuts down, but should receive an input after the network // manager was deleted, the getInstance call will return NULL. - else if (NetworkManager::getInstance() && STKHost::isclient() && - STKHost::get()->getPeerCount() > 0) + else if (STKHost::isclient() && STKHost::get()->getPeerCount() > 0) { NetworkString msg(1 + str.size()); msg.ai8(0); diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index 538637079..a0cd11ccf 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -21,9 +21,10 @@ #include "config/user_config.hpp" #include "io/file_manager.hpp" #include "network/event.hpp" -#include "network/network_manager.hpp" #include "network/protocols/server_lobby_room_protocol.hpp" +#include "network/protocol_manager.hpp" #include "network/server_console.hpp" +#include "network/stk_peer.hpp" #include "utils/log.hpp" #include "utils/time.hpp" @@ -191,8 +192,8 @@ void STKHost::sendMessage(const NetworkString& data, bool reliable) broadcastPacket(data, reliable); else { - if (m_peers.size() > 1) - Log::warn("ClientNetworkManager", "Ambiguous send of data."); + if (m_peers.size() > 1) + Log::warn("ClientNetworkManager", "Ambiguous send of data."); m_peers[0]->sendPacket(data, reliable); } } // sendMessage diff --git a/src/network/stk_host.hpp b/src/network/stk_host.hpp index 6a3fa7932..4a86a7282 100644 --- a/src/network/stk_host.hpp +++ b/src/network/stk_host.hpp @@ -38,7 +38,7 @@ class GameSetup; class STKPeer; -/*! \class STKHost +/** \class STKHost * \brief Represents the local host. * This host is either a server host or a client host. A client host is in * charge of connecting to a server. A server opens a socket for incoming diff --git a/src/network/stk_peer.cpp b/src/network/stk_peer.cpp index 09c300df9..1e29c787c 100644 --- a/src/network/stk_peer.cpp +++ b/src/network/stk_peer.cpp @@ -17,9 +17,9 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "network/stk_peer.hpp" -#include "network/network_manager.hpp" #include "network/game_setup.hpp" #include "network/network_string.hpp" +#include "network/types.hpp" #include "utils/log.hpp" #include diff --git a/src/states_screens/dialogs/race_paused_dialog.cpp b/src/states_screens/dialogs/race_paused_dialog.cpp index 1a4d2e442..8cb4988b7 100644 --- a/src/states_screens/dialogs/race_paused_dialog.cpp +++ b/src/states_screens/dialogs/race_paused_dialog.cpp @@ -27,7 +27,6 @@ #include "io/file_manager.hpp" #include "modes/overworld.hpp" #include "modes/world.hpp" -#include "network/network_manager.hpp" #include "race/race_manager.hpp" #include "states_screens/help_screen_1.hpp" #include "states_screens/main_menu_screen.hpp" diff --git a/src/states_screens/dialogs/select_challenge.cpp b/src/states_screens/dialogs/select_challenge.cpp index 30e14e87f..c8186e9dd 100644 --- a/src/states_screens/dialogs/select_challenge.cpp +++ b/src/states_screens/dialogs/select_challenge.cpp @@ -29,7 +29,6 @@ #include "input/input_manager.hpp" #include "io/file_manager.hpp" #include "modes/world.hpp" -#include "network/network_manager.hpp" #include "race/grand_prix_manager.hpp" #include "race/race_manager.hpp" #include "tracks/track_manager.hpp" diff --git a/src/states_screens/network_kart_selection.cpp b/src/states_screens/network_kart_selection.cpp index b351e7d4e..54bd01e5e 100644 --- a/src/states_screens/network_kart_selection.cpp +++ b/src/states_screens/network_kart_selection.cpp @@ -28,7 +28,7 @@ #include "karts/kart_properties_manager.hpp" #include "network/protocol_manager.hpp" #include "network/protocols/client_lobby_room_protocol.hpp" -#include "network/network_manager.hpp" +#include "network/stk_host.hpp" #include "states_screens/state_manager.hpp" static const char ID_LOCKED[] = "locked/";