Update of /cvsroot/gcblue/gcb_wx/src/network
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12869/src/network
Modified Files:
tcControlMessageHandler.cpp tcMultiplayerInterface.cpp
Log Message:
multiplayer related changes
Index: tcMultiplayerInterface.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tcMultiplayerInterface.cpp 7 Apr 2004 00:41:08 -0000 1.5
--- tcMultiplayerInterface.cpp 9 Apr 2004 03:08:08 -0000 1.6
***************
*** 129,132 ****
--- 129,138 ----
}
+ wxEvtHandler* tcMultiplayerInterface::GetEvtHandler() const
+ {
+ wxASSERT(evtHandler);
+ return evtHandler;
+ }
+
/**
* @return identification name string for player using this interface
***************
*** 466,469 ****
--- 472,483 ----
/**
+ * Sets wxWidgets event handler for posting messages to application.
+ */
+ void tcMultiplayerInterface::SetEvtHandler(wxEvtHandler *eh)
+ {
+ evtHandler = eh;
+ }
+
+ /**
* Sets identification name string for player using this interface
*/
***************
*** 545,549 ****
tcMultiplayerInterface::tcMultiplayerInterface()
! : tcpChat(true), myName("Somebody")
{
networkInterface = new tcNetworkInterface();
--- 559,563 ----
tcMultiplayerInterface::tcMultiplayerInterface()
! : tcpChat(true), myName("Somebody"), evtHandler(0)
{
networkInterface = new tcNetworkInterface();
Index: tcControlMessageHandler.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcControlMessageHandler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tcControlMessageHandler.cpp 7 Apr 2004 00:41:08 -0000 1.1
--- tcControlMessageHandler.cpp 9 Apr 2004 03:08:08 -0000 1.2
***************
*** 26,32 ****
--- 26,35 ----
#endif
#include "wx/string.h"
+ #include "wx/event.h"
#include "network/tcControlMessageHandler.h"
#include "network/tcMultiplayerInterface.h"
+ #include "tcSimState.h"
+ #include "wxcommands.h"
BEGIN_NAMESPACE(network)
***************
*** 75,81 ****
memcpy(&messageCode, data, sizeof(messageCode));
! wxMessageBox(wxString::Format("Received control message %d", messageCode),
! "Msg received", wxOK);
}
--- 78,107 ----
memcpy(&messageCode, data, sizeof(messageCode));
! switch (messageCode)
! {
! case CM_BEEP:
! {
! }
! break;
! case CM_STARTGAME:
! {
! wxEvtHandler* evtHandler = tcMultiplayerInterface::Get()->GetEvtHandler();
! wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_STARTGAME);
! // command.SetEventObject(evtHandler);
! evtHandler->AddPendingEvent(command);
! }
! break;
! default:
! {
! fprintf(stderr, "Warning - Unrecognized control message "
! "received by server (src:%d, id:%d)\n", connectionId, messageCode);
! return;
! }
! }
+ /*
+ wxMessageBox(wxString::Format("Received control message %d", messageCode),
+ "Msg received", wxOK);
+ */
}
|