[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp,1.48,1.49 tcScenarioInterface.cp
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-07-02 16:51:20
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24188/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** tcPlatformInterface.cpp 30 Jun 2005 01:06:10 -0000 1.48 --- tcPlatformInterface.cpp 2 Jul 2005 16:51:11 -0000 1.49 *************** *** 498,501 **** --- 498,503 ---- info.maxDepth_m = 0; + bool isBomb = false; + if (tcMissileDBObject* missileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncher->mpChildDBObj)) *************** *** 508,511 **** --- 510,517 ---- { info.mfRange_km = ballisticDBObj->maxRange_km; + if (ballisticDBObj->ballisticType == tcBallisticDBObject::GRAVITY_BOMB) + { + isBomb = true; + } } else if (tcTorpedoDBObject* torpDBObj = *************** *** 525,529 **** info.mnTargetFlags = pLauncher->mnTargetFlags; ! if (pLauncher->meLaunchMode == DATUM_ONLY) { info.mnLaunchMode = 0; --- 531,539 ---- info.mnTargetFlags = pLauncher->mnTargetFlags; ! if (isBomb) ! { ! info.mnLaunchMode = 2; ! } ! else if (pLauncher->meLaunchMode == DATUM_ONLY) { info.mnLaunchMode = 0; *************** *** 535,539 **** else { ! info.mnLaunchMode = 2; // other } --- 545,549 ---- else { ! info.mnLaunchMode = 3; // other } *************** *** 1225,1228 **** --- 1235,1243 ---- } + void tcPlatformInterface::SetActionText(const std::string& text) + { + mpPlatformObj->mcAI.mzActionText = text; + } + // flightport (airstrip, cv flight deck, helo pad) bool tcPlatformInterface::HasFlightPort(void) Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcSimPythonInterface.cpp 25 Jun 2005 22:10:36 -0000 1.35 --- tcSimPythonInterface.cpp 2 Jul 2005 16:51:11 -0000 1.36 *************** *** 576,580 **** s += ")\n"; ! CallPython(s.c_str(),"Exception occured in ProcessCommand\n"); } --- 576,580 ---- s += ")\n"; ! CallPython(s.c_str(),"Exception occurred in ProcessCommand\n"); } *************** *** 636,640 **** if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); } else --- 636,640 ---- if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occurred in ProcessCallback\n"); } else *************** *** 679,683 **** if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); } else --- 679,683 ---- if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occurred in ProcessCallback\n"); } else *************** *** 693,696 **** --- 693,697 ---- } + /** * version for sending lat/lon coordinates *************** *** 723,727 **** if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); } else --- 724,728 ---- if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occurred in ProcessCallback\n"); } else *************** *** 748,752 **** SetMenuGroup(id); ! if (mpHookedObj == NULL) { PopMode(); --- 749,753 ---- SetMenuGroup(id); ! if (mpHookedObj == 0) { PopMode(); *************** *** 766,770 **** if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occured in ProcessCallback\n"); } else --- 767,771 ---- if (!mpSimState->IsMultiplayerClient()) { ! CallPython(zBuff, "Exception occurred in ProcessCallback\n"); } else *************** *** 788,792 **** SetMenuGroup(id); ! if (mpHookedObj == NULL) { PopMode(); --- 789,793 ---- SetMenuGroup(id); ! if (mpHookedObj == 0) { PopMode(); *************** *** 801,805 **** id.size()); #endif ! CallPython(command.c_str(), "Exception occured in ProcessCallbackString\n"); } else --- 802,806 ---- id.size()); #endif ! CallPython(command.c_str(), "Exception occurred in ProcessCallbackString\n"); } else *************** *** 826,830 **** { char zBuff[128]; ! if (mpHookedObj == NULL) return; if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; --- 827,831 ---- { char zBuff[128]; ! if (mpHookedObj == 0) return; if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; *************** *** 832,836 **** ! CallPython(zBuff, "Exception occured in ProcessHotKey\n"); } --- 833,837 ---- ! CallPython(zBuff, "Exception occurred in ProcessHotKey\n"); } *************** *** 846,854 **** { char zBuff[128]; ! if (mpHookedObj == NULL) return; if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; sprintf(zBuff,"Menu.ProcessSecondaryHook(HookedUnitInfo,%d)\n",id); ! CallPython(zBuff,"Exception occured in ProcessSecondaryHook\n"); } --- 847,878 ---- { char zBuff[128]; ! if (mpHookedObj == 0) return; if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->GetAlliance())) return; sprintf(zBuff,"Menu.ProcessSecondaryHook(HookedUnitInfo,%d)\n",id); ! CallPython(zBuff,"Exception occurred in ProcessSecondaryHook\n"); ! } ! ! void tcSimPythonInterface::ReimportModules() ! { ! try ! { ! handle<>( PyRun_String("import AI\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("import Menu\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("print ''\nprint 'Re-imported modules'\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! } ! catch (error_already_set) ! { ! // handle the exception in some way ! fprintf(stderr, "tcSimPythonInterface::ReimportModules - Python error occurred during re-import\n"); ! PyErr_Print(); ! } ! catch (...) ! { ! fprintf(stderr,"tcSimPythonInterface::ReimportModules - Unknown exception occurred\n"); ! } } *************** *** 859,863 **** { fprintf(stderr,text); ! if (mpConsole == NULL) return; mpConsole->Print(text); } --- 883,887 ---- { fprintf(stderr,text); ! if (mpConsole == 0) return; mpConsole->Print(text); } *************** *** 935,939 **** tcGameObject *pGameObj = mpSimState->GetObject(anID); ! if (!pGameObj) return; if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->GetAlliance())) { --- 959,969 ---- tcGameObject *pGameObj = mpSimState->GetObject(anID); ! if (!pGameObj) ! { ! mpHookedObj = 0; ! return; ! } ! ! if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->GetAlliance())) { *************** *** 962,969 **** "hello.close()", Py_file_input,mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) { // handle the exception in some way ! fprintf(stderr,"Exception occured in Test()\n"); PyErr_Print(); } --- 992,999 ---- "hello.close()", Py_file_input,mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch (error_already_set) { // handle the exception in some way ! fprintf(stderr,"Exception occurred in Test()\n"); PyErr_Print(); } *************** *** 1015,1024 **** catch(error_already_set) { ! fprintf(stderr,"Exception occured during SendTextToConsole\n"); PyErr_Print(); } catch(...) { ! fprintf(stderr,"Unknown exception occured during SendTextToConsole\n"); PyErr_Print(); } --- 1045,1054 ---- catch(error_already_set) { ! fprintf(stderr,"Exception occurred during SendTextToConsole\n"); PyErr_Print(); } catch(...) { ! fprintf(stderr,"Unknown exception occurred during SendTextToConsole\n"); PyErr_Print(); } *************** *** 1170,1177 **** , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) { // handle the exception in some way ! fprintf(stderr,"Exception occured during import\n"); PyErr_Print(); } --- 1200,1207 ---- , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch (error_already_set) { // handle the exception in some way ! fprintf(stderr,"Exception occurred during import\n"); PyErr_Print(); } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcScenarioInterface.cpp 28 Jun 2005 02:51:34 -0000 1.30 --- tcScenarioInterface.cpp 2 Jul 2005 16:51:11 -0000 1.31 *************** *** 165,168 **** --- 165,169 ---- .def("GetDefaultUnit",&tcScenarioInterface::GetDefaultUnit) .def("GetRandomDatum",&tcScenarioInterface::GetRandomDatum) + .def("GetSideCode", &tcScenarioInterface::GetSideCode) .def("SetAllianceGoal",&tcScenarioInterface::SetAllianceGoal) .def("SetDateTime",&tcScenarioInterface::SetDateTime) *************** *** 170,173 **** --- 171,175 ---- .def("SetScenarioLoaded",&tcScenarioInterface::SetScenarioLoaded) .def("SetScenarioName",&tcScenarioInterface::SetScenarioName) + .def("SetSideCode", &tcScenarioInterface::SetSideCode) .def("SetStartTheater", &tcScenarioInterface::SetStartTheater) .def("SetUserAlliance",&tcScenarioInterface::SetUserAlliance) *************** *** 501,504 **** --- 503,511 ---- } + int tcScenarioInterface::GetSideCode() const + { + return sideCode; + } + void tcScenarioInterface::GetStartTheater(double& lon_deg, double& lat_deg) const { *************** *** 534,541 **** } ! void tcScenarioInterface::SetScenarioName(std::string s) { simState->SetScenarioName(s); } void tcScenarioInterface::SetStartTheater(double lon_deg, double lat_deg) --- 541,553 ---- } ! void tcScenarioInterface::SetScenarioName(const std::string& s) { simState->SetScenarioName(s); } + + void tcScenarioInterface::SetSideCode(int code) + { + sideCode = code; + } void tcScenarioInterface::SetStartTheater(double lon_deg, double lat_deg) *************** *** 799,803 **** : lon_theater_deg(0), lat_theater_deg(0), ! eventTime(0) { } --- 811,816 ---- : lon_theater_deg(0), lat_theater_deg(0), ! eventTime(0), ! sideCode(0) { } |