Did changes upon pull request's request.

This commit is contained in:
Jocke
2016-03-11 12:54:59 +01:00
parent 0fbc482f9c
commit 5f959ded89
9 changed files with 15 additions and 31 deletions
-9
View File
@@ -706,15 +706,6 @@ void Client::displayServerlist()
}
}
void Client::popNetworkSegmentOfHeader(Packet & packet)
{
// Pop packetSize, group, groupIndex and groupSize.
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
}
void Client::removeWorld()
{
std::vector<EntityID> childrenToBeDeleted;
+9
View File
@@ -83,3 +83,12 @@ void Network::updateNetworkData()
m_NetworkData.DataReceivedThisInterval = 0;
}
}
void Network::popNetworkSegmentOfHeader(Packet & packet)
{
// Pop packetSize, group, groupIndex and groupSize.
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
}
+1 -1
View File
@@ -44,7 +44,7 @@ void Packet::Init(MessageType type, unsigned int & packetID,
// allocate memory for size of packet, sequenceNumber and totalPacketesInSequence
packetSizeOffset = m_Offset;
WritePrimitive<int>(0);
// packetGroup is the gorup the packet is in
// packetGroup is the group the packet is in
groupOffset = m_Offset;
WritePrimitive<int>(group);
// What index the packet has in the packetGroup
-16
View File
@@ -299,8 +299,6 @@ void Server::sendPing()
reliableBroadcast(packet);
}
void Server::checkForTimeOuts()
{
double startPing = 1000 * m_StartPingTime
@@ -332,10 +330,6 @@ void Server::parseUDPConnect(Packet & packet)
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
// parse player id and other stuff
PlayerID playerID = packet.ReadPrimitive<int>();
if (!EntityWrapper(m_World, playerID).Valid()) {
}
// Do something here?
boost::asio::ip::udp::endpoint endpoint(m_Address, m_Port);
m_ConnectedPlayers.at(playerID).Endpoint = endpoint;
LOG_INFO("parseUDPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).Endpoint.address().to_string().c_str());
@@ -357,7 +351,6 @@ void Server::parseTCPConnect(Packet & packet)
LOG_INFO("Parsing connections");
// Check if player is already connected
// Ska vara till lagd i TCPServer receive
PlayerID playerID = getPlayerIDFromEndpoint();
if (playerID == -1) {
LOG_INFO("Server::parseTCPConnect: Not connected");
@@ -670,13 +663,4 @@ PlayerID Server::getPlayerIDFromEntityID(EntityID entityID)
}
}
return -1;
}
void Server::popNetworkSegmentOfHeader(Packet & packet)
{
// Pop packetSize, group, groupIndex and groupSize.
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
packet.ReadPrimitive<int>();
}
+1 -1
View File
@@ -17,7 +17,7 @@ bool UDPClient::Connect(std::string playerName, std::string address, int port)
m_ReceiverEndpoint = udp::endpoint(boost::asio::ip::address().from_string(address), port);
m_Socket = boost::shared_ptr<boost::asio::ip::udp::socket>(new boost::asio::ip::udp::socket(m_IOService));
m_Socket->open(boost::asio::ip::udp::v4());
boost::asio::socket_base::receive_buffer_size option(819200);
boost::asio::socket_base::receive_buffer_size option(m_SizeOfSocketBuffer);
m_Socket->set_option(option);
return true;
}