diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index 4c0cc060..0a16e8f4 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -5,7 +5,7 @@ #include "GameClientState/GameClientState.h" #include "GameClientState\GameState.h" #include "GameClientState\LobbyState.h" -#include +#include #include "NetworkClient.h" #include "../WindowManager/WindowShell.h" diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index a93a8e91..3426bce8 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -2,7 +2,7 @@ #include "DllInterfaces/GFXAPI.h" #include "C_obj/C_Player.h" #include "C_obj/C_DynamicObj.h" -#include +#include #include "NetworkClient.h" diff --git a/Code/Game/DanBiasServer/GameSession/GameClient.cpp b/Code/Game/DanBiasServer/GameSession/GameClient.cpp index a856a751..dd62c44a 100644 --- a/Code/Game/DanBiasServer/GameSession/GameClient.cpp +++ b/Code/Game/DanBiasServer/GameSession/GameClient.cpp @@ -5,7 +5,7 @@ #include "GameClient.h" #include "..\LobbySessions\NetworkSession.h" #include -#include +#include using namespace Utility::DynamicMemory; using namespace DanBias; diff --git a/Code/Game/DanBiasServer/GameSession/GameSession_Events.cpp b/Code/Game/DanBiasServer/GameSession/GameSession_Events.cpp index b8906867..0016de8a 100644 --- a/Code/Game/DanBiasServer/GameSession/GameSession_Events.cpp +++ b/Code/Game/DanBiasServer/GameSession/GameSession_Events.cpp @@ -4,7 +4,7 @@ #include "GameSession.h" #include "GameClient.h" -#include +#include #include #include #include @@ -64,16 +64,16 @@ namespace DanBias } break; case protocol_Gameplay_PlayerMouseMovement: - + break; case protocol_Gameplay_PlayerPosition: - + break; case protocol_Gameplay_CreateObject: - + break; case protocol_Gameplay_ObjectPosition: - + break; } } diff --git a/Code/Game/DanBiasServer/GameSession/GameSession_General.cpp b/Code/Game/DanBiasServer/GameSession/GameSession_General.cpp index e0ba12ee..07f97cff 100644 --- a/Code/Game/DanBiasServer/GameSession/GameSession_General.cpp +++ b/Code/Game/DanBiasServer/GameSession/GameSession_General.cpp @@ -4,7 +4,7 @@ #include "GameSession.h" #include "GameClient.h" #include "..\GameServer.h" -#include +#include #include #include diff --git a/Code/Game/DanBiasServer/GameSession/GameSession_Logic.cpp b/Code/Game/DanBiasServer/GameSession/GameSession_Logic.cpp index ab1bcdf5..eb1cf0ca 100644 --- a/Code/Game/DanBiasServer/GameSession/GameSession_Logic.cpp +++ b/Code/Game/DanBiasServer/GameSession/GameSession_Logic.cpp @@ -4,7 +4,7 @@ #include "GameSession.h" #include "GameClient.h" -#include +#include #include #include #include diff --git a/Code/Game/DanBiasServer/GameSession/GameSession_Network.cpp b/Code/Game/DanBiasServer/GameSession/GameSession_Network.cpp index f23ab118..729ef417 100644 --- a/Code/Game/DanBiasServer/GameSession/GameSession_Network.cpp +++ b/Code/Game/DanBiasServer/GameSession/GameSession_Network.cpp @@ -4,7 +4,7 @@ #include "GameSession.h" #include "GameClient.h" -#include +#include #include #include #include diff --git a/Code/Game/DanBiasServer/LobbySessions/LobbyClient.cpp b/Code/Game/DanBiasServer/LobbySessions/LobbyClient.cpp index af29410d..95f18e68 100644 --- a/Code/Game/DanBiasServer/LobbySessions/LobbyClient.cpp +++ b/Code/Game/DanBiasServer/LobbySessions/LobbyClient.cpp @@ -1,5 +1,5 @@ #include "LobbyClient.h" -#include +#include using namespace Utility::DynamicMemory; using namespace Oyster::Network; diff --git a/Code/Game/DanBiasServer/LobbySessions/MainLobby.h b/Code/Game/DanBiasServer/LobbySessions/MainLobby.h index 88ae4067..a28d90e9 100644 --- a/Code/Game/DanBiasServer/LobbySessions/MainLobby.h +++ b/Code/Game/DanBiasServer/LobbySessions/MainLobby.h @@ -6,7 +6,7 @@ #include "NetworkSession.h" #include "GameLobby.h" -#include +#include #include namespace DanBias diff --git a/Code/Game/GameLogic/DynamicObject.h b/Code/Game/GameLogic/DynamicObject.h index 6a2263c9..70b5efe7 100644 --- a/Code/Game/GameLogic/DynamicObject.h +++ b/Code/Game/GameLogic/DynamicObject.h @@ -9,9 +9,7 @@ namespace GameLogic { - - - class DANBIAS_GAMELOGIC_DLL DynamicObject : public Object + class DynamicObject : public Object { public: diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index 6d6437f1..c3519f73 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -8,12 +8,11 @@ #include "GameLogicStates.h" -#include "GameLogicDef.h" #include namespace GameLogic { - class DANBIAS_GAMELOGIC_DLL Object + class Object { public: Object(); diff --git a/Code/Game/GameProtocols/ControlProtocols.h b/Code/Game/GameProtocols/ControlProtocols.h index cdb30df9..46268b75 100644 --- a/Code/Game/GameProtocols/ControlProtocols.h +++ b/Code/Game/GameProtocols/ControlProtocols.h @@ -13,6 +13,7 @@ namespace GameLogic States_ready, States_idle, States_bussy, + State_waiting, States_disconected, }; States status; diff --git a/Code/Game/GameProtocols/GameProtocols.vcxproj b/Code/Game/GameProtocols/GameProtocols.vcxproj index d4d5fb7a..e01959b8 100644 --- a/Code/Game/GameProtocols/GameProtocols.vcxproj +++ b/Code/Game/GameProtocols/GameProtocols.vcxproj @@ -155,7 +155,8 @@ - + + diff --git a/Code/Game/GameProtocols/GameplayProtocols.h b/Code/Game/GameProtocols/GameplayProtocols.h new file mode 100644 index 00000000..b595ce36 --- /dev/null +++ b/Code/Game/GameProtocols/GameplayProtocols.h @@ -0,0 +1,63 @@ +#ifndef GAMEPROTOCOLS_GAMEPLAYPROTOCOLS_H +#define GAMEPROTOCOLS_GAMEPLAYPROTOCOLS_H + +#include +#include +#include "ProtocolIdentificationID.h" + +namespace GameLogic +{ + struct Protocol_GameplayInitiateSession :public Oyster::Network::CustomProtocolObject + { + struct SessionInitData + { + int id; + int type; + //std::string text; + }; + std::vector element; + + Protocol_GameplayInitiateSession() + { + this->protocol[protocol_INDEX_ID].value = protocol_Gameplay_Initiate; + this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Short; + } + Protocol_GameplayInitiateSession(Oyster::Network::CustomNetProtocol& p) + { + int size = p[1].value.netInt; + for (int i = 0; i < size; i++) + { + SessionInitData d = { p[i+2].value.netInt, p[i+3].value.netInt /*, p[i+4].value.netCharPtr */ }; + element.push_back(d); + } + } + void Add(int id, int type, std::string text) + { + SessionInitData d = { id, type /*, text*/ }; + element.push_back(d); + } + Oyster::Network::CustomNetProtocol* GetProtocol() override + { + //Store the elements count + this->protocol[1].value = element.size(); + this->protocol[1].type = Oyster::Network::NetAttributeType_Int; + + for (unsigned int i = 0; i < element.size(); i+=3) + { + this->protocol[i+2].value = element[i].id; + this->protocol[i+3].value = element[i].type; + //element[i].text.copy(this->protocol[i+4].value.netCharPtr, element[i].text.size()); + + this->protocol[i+2].type = Oyster::Network::NetAttributeType_Int; + this->protocol[i+3].type = Oyster::Network::NetAttributeType_Int; + //this->protocol[i+4].type = Oyster::Network::NetAttributeType_CharArray; + } + return &protocol; + } + + private: + Oyster::Network::CustomNetProtocol protocol; + }; +} + +#endif // !GAMEPROTOCOLS_GAMEPLAYPROTOCOLS_H diff --git a/Code/Game/GameProtocols/ProtocolIdentificationID.h b/Code/Game/GameProtocols/ProtocolIdentificationID.h index d99b7e65..fb54e403 100644 --- a/Code/Game/GameProtocols/ProtocolIdentificationID.h +++ b/Code/Game/GameProtocols/ProtocolIdentificationID.h @@ -22,7 +22,7 @@ /***********************************/ /********* GENERAL PROTOCOLS ***************************************************************************************************/ /***********[ 100 - 200 ]***********/ -#define protocol_GeneralMIN 100 /* This defines lower bounds of general protocols (okay to have same value on first element). */ +#define protocol_GeneralMIN 100 #define protocol_General_Status 100 #define protocol_General_Text 101 #define protocol_GeneralMAX 199 @@ -51,6 +51,7 @@ #define protocol_Gameplay_CreateObject 303 #define protocol_Gameplay_RemoveObject 304 #define protocol_Gameplay_ObjectPosition 305 +#define protocol_Gameplay_Initiate 306 #define protocol_GameplayMAX 399 @@ -61,11 +62,4 @@ inline bool ProtocolIsLobby(short ID) { return (ID >= protocol_LobbyMIN && ID <= inline bool ProtocolIsGeneral(short ID) { return (ID >= protocol_GeneralMIN && ID <= protocol_GeneralMAX); } inline bool ProtocolIsGameplay(short ID) { return (ID >= protocol_GameplayMIN && ID <= protocol_GameplayMAX); } - - -/***********************************/ -/*********** TEST PROTOCOLS *******************************************************************************************************/ -/***********[ x - x ]************/ - - #endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H diff --git a/Code/Game/GameProtocols/GameProtocols.h b/Code/Game/GameProtocols/Protocols.h similarity index 88% rename from Code/Game/GameProtocols/GameProtocols.h rename to Code/Game/GameProtocols/Protocols.h index 4c52e716..6e084b75 100644 --- a/Code/Game/GameProtocols/GameProtocols.h +++ b/Code/Game/GameProtocols/Protocols.h @@ -5,5 +5,6 @@ #include "PlayerProtocols.h" #include "LobbyProtocols.h" #include "ControlProtocols.h" +#include "GameplayProtocols.h" #endif // !GAMEPROTOCOLS_GAMEPROTOCOLS_H