Removed NetworkManager and ClientNetworkManager.
This commit is contained in:
parent
7d04cc78de
commit
6297d8c65d
@ -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/*")
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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 <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
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();
|
||||
|
||||
}
|
@ -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
|
@ -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 <string.h>
|
||||
|
@ -24,7 +24,6 @@
|
||||
#define NETWORK_INTERFACE_H
|
||||
|
||||
#include "network/types.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/singleton.hpp"
|
||||
|
||||
#include <pthread.h>
|
||||
|
@ -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 <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NetworkManager::NetworkManager()
|
||||
{
|
||||
} // NetworkManager
|
@ -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 <vector>
|
||||
|
||||
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<NetworkManager>
|
||||
{
|
||||
protected:
|
||||
NetworkManager();
|
||||
virtual ~NetworkManager() {};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
PlayerLogin m_player_login;
|
||||
|
||||
|
||||
friend class AbstractSingleton<NetworkManager>;
|
||||
public:
|
||||
|
||||
|
||||
}; // class NetworkManager
|
||||
|
||||
#endif // NETWORKMANAGER_HPP
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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 <stdint.h>
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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 <assert.h>
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 <string.h>
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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/";
|
||||
|
Loading…
x
Reference in New Issue
Block a user