diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index f3792db6..15e799bf 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -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); diff --git a/Code/Game/DanBiasGame/Include/DanBiasGame.h b/Code/Game/DanBiasGame/Include/DanBiasGame.h index 206a21e8..f146f343 100644 --- a/Code/Game/DanBiasGame/Include/DanBiasGame.h +++ b/Code/Game/DanBiasGame/Include/DanBiasGame.h @@ -29,6 +29,7 @@ namespace DanBias { //Stuff goes here... int port; + const char* IP; HINSTANCE hinst; int nCmdShow; diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp index a970d372..8ae0f29c 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -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;