Renmated ServerConsole to NetworkConsole.
This commit is contained in:
parent
c511fc48af
commit
f7f12d5431
@ -16,7 +16,7 @@
|
||||
// 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/server_console.hpp"
|
||||
#include "network/network_console.hpp"
|
||||
|
||||
#include "main_loop.hpp"
|
||||
#include "network/protocol_manager.hpp"
|
||||
@ -43,41 +43,41 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
ServerConsole::ServerConsole()
|
||||
NetworkConsole::NetworkConsole()
|
||||
{
|
||||
m_localhost = NULL;
|
||||
m_thread_keyboard = NULL;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
ServerConsole::~ServerConsole()
|
||||
NetworkConsole::~NetworkConsole()
|
||||
{
|
||||
if (m_thread_keyboard)
|
||||
pthread_cancel(*m_thread_keyboard);//, SIGKILL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void ServerConsole::run()
|
||||
void NetworkConsole::run()
|
||||
{
|
||||
if (enet_initialize() != 0)
|
||||
{
|
||||
Log::error("ServerConsole", "Could not initialize enet.");
|
||||
Log::error("NetworkConsole", "Could not initialize enet.");
|
||||
return;
|
||||
}
|
||||
|
||||
Log::info("ServerConsole", "Host initialized.");
|
||||
Log::info("NetworkConsole", "Host initialized.");
|
||||
|
||||
// listen keyboard console input
|
||||
m_thread_keyboard = new pthread_t;
|
||||
pthread_create(m_thread_keyboard, NULL, mainLoop, this);
|
||||
|
||||
Log::info("ServerConsole", "Ready.");
|
||||
Log::info("NetworkConsole", "Ready.");
|
||||
} // run
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void* ServerConsole::mainLoop(void* data)
|
||||
void* NetworkConsole::mainLoop(void* data)
|
||||
{
|
||||
ServerConsole *me = static_cast<ServerConsole*>(data);
|
||||
NetworkConsole *me = static_cast<NetworkConsole*>(data);
|
||||
std::string str = "";
|
||||
bool stop = false;
|
||||
while (!stop)
|
||||
@ -197,7 +197,7 @@ void* ServerConsole::mainLoop(void* data)
|
||||
} // mainLoop
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void ServerConsole::kickAllPlayers()
|
||||
void NetworkConsole::kickAllPlayers()
|
||||
{
|
||||
const std::vector<STKPeer*> &peers = STKHost::get()->getPeers();
|
||||
for (unsigned int i = 0; i < peers.size(); i++)
|
||||
@ -207,7 +207,7 @@ void ServerConsole::kickAllPlayers()
|
||||
} // kickAllPlayers
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void ServerConsole::sendPacket(const NetworkString& data, bool reliable)
|
||||
void NetworkConsole::sendPacket(const NetworkString& data, bool reliable)
|
||||
{
|
||||
m_localhost->broadcastPacket(data, reliable);
|
||||
} // sendPacket
|
@ -16,8 +16,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef SERVER_CONSOLE_HPP
|
||||
#define SERVER_CONSOLE_HPP
|
||||
#ifndef HEADER_NETWORK_CONSOLE_HPP
|
||||
#define HEADER_NETWORK_CONSOLE_HPP
|
||||
|
||||
#include "utils/types.hpp"
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
class NetworkString;
|
||||
class STKHost;
|
||||
|
||||
class ServerConsole
|
||||
class NetworkConsole
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -39,8 +39,8 @@ protected:
|
||||
static void* mainLoop(void* data);
|
||||
|
||||
public:
|
||||
ServerConsole();
|
||||
virtual ~ServerConsole();
|
||||
NetworkConsole();
|
||||
virtual ~NetworkConsole();
|
||||
|
||||
virtual void run();
|
||||
|
||||
@ -53,6 +53,6 @@ public:
|
||||
|
||||
virtual bool isServer() { return true; }
|
||||
|
||||
}; // class ServerConsole
|
||||
}; // class NetworkConsole
|
||||
|
||||
#endif // SERVER_CONSOLE_HPP
|
@ -29,7 +29,6 @@
|
||||
#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"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "network/event.hpp"
|
||||
#include "network/protocols/server_lobby_room_protocol.hpp"
|
||||
#include "network/protocol_manager.hpp"
|
||||
#include "network/server_console.hpp"
|
||||
#include "network/network_console.hpp"
|
||||
#include "network/stk_peer.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/time.hpp"
|
||||
@ -65,7 +65,7 @@ STKHost::STKHost()
|
||||
|
||||
if (m_is_server)
|
||||
{
|
||||
ServerConsole *sc = new ServerConsole();
|
||||
NetworkConsole *sc = new NetworkConsole();
|
||||
sc->run();
|
||||
setupServer(STKHost::HOST_ANY, 7321, 16, 2, 0, 0);
|
||||
startListening();
|
||||
|
Loading…
Reference in New Issue
Block a user