From 7cda07507a674fabb0929a2e3e1be025451170aa Mon Sep 17 00:00:00 2001 From: dean11 Date: Mon, 16 Dec 2013 09:50:23 +0100 Subject: [PATCH] GameLogic - Pre merge with Netowkr --- .../ServerObjects/Lobby/MainLobby.cpp | 29 ++++++++++--------- .../ServerObjects/Lobby/MainLobby.h | 2 +- .../GameProtocols/ProtocolIdentificationID.h | 14 ++++----- Code/Misc/PostBox/PostBox.h | 2 +- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.cpp b/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.cpp index e7edddd4..97033790 100644 --- a/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.cpp @@ -18,25 +18,26 @@ namespace DanBias void MainLobby::Frame() { - if(!this->box.IsEmpty()) - { - NetEvent &e = this->box.Fetch(); - ParseEvent(e); - } + ParseEvents(); } //////// Private - void MainLobby::ParseEvent(NetEvent& e) + void MainLobby::ParseEvents() { - static const short i = MAXSHORT; - if(e.protocol[0].type != Oyster::Network::NetAttributeType_Short) return; - - short f = e.protocol[0].value.netShort; - - switch (f) + if(!this->box.IsEmpty()) { - default: - break; + NetEvent &e = this->box.Fetch(); + + if(e.protocol[0].type != Oyster::Network::NetAttributeType_Short) return; + + short f = e.protocol[0].value.netShort; + + switch (f) + { + default: + + break; + } } } diff --git a/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.h b/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.h index 8e8b520a..c78f70e2 100644 --- a/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.h +++ b/Code/Game/DanBiasServer/ServerObjects/Lobby/MainLobby.h @@ -15,7 +15,7 @@ namespace DanBias void Frame(); private: - void ParseEvent(NetEvent& e); + void ParseEvents(); }; }//End namespace DanBias diff --git a/Code/Game/GameProtocols/ProtocolIdentificationID.h b/Code/Game/GameProtocols/ProtocolIdentificationID.h index 09f1aeed..cb90fa7f 100644 --- a/Code/Game/GameProtocols/ProtocolIdentificationID.h +++ b/Code/Game/GameProtocols/ProtocolIdentificationID.h @@ -7,15 +7,15 @@ /* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */ -#define protocol_PlayerNavigation 0 -#define protocol_PlayerPosition 1 -#define protocol_ObjectPosition 2 +#define protocol_Gamplay_PlayerNavigation 0 +#define protocol_Gamplay_PlayerPosition 1 +#define protocol_Gamplay_ObjectPosition 2 -#define protocol_Lobby_Msg 60 +#define protocol_Lobby_Msg 100 -#define protocol_General_Disconnect 100 -#define protocol_General_Ping 101 +#define protocol_General_Disconnect 200 +#define protocol_General_Ping 201 -#define PROTOCOL_TEST 1000 +#define PROTOCOL_TEST 1000 #endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H diff --git a/Code/Misc/PostBox/PostBox.h b/Code/Misc/PostBox/PostBox.h index c01eeead..1e8dfb74 100644 --- a/Code/Misc/PostBox/PostBox.h +++ b/Code/Misc/PostBox/PostBox.h @@ -54,7 +54,7 @@ namespace Oyster template bool PostBox::IsEmpty() { - return !messages.IsEmpty(); + return messages.IsEmpty(); } }