Merge remote-tracking branch 'origin/GameServer' into GameClient

This commit is contained in:
lindaandersson 2014-02-19 13:13:05 +01:00
commit d6d45392d3
4 changed files with 15 additions and 14 deletions

View File

@ -123,6 +123,7 @@ bool Game::NewFrame()
for (unsigned int i = 0; i < this->players.Size(); i++) for (unsigned int i = 0; i < this->players.Size(); i++)
{ {
this->onMoveFnc(this->players[i]);
if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame(); if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame();
} }

View File

@ -160,7 +160,6 @@ void Player::EndFrame()
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized()); this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
Object::EndFrame(); Object::EndFrame();
} }

View File

@ -561,11 +561,11 @@ namespace GameLogic
this->protocol[0].type = Oyster::Network::NetAttributeType_Short; this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
//PLAYER_ID //PLAYER_ID
this->protocol[1].type = Oyster::Network::NetAttributeType_Int; this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
//TEAM_ID //TEAM_ID
this->protocol[2].type = Oyster::Network::NetAttributeType_Int; this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
//OWNER //OWNER
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool; this->protocol[3].type = Oyster::Network::NetAttributeType_Int;
//PLAYER-NAME //PLAYER-NAME
this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray; this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray;
//MESH-NAME //MESH-NAME
@ -585,9 +585,10 @@ namespace GameLogic
} }
Protocol_ObjectCreatePlayer(Oyster::Network::CustomNetProtocol& p) Protocol_ObjectCreatePlayer(Oyster::Network::CustomNetProtocol& p)
{ {
this->object_ID = p[1].value.netInt; this->owner = p[1].value.netBool;
this->teamId = this->protocol[2].value.netInt; this->object_ID = p[2].value.netInt;
this->owner = this->protocol[3].value.netBool; this->teamId = p[3].value.netInt;
this->name.assign(p[4].value.netCharPtr); this->name.assign(p[4].value.netCharPtr);
this->meshName.assign(p[5].value.netCharPtr); this->meshName.assign(p[5].value.netCharPtr);
@ -610,11 +611,11 @@ namespace GameLogic
this->protocol[0].type = Oyster::Network::NetAttributeType_Short; this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
//PLAYER_ID //PLAYER_ID
this->protocol[1].type = Oyster::Network::NetAttributeType_Int; this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
//TEAM_ID //TEAM_ID
this->protocol[2].type = Oyster::Network::NetAttributeType_Int; this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
//OWNER //OWNER
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool; this->protocol[3].type = Oyster::Network::NetAttributeType_Int;
//PLAYER-NAME //PLAYER-NAME
this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray; this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray;
//MESH-NAME //MESH-NAME
@ -644,10 +645,10 @@ namespace GameLogic
} }
Oyster::Network::CustomNetProtocol GetProtocol() override Oyster::Network::CustomNetProtocol GetProtocol() override
{ {
this->protocol[1].value = this->owner;
this->protocol[2].value = this->object_ID;
this->protocol[3].value = this->teamId;
this->protocol[1].value = this->object_ID;
this->protocol[2].value = this->teamId;
this->protocol[3].value = this->owner;
this->protocol.Set(4, this->name); this->protocol.Set(4, this->name);
this->protocol.Set(5, this->meshName); this->protocol.Set(5, this->meshName);

View File

@ -66,10 +66,10 @@ using namespace DanBias;
break; break;
case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend: case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend:
printf("\t(%i : %s) - EventType_ProtocolFailedToSend\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); printf("\t(%i : %s) - EventType_ProtocolFailedToSend\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
this->Detach(e.sender); //this->Detach(e.sender);
break; break;
case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved: case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved:
printf("\t(%i : %s) - EventType_ProtocolRecieved\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); //printf("\t(%i : %s) - EventType_ProtocolRecieved\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
this->ParseProtocol(e.args.data.protocol, cl); this->ParseProtocol(e.args.data.protocol, cl);
break; break;
} }