GameServer - Fixed minor miss with inheritance

This commit is contained in:
dean11 2014-02-18 11:56:36 +01:00
parent 222c203b69
commit cec2740896
3 changed files with 37 additions and 1 deletions

View File

@ -65,6 +65,8 @@ namespace DanBias
// Client event callback function
void ClientEventCallback(Oyster::Network::NetEvent<Oyster::Network::NetworkClient*, Oyster::Network::NetworkClient::ClientEventArgs> e) override;
void ProcessClients() override;
bool Send(Oyster::Network::CustomNetProtocol& message) override;
bool Send(Oyster::Network::CustomNetProtocol& protocol, int ID) override;
//Sends a client to the owner, if param is NULL then all clients is sent
void SendToOwner(DanBias::GameClient* obj);

View File

@ -84,6 +84,33 @@ using namespace DanBias;
}
}
}
bool GameSession::Send(Oyster::Network::CustomNetProtocol& message)
{
bool returnValue = false;
for (unsigned int i = 0; i < this->gClients.Size(); i++)
{
if(this->gClients[i])
{
this->gClients[i]->GetClient()->Send(message);
returnValue = true;
}
}
return returnValue;
}
bool GameSession::Send(Oyster::Network::CustomNetProtocol& protocol, int ID)
{
for (unsigned int i = 0; i < this->gClients.Size(); i++)
{
if(this->gClients[i] && this->gClients[i]->GetClient()->GetID() == ID)
{
this->gClients[i]->GetClient()->Send(protocol);
return true;
}
}
return false;
}
void GameSession::ObjectMove(GameLogic::IObjectData* movedObject)

View File

@ -233,7 +233,14 @@ bool GameSession::Join(gClient gameClient)
//TODO: Need to be able to get the current gameplay data from the logic, to sync it with the client
{
DynamicArray<IObjectData*> objects;
this->levelData->GetAllDynamicObjects(objects);
for (unsigned int i = 0; i < objects.Size(); i++)
{
//Protocol_ObjectPosition p(movedObject->GetPosition(), id);
Protocol_ObjectPositionRotation p(objects[i]->GetPosition(), objects[i]->GetRotation(), objects[i]->GetID());
GameSession::gameSession->Send(p.GetProtocol());
}
}
// Insert the new client to the update list