GAMELOGIC - Fixed a minor major huge issue with no problems

This commit is contained in:
dean11 2013-12-12 14:37:35 +01:00
parent 42fa756866
commit 71d31db884
4 changed files with 43 additions and 5 deletions

View File

@ -18,9 +18,10 @@ namespace DanBias
{ {
printf("Client connected!\n"); printf("Client connected!\n");
GameLogic::Protocol_TEST t; GameLogic::Protocol_TEST t;
t.text = "Hello"; t.text = 'A';
client.Send(t); client.Send(t);
c = client; Sleep(50000);
this->mainLobby->AttachClient(Utility::DynamicMemory::SmartPointer<NetworkClient>(new NetworkClient(client)));
} }
GameServer::GameServer() GameServer::GameServer()
: initiated(0) : initiated(0)

View File

@ -0,0 +1,35 @@
#ifndef GAMESERVER_TEST_H
#define GAMESERVER_TEST_H
#include <CustomNetProtocol.h>
#include "ProtocolIdentificationID.h"
namespace GameLogic
{
struct Protocol_TEST :public Oyster::Network::CustomProtocolObject
{
int ProtocolID;
char text;
Protocol_TEST()
{
this->protocol[0].value = ProtocolID = PROTOCOL_TEST;
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
this->protocol[1].type = Oyster::Network::NetAttributeType_Char;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
{
this->protocol[1].value = text;
return &protocol;
}
private:
Oyster::Network::CustomNetProtocol protocol;
};
}
#endif // !GAMESERVER_TEST_H

View File

@ -125,7 +125,7 @@ int NetworkClient::PrivateData::Send()
postBoxMutex.lock(); postBoxMutex.lock();
if(sendPostBox->IsFull()) if(sendPostBox->IsFull())
{ {
SmartPointer<OysterByte> temp = new OysterByte; SmartPointer<OysterByte> temp = new OysterByte();
this->translator.Pack(temp, sendPostBox->FetchMessage()); this->translator.Pack(temp, sendPostBox->FetchMessage());
errorCode = this->connection->Send(temp); errorCode = this->connection->Send(temp);
} }

View File

@ -56,7 +56,9 @@ struct Translator::PrivateData
auto it = ((MyCastingStruct*)protocol.privateData)->attributes.begin(); auto it = ((MyCastingStruct*)protocol.privateData)->attributes.begin();
auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end(); auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end();
size = 4 + 2; //size(int) + number of chars(short) size = 4; //size(int)
bytes->AddSize(4);
message.SetSize(size); message.SetSize(size);
//Find all the data types //Find all the data types
@ -81,7 +83,7 @@ struct Translator::PrivateData
auto it = ((MyCastingStruct*)protocol.privateData)->attributes.begin(); auto it = ((MyCastingStruct*)protocol.privateData)->attributes.begin();
auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end(); auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end();
for(int i = 0; i < (int)headerString.size(); i++) for(int i = 0; i < (int)headerString.size(); i++, it++)
{ {
switch((int)headerString.at(i)) switch((int)headerString.at(i))
{ {