Removed some comments. Basically did nothing

This commit is contained in:
stiffly
2016-01-06 11:39:32 +01:00
committed by Jocke
parent 4a516a4d86
commit f0ad28bac4
5 changed files with 15 additions and 19 deletions
+1
View File
@@ -14,6 +14,7 @@ public:
virtual ~Network() { };
virtual void Start(World* m_world, EventBroker *eventBroker) = 0;
virtual void Update() = 0;
virtual void Close() = 0;
};
#endif
+2 -2
View File
@@ -62,7 +62,7 @@ void InputProxy::Process()
e.Command = command;
e.Value = currentValue;
m_EventBroker->Publish(e);
LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
m_LastCommandValues[command] = currentValue;
}
}
@@ -78,7 +78,7 @@ void InputProxy::Process()
}
//e.Value = std::max(-1.f, std::min(e.Value, 1.f));
m_EventBroker->Publish(e);
LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
}
m_CommandQueue.clear();
}
+5 -9
View File
@@ -17,7 +17,7 @@ Client::Client(ConfigFile* config) : m_Socket(m_IOService)
Client::~Client()
{
m_EventBroker->Unsubscribe(m_EInputCommand);
}
void Client::Start(World* world, EventBroker* eventBroker)
@@ -27,14 +27,10 @@ void Client::Start(World* world, EventBroker* eventBroker)
m_World = world;
// Subscribe to events
m_EInputCommand = decltype(m_EInputCommand)(std::bind(&Client::OnInputCommand, this, std::placeholders::_1));
m_EventBroker->Subscribe(m_EInputCommand);
//m_EInputCommand = decltype(m_EInputCommand)(std::bind(&Client::OnInputCommand, this, std::placeholders::_1));
//m_EventBroker->Subscribe(m_EInputCommand);
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Client::OnInputCommand);
//while (m_PlayerName.size() > 7) {
// LOG_INFO("Please enter your name (No longer than 7 characters):");
// std::cin >> m_PlayerName;
//}
m_Socket.connect(m_ReceiverEndpoint);
LOG_INFO("I am client. BIP BOP");
}
@@ -73,7 +69,7 @@ void Client::readFromServer()
void Client::sendSnapshotToServer()
{
// Reset previouse key state in snapshot.
// Reset previous key state in snapshot.
m_NextSnapshot.InputForward = "";
m_NextSnapshot.InputRight = "";
+6 -2
View File
@@ -4,7 +4,9 @@ Server::Server() : m_Socket(m_IOService, boost::asio::ip::udp::endpoint(boost::a
{ }
Server::~Server()
{ }
{
}
void Server::Start(World* world, EventBroker* eventBroker)
@@ -25,6 +27,8 @@ void Server::Update()
void Server::Close()
{
m_ThreadIsRunning = false;
m_Socket.close();
}
void Server::readFromClients()
@@ -271,7 +275,7 @@ void Server::parseConnect(Packet& packet)
m_StopTimes[i] = std::clock();
LOG_INFO("Player \"%s\" connected on IP: %s", m_PlayerDefinitions[i].Name, m_PlayerDefinitions[i].Endpoint.address().to_string());
LOG_INFO("Player \"%s\" connected on IP: %s", m_PlayerDefinitions[i].Name.c_str(), m_PlayerDefinitions[i].Endpoint.address().to_string().c_str());
Packet packet(MessageType::Connect, m_SendPacketID);
packet.WritePrimitive<int>(i); // Player ID
+1 -6
View File
@@ -144,10 +144,5 @@ void Game::networkFunction()
m_ClientOrServer = new Server();
}
m_ClientOrServer->Start(m_World, m_EventBroker);
// I don't think we are reaching this part of the code right now.
// ~Game() is not called if the game is exited by closing console windows
// When server or client is done set it to false.
//m_IsClientOrServer = false;
// Destroy it
//delete m_ClientOrServer;
}