[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp,1.32,1.33 tcSimPythonInterface.c
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:17
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcSimPythonInterface.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcPlatformInterface.cpp 7 Dec 2004 04:00:41 -0000 1.32 --- tcPlatformInterface.cpp 11 Dec 2004 01:09:06 -0000 1.33 *************** *** 39,42 **** --- 39,43 ---- #include "tcSoundConsole.h" #include "commandlist.h" + #include "tcCommandQueue.h" #include "tcAeroAirObject.h" #include "tcBallisticDBObject.h" Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcSimPythonInterface.cpp 5 Dec 2004 02:49:48 -0000 1.23 --- tcSimPythonInterface.cpp 11 Dec 2004 01:09:07 -0000 1.24 *************** *** 363,367 **** } ! void tcSimPythonInterface::ProcessCommand(std::string command, int param, std::string textParam) { std::string s = "Menu."; --- 363,370 ---- } ! /** ! * ! */ ! void tcSimPythonInterface::ProcessCommand(std::string command, long id, int param, std::string textParam) { std::string s = "Menu."; *************** *** 391,400 **** } ! void tcSimPythonInterface::ProcessCallback(std::string command, float afData, int param) { ! if (mpHookedObj == NULL) {return;} char zBuff[128]; char zObject[64]; GetObjectStringByMode(zObject); --- 394,450 ---- } ! /** ! * Saves menu state. Restore with PopMode() ! */ ! void tcSimPythonInterface::PushMode() { ! pushedMode = meMenuMode; ! pushedPlatformID = menuPlatformID; ! isModePushed = true; ! } ! ! /** ! * Recalls menu state after call to push mode. ! */ ! void tcSimPythonInterface::PopMode() ! { ! if (!isModePushed) ! { ! fprintf(stderr, "tcSimPythonInterface::PopMode() - Mode not pushed\n"); ! return; ! } ! ! meMenuMode = pushedMode; ! ! // for group menu don't do anything (can't change group menu currently) ! if (meMenuMode == GROUP_MENU) return; ! ! // reselect menu platform ! SetMenuPlatform(pushedPlatformID); ! ! isModePushed = false; ! } ! ! ! ! ! /** ! * ! */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, float afData, int param) ! { ! PushMode(); ! SetMenuPlatform(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } char zBuff[128]; char zObject[64]; + + GetObjectStringByMode(zObject); *************** *** 405,415 **** CallPython(zBuff,"Exception occured in ProcessCallback\n"); } ! // version for sending lat/lon coordinates ! void tcSimPythonInterface::ProcessCallback(std::string command, float afData1, float afData2, int param) { ! if (mpHookedObj == NULL) {return;} char zBuff[128]; char zObject[64]; --- 455,476 ---- CallPython(zBuff,"Exception occured in ProcessCallback\n"); + + PopMode(); } ! /** ! * version for sending lat/lon coordinates ! */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, float afData1, float afData2, int param) { ! PushMode(); ! SetMenuPlatform(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } char zBuff[128]; char zObject[64]; *************** *** 424,435 **** } CallPython(zBuff,"Exception occured in ProcessCallback\n"); } ! void tcSimPythonInterface::ProcessCallback(std::string command, long anData, int param) { ! if (mpHookedObj == NULL) {return;} char zBuff[128]; char zObject[64]; GetObjectStringByMode(zObject); if (param == -1) --- 485,509 ---- } CallPython(zBuff,"Exception occured in ProcessCallback\n"); + + PopMode(); } ! /** ! * ! */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, long anData, int param) { ! PushMode(); ! SetMenuPlatform(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } char zBuff[128]; char zObject[64]; + GetObjectStringByMode(zObject); if (param == -1) *************** *** 439,442 **** --- 513,518 ---- CallPython(zBuff,"Exception occured in ProcessCallback\n"); + + PopMode(); } *************** *** 534,537 **** --- 610,617 ---- { + if (mpHookedObj && (mpHookedObj->mnID == anID)) return; // already set + + menuPlatformID = anID; + tcTrackInterface::SetTrack(anID); *************** *** 575,584 **** ! tcSimPythonInterface::tcSimPythonInterface() { ! mpConsole = NULL; ! director = NULL; mpSimState = tcSimState::Get(); ! mpHookedObj = NULL; tcPlatformInterface::AttachSimState(mpSimState); --- 655,669 ---- ! tcSimPythonInterface::tcSimPythonInterface() : ! mpConsole(0), ! director(0), ! mpHookedObj(0), ! isModePushed(false), ! pushedPlatformID(-1) ! { ! mpSimState = tcSimState::Get(); ! tcPlatformInterface::AttachSimState(mpSimState); *************** *** 671,675 **** // import AI script ! try { handle<>( PyRun_String("import AI\n" , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); --- 756,761 ---- // import AI script ! try ! { handle<>( PyRun_String("import AI\n" , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); *************** *** 679,683 **** , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) { // handle the exception in some way fprintf(stderr,"Exception occured during import\n"); --- 765,770 ---- , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) ! { // handle the exception in some way fprintf(stderr,"Exception occured during import\n"); |