Created MAX_PACKET_SIZE

This commit is contained in:
Kayne Ruse
2014-06-08 00:36:05 +10:00
parent 63be0ee70d
commit ee2ac0b7a9
2 changed files with 28 additions and 3 deletions
+18 -3
View File
@@ -115,14 +115,29 @@ void ServerApplication::Init(int argc, char** argv) {
//-------------------------
std::cout << "Startup completed successfully" << std::endl;
//-------------------------
//debugging
//-------------------------
std::cout << "Debugging dump:" << std::endl;
std::cout << "\tMAX_PACKET_SIZE:\t\t" << MAX_PACKET_SIZE << std::endl;
std::cout << "\tsizeof(SerialPacket):\t\t" << sizeof(SerialPacket) << std::endl;
std::cout << "\tsizeof(CharacterPacket):\t" << sizeof(CharacterPacket) << std::endl;
std::cout << "\t\tsizeof(Statistics):\t" << sizeof(Statistics) << std::endl;
std::cout << "\tsizeof(ClientPacket):\t\t" << sizeof(ClientPacket) << std::endl;
std::cout << "\tsizeof(CombatPacket):\t\t" << sizeof(CombatPacket) << std::endl;
std::cout << "\tsizeof(EnemyPacket):\t\t" << sizeof(EnemyPacket) << std::endl;
std::cout << "\tsizeof(RegionPacket):\t\t" << sizeof(RegionPacket) << std::endl;
std::cout << "\tsizeof(ServerPacket):\t\t" << sizeof(ServerPacket) << std::endl;
}
void ServerApplication::Proc() {
SerialPacket packet;
char packetBuffer[MAX_PACKET_SIZE];
while(running) {
//suck in the waiting packets & process them
while(network.Receive(&packet)) {
HandlePacket(&packet);
while(network.Receive(reinterpret_cast<SerialPacket*>(packetBuffer))) {
HandlePacket(reinterpret_cast<SerialPacket*>(packetBuffer));
}
//update the internals
//TODO: update the internals i.e. player positions