[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp, 1.63, 1.64
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-09-05 01:04:30
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv24958/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** tcPlatformInterface.cpp 27 Aug 2006 21:28:54 -0000 1.63 --- tcPlatformInterface.cpp 5 Sep 2006 01:04:25 -0000 1.64 *************** *** 430,434 **** /** ! * return best launcher for target, best.mnLauncher set to -1 if * no compatible launchers or no target is selected */ --- 430,434 ---- /** ! * @return best launcher for target, best.mnLauncher set to -1 if * no compatible launchers or no target is selected */ *************** *** 464,467 **** --- 464,471 ---- nTargetType = SUBSURFACE_TARGET; } + else if (track.IsGround()) + { + nTargetType = LAND_TARGET; + } else { *************** *** 472,500 **** // or shortest range launcher if target is in range int nCount = GetLauncherCount(); ! for (int n=0;n<nCount;n++) ! { ! tcLauncherInfo info; ! if (GetLauncherInfo(info, n)) ! { ! int bCompatible = info.mnTargetFlags & nTargetType; ! bool bInRange = mfTargetRange <= info.mfRange_km; ! if (bCompatible && info.mnQuantity) ! { ! if (best.mnLauncher == -1) ! { ! best = info; ! } ! else if (bInRange && (info.mfRange_km < best.mfRange_km)) ! { ! best = info; ! } ! else if (info.mfRange_km > best.mfRange_km) ! { ! best = info; ! } ! } ! } ! } ! return best; } --- 476,506 ---- // or shortest range launcher if target is in range int nCount = GetLauncherCount(); ! for (int n=0;n<nCount;n++) ! { ! tcLauncherInfo info; ! bool launcherValid = GetLauncherInfo(info, n); ! bool launcherOperational = launcherValid && (info.launcherStatus != tcLauncher::DAMAGED) && ! (info.launcherStatus != tcLauncher::LAUNCHER_EMPTY); ! int bCompatible = info.mnTargetFlags & nTargetType; ! ! if (bCompatible && launcherOperational) ! { ! bool bInRange = mfTargetRange <= info.mfRange_km; ! if (best.mnLauncher == -1) ! { ! best = info; ! } ! else if (bInRange && (info.mfRange_km < best.mfRange_km)) ! { ! best = info; ! } ! else if (info.mfRange_km > best.mfRange_km) ! { ! best = info; ! } ! } ! ! } ! return best; } *************** *** 508,517 **** } bool tcPlatformInterface::GetLauncherInfo(scriptinterface::tcLauncherInfo& info, int anLauncher) { info.mnLauncher = -1; info.launcherStatus = tcLauncher::LAUNCHER_BUSY; - tcLauncher* pLauncher = mpPlatformObj->GetLauncher(anLauncher); if (pLauncher == 0) --- 514,526 ---- } + /** + * @return true if valid launcher + */ bool tcPlatformInterface::GetLauncherInfo(scriptinterface::tcLauncherInfo& info, int anLauncher) { info.mnLauncher = -1; info.launcherStatus = tcLauncher::LAUNCHER_BUSY; + info.mnLaunchMode = 4; tcLauncher* pLauncher = mpPlatformObj->GetLauncher(anLauncher); if (pLauncher == 0) *************** *** 522,530 **** info.launcherStatus = pLauncher->GetLauncherStatus(); ! if ((info.launcherStatus == tcLauncher::LAUNCHER_BUSY) || ! (info.launcherStatus >= tcLauncher::NOT_DETECTED_FC)) ! { ! return false; ! } // convert engagement sector values to degrees --- 531,537 ---- info.launcherStatus = pLauncher->GetLauncherStatus(); ! info.mnLauncher = anLauncher; ! info.mnQuantity = pLauncher->mnUncommitted; ! info.mnTargetFlags = pLauncher->mnTargetFlags; // convert engagement sector values to degrees *************** *** 565,581 **** info.maxDepth_m = torpDBObj->maxDepth_m; } ! else { //fprintf(stderr, "Error - unsupported launcher child class (%s)\n", // pLauncher->mpChildDBObj->GetClassName()); return false; } - info.mnLauncher = anLauncher; - info.mnQuantity = pLauncher->mnUncommitted; - info.mnTargetFlags = pLauncher->mnTargetFlags; - if (isBomb) { ! info.mnLaunchMode = 2; } else if (pLauncher->meLaunchMode == DATUM_ONLY) --- 572,586 ---- info.maxDepth_m = torpDBObj->maxDepth_m; } ! else ! { //fprintf(stderr, "Error - unsupported launcher child class (%s)\n", // pLauncher->mpChildDBObj->GetClassName()); + info.mnLauncher = -1; return false; } if (isBomb) { ! info.mnLaunchMode = 3; } else if (pLauncher->meLaunchMode == DATUM_ONLY) *************** *** 583,596 **** info.mnLaunchMode = 0; } ! else if ((pLauncher->meLaunchMode == SEEKER_TRACK)|| ! (pLauncher->meLaunchMode == FC_TRACK) || ! (pLauncher->meLaunchMode == TARGET_ONLY)) ! { ! info.mnLaunchMode = 1; ! } ! else { ! info.mnLaunchMode = 3; // other } return true; --- 588,600 ---- info.mnLaunchMode = 0; } ! else if (pLauncher->IsChildFireAndForget()) ! { ! info.mnLaunchMode = 1; // platform guidance not required after launch ! } ! else { ! info.mnLaunchMode = 2; // requires platform sensor for initial guidance } + return true; |