[Gcblue-commits] gcb_wx/src/sim tcLauncher.cpp,1.25,1.26 tcObjectControl.cpp,1.40,1.41 tcStores.cpp,
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-06-30 01:06:22
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31770/src/sim Modified Files: tcLauncher.cpp tcObjectControl.cpp tcStores.cpp Log Message: Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcLauncher.cpp 25 Jun 2005 22:10:36 -0000 1.25 --- tcLauncher.cpp 30 Jun 2005 01:06:11 -0000 1.26 *************** *** 415,418 **** --- 415,444 ---- } + bool tcLauncher::IsEffective(unsigned int targetClassification) const + { + if ((targetClassification & PTYPE_SURFACE)&&(mnTargetFlags & SURFACE_TARGET)) + { + return true; + } + else if ((targetClassification & PTYPE_AIR)&&(mnTargetFlags & AIR_TARGET)) + { + return true; + } + else if ((targetClassification & PTYPE_MISSILE)&&(mnTargetFlags & MISSILE_TARGET)) + { + return true; + } + else if ((targetClassification & PTYPE_FIXED)&&(mnTargetFlags & LAND_TARGET)) + { + return true; + } + else if ((targetClassification & PTYPE_SUBMARINE)&&(mnTargetFlags & SUBSURFACE_TARGET)) + { + return true; + } + + return false; + } + bool tcLauncher::IsLoading() const { *************** *** 636,643 **** bool hasTarget = (mnTargetID != NULL_INDEX); if (meLaunchMode == DATUM_ONLY) // needs a datum programmed to launch { ! if ((msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0)) { status = LAUNCHER_READY; --- 662,676 ---- bool hasTarget = (mnTargetID != NULL_INDEX); + bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); + + if ((meLaunchMode == AUTO) && (hasDatum)) + { + status = LAUNCHER_READY; + return; + } if (meLaunchMode == DATUM_ONLY) // needs a datum programmed to launch { ! if (hasDatum) { status = LAUNCHER_READY; *************** *** 649,682 **** return; } ! else if (meLaunchMode == TARGET_ONLY) { ! if (hasTarget) ! { ! status = LAUNCHER_READY; ! } ! else ! { ! status = NO_TARGET; ! } return; } ! // will launch and either proceed unguided or autonomously search out target ! if (meLaunchMode == AUTO) { ! bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); ! if ((!hasDatum) && (!hasTarget)) ! { ! status = NO_TARGET; ! } ! else ! { ! status = LAUNCHER_READY; ! } return; } // if running as multiplayer client, seeker track can't be checked so defer checking to server if (parent->IsClientMode()) --- 682,719 ---- return; } ! ! // all modes after here require a target ! if (!hasTarget) { ! status = NO_TARGET; return; } + tcSensorMapTrack track; + if (simState->GetTrack(mnTargetID, parent->GetAlliance(), track) == false) + { + mnTargetID = -1; // target wasn't found in alliance sensor map + status = NO_TARGET; + return; + } + + // verify that launcher is effective vs target type + if (!IsEffective(track.mnClassification)) + { + status = INVALID_TARGET; // or unknown classification? + return; + } + // TODO: verify that platform is within 1.5 x database maximum range + //float range_km = parent->mcKin.RangeToKm(track); + ! if ((meLaunchMode == TARGET_ONLY) || (meLaunchMode == AUTO)) { ! status = LAUNCHER_READY; return; } + // if running as multiplayer client, seeker track can't be checked so defer checking to server if (parent->IsClientMode()) *************** *** 699,707 **** if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) { - if (mnTargetID == NULL_INDEX) - { - status = NO_TARGET; // needs a target - return; - } if (!fireControlSensor) { --- 736,739 ---- *************** *** 715,719 **** return; } ! if (targetObj == NULL) { status = NOT_DETECTED_FC; // target doesn't exist --- 747,752 ---- return; } ! ! if (targetObj == 0) { status = NOT_DETECTED_FC; // target doesn't exist *************** *** 739,743 **** { tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(mpChildDBObj); ! if (pMissileDBObj==NULL) { std::cerr << "GetLauncherStatus -- Error: SEEKER_TRACK guidance with non-missile" << std::endl; --- 772,776 ---- { tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(mpChildDBObj); ! if (pMissileDBObj == 0) { std::cerr << "GetLauncherStatus -- Error: SEEKER_TRACK guidance with non-missile" << std::endl; *************** *** 832,835 **** --- 865,876 ---- return "Invalid launcher"; } + else if (statusCode == INVALID_TARGET) + { + return "Ineffective vs. target"; + } + else if (statusCode == OUT_OF_RANGE) + { + return "Out of range"; + } std::cerr << "Bad launcher status code"; Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tcObjectControl.cpp 28 Jun 2005 02:51:35 -0000 1.40 --- tcObjectControl.cpp 30 Jun 2005 01:06:11 -0000 1.41 *************** *** 1806,1812 **** symbol.mfLon_rad = (float)mpHookedGameObj->mcKin.mfLon_rad; ! float fRangeX_rad = 2.0f*pRadarSS->mpDBObj->mfRefRange_km*C_KMTORAD/ cosf((float)mpHookedGameObj->mcKin.mfLat_rad); ! float fRangeY_rad = 2.0f*pRadarSS->mpDBObj->mfRefRange_km*C_KMTORAD; symbol.mfLatExtent_rad = fRangeY_rad; symbol.mfLonExtent_rad = fRangeX_rad; --- 1806,1812 ---- symbol.mfLon_rad = (float)mpHookedGameObj->mcKin.mfLon_rad; ! float fRangeX_rad = 2.0f*pRadarSS->mpDBObj->mfMaxRange_km*C_KMTORAD/ cosf((float)mpHookedGameObj->mcKin.mfLat_rad); ! float fRangeY_rad = 2.0f*pRadarSS->mpDBObj->mfMaxRange_km*C_KMTORAD; symbol.mfLatExtent_rad = fRangeY_rad; symbol.mfLonExtent_rad = fRangeX_rad; *************** *** 1876,1880 **** { range_km = torpDBObj->mfRange_km; ! color = 0xFF4020A0; } --- 1876,1880 ---- { range_km = torpDBObj->mfRange_km; ! color = 0xFF010130; } Index: tcStores.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStores.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcStores.cpp 22 Jun 2005 01:22:10 -0000 1.6 --- tcStores.cpp 30 Jun 2005 01:06:11 -0000 1.7 *************** *** 296,300 **** } ! stores.push_back(StoreItem(item, quantity)); return true; } --- 296,303 ---- } ! if (quantity > 0) ! { ! stores.push_back(StoreItem(item, quantity)); ! } return true; } |