[Gcblue-commits] gcb_wx/src/graphics tcNetworkView.cpp,1.4,1.5
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-04-06 02:19:58
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30667/src/graphics Modified Files: tcNetworkView.cpp Log Message: Added join game button for multiplayer, started carrier and airfield multiplayer support Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcNetworkView.cpp 2 Mar 2005 22:28:43 -0000 1.4 --- tcNetworkView.cpp 6 Apr 2005 02:19:49 -0000 1.5 *************** *** 41,45 **** EVT_COMMAND(ID_MULTIPLAYERMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetNetworkMode) EVT_COMMAND(ID_CONNECT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::OnConnect) ! EVT_COMMAND(ID_SENDTEST, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SendTest) EVT_COMMAND(ID_CHATPROTOCOL, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetChatProtocol) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) --- 41,45 ---- EVT_COMMAND(ID_MULTIPLAYERMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetNetworkMode) EVT_COMMAND(ID_CONNECT, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::OnConnect) ! EVT_COMMAND(ID_JOINGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::JoinGame) EVT_COMMAND(ID_CHATPROTOCOL, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetChatProtocol) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) *************** *** 91,95 **** /** ! * Only applies in client mode. */ void tcNetworkView::OnConnect(wxCommandEvent& event) --- 91,119 ---- /** ! * Only applies in client mode when already connected ! */ ! void tcNetworkView::JoinGame(wxCommandEvent& event) ! { ! if (networkMode != MULTIPLAYER_CLIENT) ! { ! chatBox->Print("Must be in client mode and connected to join game"); ! return; ! } ! ! if (tcMultiplayerInterface::Get()->GetNumConnections() == 0) ! { ! chatBox->Print("Must be connected to join game"); ! return; ! } ! ! // post start game event ! wxEvtHandler* evtHandler = tcMultiplayerInterface::Get()->GetEvtHandler(); ! wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_STARTGAME); ! evtHandler->AddPendingEvent(command); ! ! } ! ! /** ! * Only applies in client mode */ void tcNetworkView::OnConnect(wxCommandEvent& event) *************** *** 97,100 **** --- 121,125 ---- if (networkMode != 1) return; + tcMultiplayerInterface::Get()->OpenConnection(ipText.c_str()); } *************** *** 167,185 **** // switching to client mode also terminates all connections ! if (mode == 0) { tcMultiplayerInterface::Get()->MakeClient(); tcSimState::Get()->SetMultiplayerOff(); } ! else if (mode <= 1) { tcMultiplayerInterface::Get()->MakeClient(); tcSimState::Get()->SetMultiplayerClient(); } ! else if (mode == 2) { tcMultiplayerInterface::Get()->MakeServer(); tcSimState::Get()->SetMultiplayerServer(); } //tcMultiplayerInterface::Get().OpenConnection("192.168.0.101"); --- 192,215 ---- // switching to client mode also terminates all connections ! if (mode == MULTIPLAYER_OFF) { tcMultiplayerInterface::Get()->MakeClient(); tcSimState::Get()->SetMultiplayerOff(); } ! else if (mode == MULTIPLAYER_CLIENT) { tcMultiplayerInterface::Get()->MakeClient(); tcSimState::Get()->SetMultiplayerClient(); } ! else if (mode == MULTIPLAYER_SERVER) { tcMultiplayerInterface::Get()->MakeServer(); tcSimState::Get()->SetMultiplayerServer(); } + else + { + fprintf(stderr, "tcNetworkView::SetNetworkMode, bad mode %d\n", mode); + return; + } //tcMultiplayerInterface::Get().OpenConnection("192.168.0.101"); |