GL - connect to server, need right IP

This commit is contained in:
Linda Andersson 2013-12-16 09:55:51 +01:00
parent fa1473455f
commit b60166a6e8
3 changed files with 20 additions and 14 deletions

View File

@ -31,40 +31,38 @@ namespace DanBias
{
int pType = p[0].value.netInt;
Client::GameClientState::ProtocolStruct* protocol;
Client::GameClientState::ProtocolStruct* protocolData;
switch (pType)
{
case protocol_PlayerNavigation:
break;
case protocol_PlayerPosition:
protocol = new Client::GameClientState::PlayerPos;
protocolData = new Client::GameClientState::PlayerPos;
for(int i = 0; i< 3; i++)
{
((Client::GameClientState::PlayerPos*)protocol)->playerPos[i] = p[i].value.netFloat;
((Client::GameClientState::PlayerPos*)protocolData)->playerPos[i] = p[i].value.netFloat;
}
gameClientState->Protocol(protocol);
delete protocol;
protocol = NULL;
gameClientState->Protocol(protocolData);
delete protocolData;
protocolData = NULL;
break;
case protocol_ObjectPosition:
protocol = new Client::GameClientState::ObjPos;
protocolData = new Client::GameClientState::ObjPos;
for(int i = 0; i< 16; i++)
{
((Client::GameClientState::ObjPos*)protocol)->worldPos[i] = p[i].value.netFloat;
((Client::GameClientState::ObjPos*)protocolData)->worldPos[i] = p[i].value.netFloat;
}
gameClientState->Protocol(protocol);
delete protocol;
protocol = NULL;
gameClientState->Protocol(protocolData);
delete protocolData;
protocolData = NULL;
break;
default:
break;
}
}
}
};
class DanBiasGamePrivateData
@ -114,6 +112,12 @@ namespace DanBias
m_data->r = new MyRecieverObject;
m_data->r->nwClient = new Oyster::Network::NetworkClient();
m_data->r->nwClient->Connect(desc.port, desc.IP);
if (!m_data->r->nwClient->IsConnected())
{
// failed to connect
return DanBiasClientReturn_Error;
}
// Start in lobby state
m_data->gameClientState = new Client::LobbyState();
m_data->gameClientState->Init(m_data->r->nwClient);

View File

@ -29,6 +29,7 @@ namespace DanBias
{
//Stuff goes here...
int port;
const char* IP;
HINSTANCE hinst;
int nCmdShow;

View File

@ -30,6 +30,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
// Game client starter code goes here
DanBias::DanBiasGameDesc gameDesc;
gameDesc.port = 1;
gameDesc.IP = "10.1010.303";
gameDesc.hinst = hinst;
gameDesc.nCmdShow = cmdShow;