[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp,1.49,1.50 tcSimPythonInterface.c
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-07-14 23:42:32
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15641/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcSimPythonInterface.cpp tcSubInterface.cpp Log Message: Fixed shaking object bug Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** tcPlatformInterface.cpp 2 Jul 2005 16:51:11 -0000 1.49 --- tcPlatformInterface.cpp 14 Jul 2005 23:42:23 -0000 1.50 *************** *** 996,1000 **** tcSensorMapTrack track; ! bool found = mpSimState->GetTrack(id, mpPlatformObj->GetAlliance(), track); return track; --- 996,1000 ---- tcSensorMapTrack track; ! mpSimState->GetTrack(id, mpPlatformObj->GetAlliance(), track); return track; Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcSimPythonInterface.cpp 10 Jul 2005 20:32:03 -0000 1.37 --- tcSimPythonInterface.cpp 14 Jul 2005 23:42:23 -0000 1.38 *************** *** 1126,1129 **** --- 1126,1130 ---- SubInterfaceType = class_<tcSubInterface>("SubInterfaceClass") + .def("GetBatteryFraction", &tcSubInterface::GetBatteryFraction) .def("GetMaxDepth", &tcSubInterface::GetMaxDepth) .def("GoToPeriscopeDepth", &tcSubInterface::GoToPeriscopeDepth) Index: tcSubInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSubInterface.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSubInterface.cpp 10 Jul 2005 20:32:03 -0000 1.5 --- tcSubInterface.cpp 14 Jul 2005 23:42:23 -0000 1.6 *************** *** 42,72 **** namespace scriptinterface { ! tcMessageInterface* tcSubInterface::messageInterface = 0; ! tcSound* tcSubInterface::sound = 0; ! tcSimState* tcSubInterface::simState = 0; ! /** ! * @return maximum depth in meters ! */ ! float tcSubInterface::GetMaxDepth() const ! { ! if (!subObj) return 0; ! return subObj->mpDBObject->mfMaxDepth_m; ! } ! void tcSubInterface::GoToPeriscopeDepth() ! { ! if (subObj) ! { ! subObj->SetAltitude(-subObj->GetPeriscopeDepth() + 0.4f); ! } ! } ! bool tcSubInterface::IsAtPeriscopeDepth() const ! { ! if (!subObj) return false; ! return subObj->IsAtPeriscopeDepth(); ! } bool tcSubInterface::IsDieselElectric() const --- 42,98 ---- namespace scriptinterface { ! tcMessageInterface* tcSubInterface::messageInterface = 0; ! tcSound* tcSubInterface::sound = 0; ! tcSimState* tcSubInterface::simState = 0; ! /** ! * @return battery charge fraction, 0 - 1 ! */ ! float tcSubInterface::GetBatteryFraction() const ! { ! if (!subObj) return 0; ! if (subObj->IsDieselElectric()) ! { ! float batteryCapacity = subObj->mpDBObject->batteryCapacity_kJ; ! if (batteryCapacity > 0) ! { ! return subObj->GetBatteryCharge() / batteryCapacity; ! } ! else ! { ! wxASSERT(false); ! return 1.0f; ! } ! } ! else ! { ! return 1.0f; ! } ! } ! /** ! * @return maximum depth in meters ! */ ! float tcSubInterface::GetMaxDepth() const ! { ! if (!subObj) return 0; ! return subObj->mpDBObject->mfMaxDepth_m; ! } ! ! void tcSubInterface::GoToPeriscopeDepth() ! { ! if (subObj) ! { ! subObj->SetAltitude(-subObj->GetPeriscopeDepth() + 0.4f); ! } ! } ! ! bool tcSubInterface::IsAtPeriscopeDepth() const ! { ! if (!subObj) return false; ! return subObj->IsAtPeriscopeDepth(); ! } bool tcSubInterface::IsDieselElectric() const *************** *** 76,185 **** } ! bool tcSubInterface::IsPeriscopeRaised() const ! { ! if (!subObj) return false; ! return subObj->GetPeriscopeState(); ! } ! bool tcSubInterface::IsRadarMastRaised() const ! { ! if (!subObj) return false; ! return subObj->GetRadarMastState(); ! } bool tcSubInterface::IsSnorkeling() const { if (!subObj) return false; ! return subObj->GetSnorkelState(); } ! /** ! * @return true if interface is valid sub interface ! */ ! bool tcSubInterface::IsValid() const ! { ! return (subObj != 0); ! } ! void tcSubInterface::LowerPeriscope() ! { ! if (subObj) ! { ! if (subObj->GetPeriscopeState()) ! { ! subObj->SetPeriscopeState(false); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): lowering scope\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! ! } ! } ! } ! } ! void tcSubInterface::LowerRadarMast() ! { ! if (subObj) ! { ! if (subObj->GetRadarMastState()) ! { ! subObj->SetRadarMastState(false); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): lowering radar mast\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! } ! } ! } ! void tcSubInterface::RaisePeriscope() ! { ! if (subObj) ! { ! if (!subObj->GetPeriscopeState()) ! { ! subObj->SetPeriscopeState(true); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): raising scope\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! } ! } ! } ! void tcSubInterface::RaiseRadarMast() ! { ! if (subObj) ! { ! if (!subObj->GetRadarMastState()) ! { ! subObj->SetRadarMastState(true); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): raising radar mast\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! } ! } ! } void tcSubInterface::SetSnorkelState(bool state) --- 102,211 ---- } ! bool tcSubInterface::IsPeriscopeRaised() const ! { ! if (!subObj) return false; ! return subObj->GetPeriscopeState(); ! } ! bool tcSubInterface::IsRadarMastRaised() const ! { ! if (!subObj) return false; ! return subObj->GetRadarMastState(); ! } bool tcSubInterface::IsSnorkeling() const { if (!subObj) return false; ! return subObj->IsSnorkeling(); } ! /** ! * @return true if interface is valid sub interface ! */ ! bool tcSubInterface::IsValid() const ! { ! return (subObj != 0); ! } ! void tcSubInterface::LowerPeriscope() ! { ! if (subObj) ! { ! if (subObj->GetPeriscopeState()) ! { ! subObj->SetPeriscopeState(false); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): lowering scope\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! } ! } ! } ! void tcSubInterface::LowerRadarMast() ! { ! if (subObj) ! { ! if (subObj->GetRadarMastState()) ! { ! subObj->SetRadarMastState(false); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): lowering radar mast\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! } ! } ! } ! void tcSubInterface::RaisePeriscope() ! { ! if (subObj) ! { ! if (!subObj->GetPeriscopeState()) ! { ! subObj->SetPeriscopeState(true); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): raising scope\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! } ! } ! } ! void tcSubInterface::RaiseRadarMast() ! { ! if (subObj) ! { ! if (!subObj->GetRadarMastState()) ! { ! subObj->SetRadarMastState(true); ! if (subObj->IsOwnAlliance()) ! { ! wxString s = wxString::Format("%s (%s): raising radar mast\n", ! subObj->mzUnit.mz, subObj->mzClass.mz); ! messageInterface->ChannelMessage("Info", s.c_str()); ! sound->PlayEffect("LowBeep"); ! } ! ! } ! } ! } void tcSubInterface::SetSnorkelState(bool state) *************** *** 187,191 **** if (subObj) { ! if (subObj->GetSnorkelState() == state) return; // no change subObj->SetSnorkelState(state); --- 213,217 ---- if (subObj) { ! if (subObj->IsSnorkeling() == state) return; // no change subObj->SetSnorkelState(state); *************** *** 208,237 **** } ! tcSubInterface::tcSubInterface() ! : subObj(0) ! { ! } ! tcSubInterface::tcSubInterface(tcPlatformObject* obj) ! { ! subObj = dynamic_cast<tcSubObject*>(obj); ! if (!sound) ! { ! sound = tcSound::Get(); ! } ! if (!simState) ! { ! simState = tcSimState::Get(); ! } ! if (!messageInterface) ! { ! messageInterface = tcMessageInterface::Get(); ! } ! } ! tcSubInterface::~tcSubInterface() ! { ! } --- 234,263 ---- } ! tcSubInterface::tcSubInterface() ! : subObj(0) ! { ! } ! tcSubInterface::tcSubInterface(tcPlatformObject* obj) ! { ! subObj = dynamic_cast<tcSubObject*>(obj); ! if (!sound) ! { ! sound = tcSound::Get(); ! } ! if (!simState) ! { ! simState = tcSimState::Get(); ! } ! if (!messageInterface) ! { ! messageInterface = tcMessageInterface::Get(); ! } ! } ! tcSubInterface::~tcSubInterface() ! { ! } |