[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp,1.50,1.51 tcScenarioInterface.cp
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-07-26 00:37:31
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13788/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcScenarioInterface.cpp Log Message: Added mission goal status to "Mission" channel (hit F7), added sub periscope and mast ops to multiplayer, changed torpedo behavior to resume s-search if track lost early, made afterburner smoke thin a little more uniformly Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** tcPlatformInterface.cpp 14 Jul 2005 23:42:23 -0000 1.50 --- tcPlatformInterface.cpp 26 Jul 2005 00:37:04 -0000 1.51 *************** *** 180,183 **** --- 180,184 ---- void tcPlatformInterface::SetAltitude(float alt_m) { + if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetAltitude(alt_m); } *************** *** 189,192 **** --- 190,194 ---- void tcPlatformInterface::SetLandingState(int state) { + if (!mpPlatformObj->IsControlled()) return; if (tcAirObject *air = dynamic_cast<tcAirObject*>(mpPlatformObj)) { *************** *** 209,212 **** --- 211,215 ---- void tcPlatformInterface::SetSpeed(float speed_kts) { + if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetSpeed(speed_kts); } *************** *** 218,221 **** --- 221,226 ---- { if (mpPlatformObj == 0) {return;} + if (!mpPlatformObj->IsControlled()) return; + if (tcAeroAirObject* aaObj = dynamic_cast<tcAeroAirObject*>(mpPlatformObj)) { *************** *** 232,235 **** --- 237,241 ---- void tcPlatformInterface::SetThrottle(float throttleFraction) { + if (!mpPlatformObj->IsControlled()) return; if (tcAeroAirObject* aaObj = dynamic_cast<tcAeroAirObject*>(mpPlatformObj)) { *************** *** 247,250 **** --- 253,257 ---- void tcPlatformInterface::SetTarget(long anID) { + if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->DesignateTarget(anID); } *************** *** 357,360 **** --- 364,386 ---- } + /** + * + */ + void tcPlatformInterface::SetHeading(float heading_deg) + { + if (!mpPlatformObj->IsControlled()) return; + + mpPlatformObj->SetHeading(C_PIOVER180*heading_deg); + } + + /** + * + */ + void tcPlatformInterface::SetHeadingRad(float heading_rad) + { + if (!mpPlatformObj->IsControlled()) return; + mpPlatformObj->SetHeading(heading_rad); + } + /** * If target is valid, sets heading to intercept target. *************** *** 363,366 **** --- 389,393 ---- float tcPlatformInterface::SetHeadingToInterceptTarget() { + if (!mpPlatformObj->IsControlled()) return 0; tcSensorMapTrack track; float fHeading_rad, fTTI; *************** *** 599,602 **** --- 626,630 ---- void tcPlatformInterface::Launch(int anLauncher, int quantity) { + if (!mpPlatformObj->IsControlled()) return; int launcherStatus = mpPlatformObj->SetLaunch(anLauncher, quantity); if (launcherStatus != tcLauncher::LAUNCHER_READY) *************** *** 676,679 **** --- 704,708 ---- void tcPlatformInterface::LoadLauncher(int anLauncher, std::string item) { + if (!mpPlatformObj->IsControlled()) return; // verify launcher is empty and item is compatible with launcher tcLauncher* launcher = mpPlatformObj->GetLauncher(anLauncher); *************** *** 705,708 **** --- 734,738 ---- void tcPlatformInterface::UnloadLauncher(int anLauncher) { + if (!mpPlatformObj->IsControlled()) return; tcLauncher* launcher = mpPlatformObj->GetLauncher(anLauncher); if (!launcher) return; *************** *** 984,987 **** --- 1014,1018 ---- float tcPlatformInterface::SetHeadingToInterceptTrack(tcSensorMapTrack track) { + if (!mpPlatformObj->IsControlled()) return 0; float fHeading_rad, fTTI; *************** *** 1053,1056 **** --- 1084,1088 ---- void tcPlatformInterface::SetAllSensorState(int anState) { + if (!mpPlatformObj->IsControlled()) return; unsigned nSensors = mpPlatformObj->GetSensorCount(); *************** *** 1063,1066 **** --- 1095,1099 ---- void tcPlatformInterface::SetSensorState(int n, int state) { + if (!mpPlatformObj->IsControlled()) return; mpPlatformObj->SetSensorState((unsigned)n, state != 0); } *************** *** 1087,1091 **** if (mpPlatformObj->IsControlled()) { ! tcMultiplayerInterface::Get()->SendControlRelease(mpPlatformObj->mnID); } } --- 1120,1131 ---- if (mpPlatformObj->IsControlled()) { ! if (tcMultiplayerInterface::Get()->IsServer()) ! { ! mpPlatformObj->SetController(""); ! } ! else ! { ! tcMultiplayerInterface::Get()->SendControlRelease(mpPlatformObj->mnID); ! } } } *************** *** 1097,1101 **** if (mpPlatformObj->IsAvailable()) { ! tcMultiplayerInterface::Get()->SendControlRequest(mpPlatformObj->mnID); } } --- 1137,1148 ---- if (mpPlatformObj->IsAvailable()) { ! if (tcMultiplayerInterface::Get()->IsServer()) ! { ! mpPlatformObj->SetController(tcUserInfo::Get()->GetUsername()); ! } ! else ! { ! tcMultiplayerInterface::Get()->SendControlRequest(mpPlatformObj->mnID); ! } } } *************** *** 1122,1127 **** bool tcPlatformInterface::IsPlayerControlled() const { ! // single player or server, check for alliance match only ! if (!mpPlatformObj->IsClientMode()) { return mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()); --- 1169,1174 ---- bool tcPlatformInterface::IsPlayerControlled() const { ! // single player, check for alliance match only ! if (!mpSimState->IsMultiplayerActive()) { return mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()); Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcScenarioInterface.cpp 17 Jul 2005 12:58:05 -0000 1.32 --- tcScenarioInterface.cpp 26 Jul 2005 00:37:04 -0000 1.33 *************** *** 202,205 **** --- 202,206 ---- .def("TimeGoal",&tcScenarioInterface::TimeGoal) .def("DestroyGoal",&tcScenarioInterface::DestroyGoal) + .def("ProtectGoal",&tcScenarioInterface::ProtectGoal) ; return InterfaceType; *************** *** 527,534 **** { wxASSERT(simState); ! wxASSERT(simState->GetGoalTracker()); tcGoal *allianceGoal = goal.Clone(); ! simState->GetGoalTracker()->SetAllianceGoal(alliance, allianceGoal); } --- 528,535 ---- { wxASSERT(simState); ! wxASSERT(tcGoalTracker::Get()); tcGoal *allianceGoal = goal.Clone(); ! tcGoalTracker::Get()->SetAllianceGoal(alliance, allianceGoal); } *************** *** 809,813 **** * workaround to construct goal class */ ! tcDestroyGoal tcScenarioInterface::DestroyGoal(std::string target) { tcDestroyGoal goal(target); --- 810,814 ---- * workaround to construct goal class */ ! tcDestroyGoal tcScenarioInterface::DestroyGoal(const std::string& target) { tcDestroyGoal goal(target); *************** *** 815,818 **** --- 816,825 ---- } + tcProtectGoal tcScenarioInterface::ProtectGoal(const std::string& target) + { + tcProtectGoal goal(target); + return goal; + } + tcScenarioInterface::tcScenarioInterface() : lon_theater_deg(0), |