gcblue-commits Mailing List for Global Conflict Blue (Page 66)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
From: <ddc...@us...> - 2004-02-12 01:59:24
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26928 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** GCblue.vcproj 7 Feb 2004 02:19:53 -0000 1.36 --- GCblue.vcproj 12 Feb 2004 01:54:48 -0000 1.37 *************** *** 214,220 **** </File> <File - RelativePath="src\graphics\tc3DSky.cpp"> - </File> - <File RelativePath="src\graphics\tc3DTerrain.cpp"> </File> --- 214,217 ---- *************** *** 535,541 **** </File> <File - RelativePath="include\graphics\tc3DSky.h"> - </File> - <File RelativePath="include\graphics\tc3DTerrain.h"> </File> --- 532,535 ---- |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26928/src/sim Modified Files: tcESMSensor.cpp tcGameObjIterator.cpp tcLauncherState.cpp tcRadar.cpp tcSensorState.cpp tcSimState.cpp Log Message: Index: tcESMSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcESMSensor.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcESMSensor.cpp 7 Feb 2004 02:19:54 -0000 1.1 --- tcESMSensor.cpp 12 Feb 2004 01:54:49 -0000 1.2 *************** *** 21,24 **** --- 21,26 ---- #include "aerror.h" #include "nsNav.h" + #include "tcGameObject.h" + #include "tcRadar.h" /** *************** *** 44,49 **** * */ ! bool tcESMSensor::IsDetected(const tsESMTargetInfo& asETI, float& rfAz_rad) { float fTargetAz_rad; float fTargetRange_km; --- 46,67 ---- * */ ! bool tcESMSensor::IsDetected(const tcRadar* emitter, float& rfAz_rad) { + wxASSERT(emitter); + wxASSERT(emitter->parent); + + if (emitter == NULL) {return false;} + if ((!emitter->mbActive)||(emitter->IsSemiactive())) {return false;} + + const tcKinematics& emitter_kin = emitter->parent->mcKin; + + float emitterERP_dBW = emitter->mpDBObj->mfERP_dBW; + float emitterFOV_rad = C_PIOVER180*emitter->mpDBObj->mfFieldOfView_deg; + + // look az is az relative to north, might have to change later + float lookAz_rad = parent->mcKin.mfHeading_rad + mountAz_rad; + float emitterAz_rad = emitter_kin.mfHeading_rad + emitter->mountAz_rad; + + float fTargetAz_rad; float fTargetRange_km; *************** *** 52,62 **** bool bInEmitterScan = false; ! if (mpDBObj==NULL) ! { ! return false; ! } ! fTargetAz_rad = nsNav::GCHeadingApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! asETI.mfLat_rad,asETI.mfLon_rad); rfAz_rad = fTargetAz_rad; if (rfAz_rad < 0) {rfAz_rad += C_TWOPI;} --- 70,80 ---- bool bInEmitterScan = false; ! wxASSERT(mpDBObj); ! wxASSERT(parent); ! const tcKinematics& sensor_kin = parent->mcKin; // kinematic state of parent object ! ! fTargetAz_rad = nsNav::GCHeadingApprox_rad(sensor_kin.mfLat_rad, sensor_kin.mfLon_rad, ! emitter_kin.mfLat_rad, emitter_kin.mfLon_rad); rfAz_rad = fTargetAz_rad; if (rfAz_rad < 0) {rfAz_rad += C_TWOPI;} *************** *** 68,80 **** else { float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; ! fCoverageAz1 = mfLookAz_rad - fHalfFOV_rad; ! fCoverageAz2 = mfLookAz_rad + fHalfFOV_rad; ! bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInSearchVolume) {return false;} } // check same for emitter ! if (asETI.mfEmitterFOV_rad >= C_TWOPIM) { bInEmitterScan = true; --- 86,99 ---- else { + float lookAz_rad = sensor_kin.mfHeading_rad + mountAz_rad; float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; ! fCoverageAz1 = lookAz_rad - fHalfFOV_rad; ! fCoverageAz2 = lookAz_rad + fHalfFOV_rad; ! bInSearchVolume = AngleWithinRange(fTargetAz_rad, fCoverageAz1, fCoverageAz2) != 0; if (!bInSearchVolume) {return false;} } // check same for emitter ! if (emitterFOV_rad >= C_TWOPIM) { bInEmitterScan = true; *************** *** 82,97 **** else { ! float fEmitterAz_rad = fTargetAz_rad + C_PI; // az of this plat relative to emitter ! if (fEmitterAz_rad > C_TWOPI) {fEmitterAz_rad -= C_TWOPI;} ! float fHalfFOV_rad = 0.5f*asETI.mfEmitterFOV_rad; ! fCoverageAz1 = asETI.mfEmitterAz_rad - fHalfFOV_rad; ! fCoverageAz2 = asETI.mfEmitterAz_rad + fHalfFOV_rad; ! bInEmitterScan = AngleWithinRange(fEmitterAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInEmitterScan) {return false;} } ! float fRadarHorizon = C_RADARHOR*(sqrtf(asETI.mfAlt_m) +sqrtf(msCurrentPos.mfAlt_m)); ! fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! asETI.mfLat_rad,asETI.mfLon_rad); //rfRange_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) --- 101,117 ---- else { ! float esmBearing_rad = fTargetAz_rad + C_PI; // bearing of ESM platform relative to emitter ! if (esmBearing_rad > C_TWOPI) {esmBearing_rad -= C_TWOPI;} ! float fHalfFOV_rad = 0.5f * emitterFOV_rad; ! fCoverageAz1 = emitterAz_rad - fHalfFOV_rad; ! fCoverageAz2 = emitterAz_rad + fHalfFOV_rad; ! bInEmitterScan = AngleWithinRange(esmBearing_rad, fCoverageAz1, fCoverageAz2) != 0; if (!bInEmitterScan) {return false;} } ! float fRadarHorizon = C_RADARHOR*(sqrtf(emitter_kin.mfAlt_m) + sqrtf(sensor_kin.mfAlt_m)); ! fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad( ! sensor_kin.mfLat_rad, sensor_kin.mfLon_rad, ! emitter_kin.mfLat_rad, emitter_kin.mfLon_rad); //rfRange_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) *************** *** 100,104 **** } ! float fSNR = asETI.mfEmitterERP_dBW + 20.0f*(log10f(mpDBObj->mfRefRange_km)-log10f(fTargetRange_km)); --- 120,124 ---- } ! float fSNR = emitterERP_dBW + 20.0f*(log10f(mpDBObj->mfRefRange_km)-log10f(fTargetRange_km)); Index: tcGameObjIterator.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObjIterator.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcGameObjIterator.cpp 7 Feb 2004 02:19:54 -0000 1.1 --- tcGameObjIterator.cpp 12 Feb 2004 01:54:49 -0000 1.2 *************** *** 69,73 **** { long id; ! simState->maPlatformState.GetNextAssoc(currentPos, id, currentObj); nIterated++; --- 69,76 ---- { long id; ! if (nIterated < nSize) // kind of a hack, nIterated > nSize is used for end condition ! { ! simState->maPlatformState.GetNextAssoc(currentPos, id, currentObj); ! } nIterated++; Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcLauncherState.cpp 7 Feb 2004 02:19:54 -0000 1.6 --- tcLauncherState.cpp 12 Feb 2004 01:54:49 -0000 1.7 *************** *** 177,190 **** } tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); - - float seekerAz = parent->mcKin.mfHeading_rad + ldata.pointingAngle; - tsGeoPoint seekerLoc; - seekerLoc.Set((float)parent->mcKin.mfLon_rad,(float)parent->mcKin.mfLat_rad); long fcID = parent->mnID; unsigned fcIdx = ldata.fireControlSensorIdx; ! bool canDetect = ! simState->RadarCanDetect(nSensorKey,targetObj,seekerLoc,seekerAz, fcID, fcIdx); if (canDetect) { --- 177,187 ---- } tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); long fcID = parent->mnID; unsigned fcIdx = ldata.fireControlSensorIdx; ! bool canDetect = simState->RadarCanDetect(nSensorKey, targetObj, ! parent, ldata.pointingAngle, fcID, fcIdx); ! if (canDetect) { Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcRadar.cpp 7 Feb 2004 02:19:54 -0000 1.1 --- tcRadar.cpp 12 Feb 2004 01:54:49 -0000 1.2 *************** *** 103,108 **** } ! ! const tcKinematics *kin = &target->mcKin; if (mpDBObj->mfFieldOfView_deg >= 360.0f) { --- 103,108 ---- } ! const tcKinematics *rdr_kin = &parent->mcKin; // kinematic state of radar parent object ! const tcKinematics *tgt_kin = &target->mcKin; // state of target object if (mpDBObj->mfFieldOfView_deg >= 360.0f) { *************** *** 111,126 **** else { ! fTargetAz_rad = nsNav::GCHeadingApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! kin->mfLat_rad,kin->mfLon_rad); float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; ! fCoverageAz1 = mfLookAz_rad - fHalfFOV_rad; ! fCoverageAz2 = mfLookAz_rad + fHalfFOV_rad; bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInSearchVolume) {range_km=0;return false;} } ! float fRadarHorizon = C_RADARHOR*(sqrtf(kin->mfAlt_m) +sqrtf(msCurrentPos.mfAlt_m)); ! fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, ! kin->mfLat_rad,kin->mfLon_rad); range_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) --- 111,127 ---- else { ! float lookAz_rad = parent->mcKin.mfHeading_rad + mountAz_rad; ! fTargetAz_rad = nsNav::GCHeadingApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, ! tgt_kin->mfLat_rad, tgt_kin->mfLon_rad); float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; ! fCoverageAz1 = lookAz_rad - fHalfFOV_rad; ! fCoverageAz2 = lookAz_rad + fHalfFOV_rad; bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInSearchVolume) {range_km=0;return false;} } ! float fRadarHorizon = C_RADARHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m)); ! fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, ! tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); range_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) *************** *** 254,257 **** --- 255,290 ---- { if (!UpdateScan(t)) return; // only update once per scan period + wxASSERT(parent); + + tcRect region; + GetTestArea(region); + + /* + tnPoolIndex aTargetKeys[100]; + tnPoolIndex nTargetID; + int nCount; + + tsGeoPoint currentpos; + tcGameObject *pTarget; + + currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad,applat->mcKin.mfAlt_m); + apSensorState->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); + apSensorState->GetTestArea(region); + nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); + bool bOwnAllianceUpdate = mpUserInfo->IsOwnAlliance(applat->mnAlliance); + for(int k=0;k<nCount;k++) { + nTargetID = aTargetKeys[k]; + if (nTargetID != applat->mnID) { // no self detection + pTarget = GetObject(nTargetID); + tcRadar *pRadarSS = dynamic_cast<tcRadar*>(apSensorState); + if (pRadarSS) { + ProcessRadarDetection(applat,pTarget,pRadarSS); + } + else if (tcESMSensor *pESMSS = dynamic_cast<tcESMSensor*>(apSensorState)) { + ProcessESMDetection(applat,pTarget,pESMSS); + } + } + } + */ } Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSensorState.cpp 7 Feb 2004 02:19:54 -0000 1.5 --- tcSensorState.cpp 12 Feb 2004 01:54:49 -0000 1.6 *************** *** 30,56 **** void tcSensorState::GetTestArea(tcRect& region) { ! if (mpDBObj==NULL) {return;} float fRangeX_rad, fRangeY_rad; fRangeY_rad = C_KMTORAD*mpDBObj->mfMaxRange_km; ! fRangeX_rad = fRangeY_rad/cosf(msCurrentPos.mfLat_rad); ! ! region.left = msCurrentPos.mfLon_rad - fRangeX_rad; ! region.right = msCurrentPos.mfLon_rad + fRangeX_rad; ! region.bottom = msCurrentPos.mfLat_rad - fRangeY_rad; ! region.top = msCurrentPos.mfLat_rad + fRangeY_rad; ! } ! /** ! * may want to change this to use a pointer to the platform ! * to get platform info vs. passing this information with ! * methods like this. ! * @param az_rad platform heading ! */ ! void tcSensorState::UpdateCoverage(tsGeoPoint p,float az_rad) ! { ! msCurrentPos.mfLon_rad = p.mfLon_rad; ! msCurrentPos.mfLat_rad = p.mfLat_rad; ! mfLookAz_rad = az_rad + mountAz_rad; ! msCurrentPos.mfAlt_m = p.mfAlt_m + mfSensorHeight_m; } --- 30,44 ---- void tcSensorState::GetTestArea(tcRect& region) { ! wxASSERT(mpDBObj); ! wxASSERT(parent); ! //if (mpDBObj==NULL) {return;} float fRangeX_rad, fRangeY_rad; fRangeY_rad = C_KMTORAD*mpDBObj->mfMaxRange_km; ! fRangeX_rad = fRangeY_rad/cosf(parent->mcKin.mfLat_rad); ! region.left = parent->mcKin.mfLon_rad - fRangeX_rad; ! region.right = parent->mcKin.mfLon_rad + fRangeX_rad; ! region.bottom = parent->mcKin.mfLat_rad - fRangeY_rad; ! region.top = parent->mcKin.mfLat_rad + fRangeY_rad; } *************** *** 87,95 **** file.Read(&mfCurrentScanPeriod_s,sizeof(mfCurrentScanPeriod_s)); file.Read(&mfLastScan,sizeof(mfLastScan)); - file.Read(&mfLookAz_rad,sizeof(mfLookAz_rad)); file.Read(&mountAz_rad,sizeof(mountAz_rad)); file.Read(&mfSensorHeight_m,sizeof(mfSensorHeight_m)); file.Read(&mnMode,sizeof(mnMode)); - file.Read(&msCurrentPos,sizeof(msCurrentPos)); } else --- 75,81 ---- *************** *** 99,107 **** file.Write(&mfCurrentScanPeriod_s,sizeof(mfCurrentScanPeriod_s)); file.Write(&mfLastScan,sizeof(mfLastScan)); - file.Write(&mfLookAz_rad,sizeof(mfLookAz_rad)); file.Write(&mountAz_rad,sizeof(mountAz_rad)); file.Write(&mfSensorHeight_m,sizeof(mfSensorHeight_m)); file.Write(&mnMode,sizeof(mnMode)); - file.Write(&msCurrentPos,sizeof(msCurrentPos)); } } --- 85,91 ---- *************** *** 140,150 **** mfCurrentScanPeriod_s = ss.mfCurrentScanPeriod_s; mfLastScan = ss.mfLastScan; - mfLookAz_rad = ss.mfLookAz_rad; mountAz_rad = ss.mountAz_rad; ! mfSensorHeight_m =ss.mfSensorHeight_m; mnDBKey = ss.mnDBKey; mnMode = ss.mnMode; mpDBObj = ss.mpDBObj; ! msCurrentPos = ss.msCurrentPos; return(*this); } --- 124,133 ---- mfCurrentScanPeriod_s = ss.mfCurrentScanPeriod_s; mfLastScan = ss.mfLastScan; mountAz_rad = ss.mountAz_rad; ! mfSensorHeight_m = ss.mfSensorHeight_m; mnDBKey = ss.mnDBKey; mnMode = ss.mnMode; mpDBObj = ss.mpDBObj; ! parent = NULL; return(*this); } Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcSimState.cpp 7 Feb 2004 02:19:54 -0000 1.30 --- tcSimState.cpp 12 Feb 2004 01:54:49 -0000 1.31 *************** *** 126,143 **** * If this is used with a non forward looking radar, it will not work * correctly. * @param fcID id of platform that has fire control sensor (for semi-active) * @param fcIdx index of fire control sensor on fc platform (for semi-active) */ bool tcSimState::RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, ! tsGeoPoint asSensorLocation, float afSensorAz, long fcID, unsigned fcIdx) { float fRange_km; ! if (mcDefaultRadar.InitFromDB(mpDatabase,anSensorKey,0)==false) { return false; } mcDefaultRadar.mbActive = true; if (mcDefaultRadar.IsSemiactive()) --- 126,146 ---- * If this is used with a non forward looking radar, it will not work * correctly. + * @param reference object that radar is assumed co-located with + * @param afSensorAz mount azimuth relative to reference obj heading * @param fcID id of platform that has fire control sensor (for semi-active) * @param fcIdx index of fire control sensor on fc platform (for semi-active) */ bool tcSimState::RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, ! tcGameObject* reference, float afSensorAz, long fcID, unsigned fcIdx) { float fRange_km; ! if (mcDefaultRadar.InitFromDB(mpDatabase, anSensorKey, afSensorAz)==false) { return false; } mcDefaultRadar.mbActive = true; + mcDefaultRadar.SetParent(reference); if (mcDefaultRadar.IsSemiactive()) *************** *** 145,149 **** mcDefaultRadar.SetIlluminator(fcID, fcIdx); } ! mcDefaultRadar.UpdateCoverage(asSensorLocation,afSensorAz); return mcDefaultRadar.CanDetectTarget(target,fRange_km); } --- 148,152 ---- mcDefaultRadar.SetIlluminator(fcID, fcIdx); } ! return mcDefaultRadar.CanDetectTarget(target,fRange_km); } *************** *** 738,754 **** /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, ! tcGameObject *apEmitterPlatform, float& rfAz_rad) { ! if ((!apEmitterRadar->mbActive)||(apEmitterRadar->IsSemiactive())) {return false;} ! tsESMTargetInfo sETI; ! sETI.mfLat_rad = (float)apEmitterPlatform->mcKin.mfLat_rad; ! sETI.mfLon_rad = (float)apEmitterPlatform->mcKin.mfLon_rad; ! sETI.mfAlt_m = apEmitterPlatform->mcKin.mfAlt_m; ! sETI.mfEmitterERP_dBW = apEmitterRadar->mpDBObj->mfERP_dBW; ! sETI.mfEmitterFOV_rad = C_PIOVER180*apEmitterRadar->mpDBObj->mfFieldOfView_deg; ! // look az is az relative to north, might have to change later ! sETI.mfEmitterAz_rad = apEmitterRadar->mfLookAz_rad; // + apEmitterPlatform->mcKin.mfHeading_rad; ! return apESM->IsDetected(sETI,rfAz_rad); } --- 741,747 ---- /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, float& rfAz_rad) { ! return apESM->IsDetected(apEmitterRadar, rfAz_rad); } *************** *** 768,772 **** if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(apTarget)) { tcRadar *pRadarSS = pMissileObj->GetSensorState(); ! bDetected = IsDetectedESM(apESMSS, pRadarSS, apTarget, fAz_rad); if ((bDetected)&&(nEmitters < MAX_EMITTERS)) { maEmitter[nEmitters++] = pRadarSS->mnDBKey; --- 761,765 ---- if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(apTarget)) { tcRadar *pRadarSS = pMissileObj->GetSensorState(); ! bDetected = IsDetectedESM(apESMSS, pRadarSS, fAz_rad); if ((bDetected)&&(nEmitters < MAX_EMITTERS)) { maEmitter[nEmitters++] = pRadarSS->mnDBKey; *************** *** 780,784 **** tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorArray->at(n)); if (pRadarSS) { ! if (IsDetectedESM(apESMSS, pRadarSS, apTarget, fAz_rad)) { bDetected = true; if (nEmitters < MAX_EMITTERS) { --- 773,778 ---- tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorArray->at(n)); if (pRadarSS) { ! if (IsDetectedESM(apESMSS, pRadarSS, fAz_rad)) ! { bDetected = true; if (nEmitters < MAX_EMITTERS) { *************** *** 871,875 **** currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad,applat->mcKin.mfAlt_m); ! apSensorState->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); apSensorState->GetTestArea(region); nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); --- 865,869 ---- currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad,applat->mcKin.mfAlt_m); ! //apSensorState->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); apSensorState->GetTestArea(region); nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); *************** *** 905,909 **** currentpos.Set((float)apGameObj->mcKin.mfLon_rad,(float)apGameObj->mcKin.mfLat_rad, apGameObj->mcKin.mfAlt_m); ! apRadarSS->UpdateCoverage(currentpos,apGameObj->mcKin.mfHeading_rad); apRadarSS->GetTestArea(region); nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); --- 899,903 ---- currentpos.Set((float)apGameObj->mcKin.mfLon_rad,(float)apGameObj->mcKin.mfLat_rad, apGameObj->mcKin.mfAlt_m); ! //apRadarSS->UpdateCoverage(currentpos,apGameObj->mcKin.mfHeading_rad); apRadarSS->GetTestArea(region); nCount = GetPlatformsWithinRegion(aTargetKeys, 100, ®ion); *************** *** 1038,1042 **** } /********************************************************************/ ! void tcSimState::UpdateSeeker(tcGameObject *applat, tcRadar *apRadarSS) { long nTargetID; tsGeoPoint currentpos; --- 1032,1037 ---- } /********************************************************************/ ! void tcSimState::UpdateSeeker(tcGameObject *applat, tcRadar *apRadarSS) ! { long nTargetID; tsGeoPoint currentpos; *************** *** 1052,1056 **** currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad); ! apRadarSS->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); pTrack = &apRadarSS->mcTrack; --- 1047,1051 ---- currentpos.Set((float)applat->mcKin.mfLon_rad,(float)applat->mcKin.mfLat_rad); ! //apRadarSS->UpdateCoverage(currentpos,applat->mcKin.mfHeading_rad); pTrack = &apRadarSS->mcTrack; |
From: <ddc...@us...> - 2004-02-12 01:59:23
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26928/src/graphics Modified Files: cspSky.cpp Log Message: Index: cspSky.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/cspSky.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** cspSky.cpp 20 Jan 2004 03:02:53 -0000 1.6 --- cspSky.cpp 12 Feb 2004 01:54:49 -0000 1.7 *************** *** 212,221 **** Vec4Array::const_iterator c = _colorList->begin(); ! glPushAttrib(GL_ENABLE_BIT); glPushMatrix(); glRotatef(rx, 1, 0, 0); glRotatef(rz, 0, 0, 1); glBegin(GL_POINTS); ! glEnable(GL_BLEND); for (; --i >= 0; ++c, ++p) { --- 212,221 ---- Vec4Array::const_iterator c = _colorList->begin(); ! //glPushAttrib(GL_ENABLE_BIT); glPushMatrix(); glRotatef(rx, 1, 0, 0); glRotatef(rz, 0, 0, 1); glBegin(GL_POINTS); ! //glEnable(GL_BLEND); // this line suddenly started causing OSG OpenGL errors with State::apply !? for (; --i >= 0; ++c, ++p) { *************** *** 226,230 **** glEnd(); glPopMatrix(); ! glPopAttrib(); //PROF1(_stars, 4); } --- 226,230 ---- glEnd(); glPopMatrix(); ! //glPopAttrib(); //PROF1(_stars, 4); } *************** *** 1256,1259 **** --- 1256,1269 ---- depth->setWriteMask(false); star_state->setAttributeAndModes(depth,StateAttribute::OFF); + + /* added this code instead of the glEnable(GL_BLEND) in StarSystem::drawImplementation + Though the blend never worked before, the old code suddenly starting causing OpenGL + errors in State::apply after adding the new radar code (which has NOTHING to do with + graphics). + */ + osg::BlendFunc *blendFunction = new osg::BlendFunc; + blendFunction->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA); + star_state->setAttributeAndModes(blendFunction, osg::StateAttribute::ON); + } |
From: <ddc...@us...> - 2004-02-12 01:59:23
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26928/include/sim Modified Files: tcESMSensor.h tcPool.h tcRadar.h tcSensorState.h tcSimState.h Log Message: Index: tcESMSensor.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcESMSensor.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcESMSensor.h 7 Feb 2004 02:19:54 -0000 1.1 --- tcESMSensor.h 12 Feb 2004 01:54:49 -0000 1.2 *************** *** 28,46 **** class tcGameObject; using namespace Database; - /** - * - */ - typedef struct _ESMtargetinfo - { - float mfLat_rad; - float mfLon_rad; - float mfAlt_m; - float mfEmitterAz_rad; // azimuth of center of emitter coverage - float mfEmitterFOV_rad; - float mfEmitterERP_dBW; - } tsESMTargetInfo; /** --- 28,35 ---- class tcGameObject; + class tcRadar; using namespace Database; /** *************** *** 53,57 **** bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); ! bool IsDetected(const tsESMTargetInfo& asETI, float& rfAz_rad); void Serialize(tcFile& file, bool mbLoad); virtual void Update(double t); --- 42,46 ---- bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); ! bool IsDetected(const tcRadar* emitter, float& rfAz_rad); void Serialize(tcFile& file, bool mbLoad); virtual void Update(double t); Index: tcPool.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPool.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcPool.h 7 Feb 2004 02:19:54 -0000 1.3 --- tcPool.h 12 Feb 2004 01:54:49 -0000 1.4 *************** *** 24,27 **** --- 24,28 ---- #include "wx/wx.h" // for NULL definition + #include <iostream> #define NULL_INDEX -1 *************** *** 70,73 **** --- 71,78 ---- { pt = NULL; + if (n >=0) + { + std::cerr << "error - invalid pool index" << std::endl; + } return false; } *************** *** 80,83 **** --- 85,89 ---- newkey = NULL_INDEX; pt = NULL; + std::cerr << "error - pool out of memory" << std::endl; return false; // out of memory } *************** *** 103,106 **** --- 109,113 ---- if (mnSize >= POOLSIZE) { newkey = NULL_INDEX; + std::cerr << "error - pool out of memory" << std::endl; return false; // out of memory } *************** *** 135,139 **** tnPoolIndex nDefaultKey; ! if (mnSize >= POOLSIZE) { return false; // out of memory } --- 142,148 ---- tnPoolIndex nDefaultKey; ! if (mnSize >= POOLSIZE) ! { ! std::cerr << "error - pool out of memory" << std::endl; return false; // out of memory } *************** *** 149,153 **** } } ! if (!bFound) {return false;} // return without adding element if not found mnCheckoutIndex++; mnSize++; --- 158,166 ---- } } ! if (!bFound) ! { ! std::cerr << "error - AddElementForceKey - pool element not found" << std::endl; ! return false; ! } // return without adding element if not found mnCheckoutIndex++; mnSize++; *************** *** 186,189 **** --- 199,206 ---- pt = NULL; index = NULL_INDEX; + if (pos >=0) + { + std::cerr << "error - bad pool index" << std::endl; + } return; } *************** *** 195,243 **** template <class T, int POOLSIZE> tnPoolIndex tcPool<T,POOLSIZE>::GetNextKey(tnPoolIndex pos){ ! if ((pos < 0)||(pos >= POOLSIZE)) { ! return NULL_INDEX; ! } ! if (maNext[pos] == NULL_INDEX) { ! return mnBase; // end of list, circle to beginning ! } ! else { ! return maNext[pos]; ! } } /**********************************************************/ template <class T, int POOLSIZE> ! tnPoolIndex tcPool<T,POOLSIZE>::GetPrevKey(tnPoolIndex pos){ ! if ((pos < 0)||(pos >= POOLSIZE)) { ! return NULL_INDEX; ! } ! if (maPrev[pos] == NULL_INDEX) { ! return mnTail; // beginning of list, circle to end ! } ! else { ! return maPrev[pos]; ! } } /**********************************************************/ template <class T, int POOLSIZE> ! T tcPool<T,POOLSIZE>::operator[] (tnPoolIndex index) const { ! if ((index < 0)||(index >= POOLSIZE)) { ! return *mpool[0]; ! } ! else { ! return *mpool[index]; ! } } /**********************************************************/ template <class T, int POOLSIZE> ! bool tcPool<T,POOLSIZE>::RemoveKey(tnPoolIndex n) { ! if ((mnSize == 0)||(mnReturnIndex==mnCheckoutIndex)) { ! return false; // empty pool, nothing to remove ! } ! if (n < 0) return false; // return key to available maAvailable[mnReturnIndex++] = n; if (mnReturnIndex == POOLSIZE) { ! mnReturnIndex = 0; } // remove from list --- 212,285 ---- template <class T, int POOLSIZE> tnPoolIndex tcPool<T,POOLSIZE>::GetNextKey(tnPoolIndex pos){ ! if ((pos < 0)||(pos >= POOLSIZE)) ! { ! if (pos >=0) ! { ! std::cerr << "error - bad pool index" << std::endl; ! } ! return NULL_INDEX; ! } ! if (maNext[pos] == NULL_INDEX) ! { ! return mnBase; // end of list, circle to beginning ! } ! else { ! return maNext[pos]; ! } } /**********************************************************/ template <class T, int POOLSIZE> ! tnPoolIndex tcPool<T,POOLSIZE>::GetPrevKey(tnPoolIndex pos) ! { ! if ((pos < 0)||(pos >= POOLSIZE)) ! { ! if (pos >=0) ! { ! std::cerr << "error - bad pool index" << std::endl; ! } ! return NULL_INDEX; ! } ! if (maPrev[pos] == NULL_INDEX) ! { ! return mnTail; // beginning of list, circle to end ! } ! else ! { ! return maPrev[pos]; ! } } /**********************************************************/ template <class T, int POOLSIZE> ! T tcPool<T,POOLSIZE>::operator[] (tnPoolIndex index) const ! { ! if ((index < 0)||(index >= POOLSIZE)) ! { ! std::cerr << "error - operator[] - bad pool index" << std::endl; ! return *mpool[0]; ! } ! else ! { ! return *mpool[index]; ! } } /**********************************************************/ template <class T, int POOLSIZE> ! bool tcPool<T,POOLSIZE>::RemoveKey(tnPoolIndex n) ! { ! if ((mnSize == 0)||(mnReturnIndex==mnCheckoutIndex)) ! { ! std::cerr << "error - RemoveKey - empty pool, nothing to remove" << std::endl; ! return false; // empty pool, nothing to remove ! } ! if (n < 0) ! { ! std::cerr << "error - RemoveKey - bad pool index" << std::endl; ! return false; ! } // return key to available maAvailable[mnReturnIndex++] = n; if (mnReturnIndex == POOLSIZE) { ! mnReturnIndex = 0; } // remove from list *************** *** 245,258 **** mpool[n] = NULL; if (n==mnBase) { ! mnBase = maNext[n]; // if n is base then n next becomes new base } if (n==mnTail) { ! mnTail = maPrev[n]; // if n is tail then n prev becomes new tail } if (maPrev[n] < POOLSIZE) { ! maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid } if (maNext[n] < POOLSIZE) { ! maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid } mnSize--; --- 287,300 ---- mpool[n] = NULL; if (n==mnBase) { ! mnBase = maNext[n]; // if n is base then n next becomes new base } if (n==mnTail) { ! mnTail = maPrev[n]; // if n is tail then n prev becomes new tail } if (maPrev[n] < POOLSIZE) { ! maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid } if (maNext[n] < POOLSIZE) { ! maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid } mnSize--; *************** *** 265,300 **** */ template <class T, int POOLSIZE> ! bool tcPool<T,POOLSIZE>::RemoveKeyWithoutDelete(tnPoolIndex n) { ! if ((mnSize == 0)||(mnReturnIndex==mnCheckoutIndex)) { ! return false; // empty pool, nothing to remove ! } ! if (n < 0) return false; ! // return key to available ! maAvailable[mnReturnIndex++] = n; ! if (mnReturnIndex == POOLSIZE) { ! mnReturnIndex = 0; ! } ! // remove from list ! mpool[n] = NULL; ! if (n==mnBase) { ! mnBase = maNext[n]; // if n is base then n next becomes new base ! } ! if (n==mnTail) { ! mnTail = maPrev[n]; // if n is tail then n prev becomes new tail ! } ! if (maPrev[n] < POOLSIZE) { ! maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid ! } ! if (maNext[n] < POOLSIZE) { ! maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid ! } ! mnSize--; ! return true; } /**********************************************************/ template <class T, int POOLSIZE> ! void tcPool<T,POOLSIZE>::RemoveAll(void) { ! for(tnPoolIndex k=0;k<POOLSIZE;k++) { ! if (mpool[k] != NULL) { delete mpool[k]; mpool[k] = NULL; --- 307,354 ---- */ template <class T, int POOLSIZE> ! bool tcPool<T,POOLSIZE>::RemoveKeyWithoutDelete(tnPoolIndex n) ! { ! if ((mnSize == 0)||(mnReturnIndex==mnCheckoutIndex)) ! { ! std::cerr << ! "error - RemoveKeyWithoutDelete - empty pool, nothing to remove" ! << std::endl; ! return false; // empty pool, nothing to remove ! } ! if ((n < 0)||(n >= POOLSIZE)||(mpool[n]==NULL)) ! { ! std::cerr << "error - RemoveKeyWithoutDelete - bad index" << std::endl; ! return false; ! } ! // return key to available ! maAvailable[mnReturnIndex++] = n; ! if (mnReturnIndex == POOLSIZE) { ! mnReturnIndex = 0; ! } ! // remove from list ! mpool[n] = NULL; ! if (n==mnBase) { ! mnBase = maNext[n]; // if n is base then n next becomes new base ! } ! if (n==mnTail) { ! mnTail = maPrev[n]; // if n is tail then n prev becomes new tail ! } ! if (maPrev[n] < POOLSIZE) { ! maNext[maPrev[n]] = maNext[n]; // maNext[n] can be invalid ! } ! if (maNext[n] < POOLSIZE) { ! maPrev[maNext[n]] = maPrev[n]; // maPrev[n] can be invalid ! } ! mnSize--; ! return true; } /**********************************************************/ template <class T, int POOLSIZE> ! void tcPool<T,POOLSIZE>::RemoveAll(void) ! { ! for(tnPoolIndex k=0;k<POOLSIZE;k++) ! { ! if (mpool[k] != NULL) ! { delete mpool[k]; mpool[k] = NULL; *************** *** 312,316 **** /**********************************************************/ template <class T, int POOLSIZE> ! tcPool<T,POOLSIZE>::tcPool<T,POOLSIZE>() { mnSize = 0; mnBase = NULL_INDEX; // value NULL_INDEX is OOB and used as invalid --- 366,371 ---- /**********************************************************/ template <class T, int POOLSIZE> ! tcPool<T,POOLSIZE>::tcPool<T,POOLSIZE>() ! { mnSize = 0; mnBase = NULL_INDEX; // value NULL_INDEX is OOB and used as invalid *************** *** 318,322 **** mnCheckoutIndex = 0; mnReturnIndex = 0; ! for(tnPoolIndex k=0;k<POOLSIZE;k++) { mpool[k] = NULL; maPrev[k] = NULL_INDEX; --- 373,378 ---- mnCheckoutIndex = 0; mnReturnIndex = 0; ! for(tnPoolIndex k=0;k<POOLSIZE;k++) ! { mpool[k] = NULL; maPrev[k] = NULL_INDEX; *************** *** 327,335 **** /**********************************************************/ template <class T, int POOLSIZE> ! tcPool<T,POOLSIZE>::~tcPool<T,POOLSIZE>() { ! for(tnPoolIndex k=0;k<POOLSIZE;k++) { // TODO: without the extra check this occasionally causes an exception/ // due to deleting an invalid memory location ! if ((mpool[k] != NULL)&&(mpool[k] > (void*)0x000000FF)) { delete mpool[k]; mpool[k] = NULL; --- 383,394 ---- /**********************************************************/ template <class T, int POOLSIZE> ! tcPool<T,POOLSIZE>::~tcPool<T,POOLSIZE>() ! { ! for(tnPoolIndex k=0;k<POOLSIZE;k++) ! { // TODO: without the extra check this occasionally causes an exception/ // due to deleting an invalid memory location ! if ((mpool[k] != NULL)&&(mpool[k] > (void*)0x000000FF)) ! { delete mpool[k]; mpool[k] = NULL; *************** *** 339,345 **** /**********************************************************/ template <class T, int POOLSIZE> ! tnPoolIndex tcPool<T,POOLSIZE>::GetPoolSize() { return POOLSIZE; } ! #endif // !defined(AFX_TCPOOL_H__755B583F_35DC_4BB0_96E0_AF9BC7EB29DE__INCLUDED_) --- 398,405 ---- /**********************************************************/ template <class T, int POOLSIZE> ! tnPoolIndex tcPool<T,POOLSIZE>::GetPoolSize() ! { return POOLSIZE; } ! #endif Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcRadar.h 7 Feb 2004 02:19:54 -0000 1.1 --- tcRadar.h 12 Feb 2004 01:54:49 -0000 1.2 *************** *** 69,73 **** virtual bool IsCommandReceiver() {return isCommandReceiver;} ! virtual bool IsSemiactive() {return isSemiactive;} virtual void SetIlluminator(long illum_id, unsigned sensor_idx); --- 69,73 ---- virtual bool IsCommandReceiver() {return isCommandReceiver;} ! virtual bool IsSemiactive() const {return isSemiactive;} virtual void SetIlluminator(long illum_id, unsigned sensor_idx); Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSensorState.h 7 Feb 2004 02:19:54 -0000 1.6 --- tcSensorState.h 12 Feb 2004 01:54:49 -0000 1.7 *************** *** 54,59 **** int mnMode; tcTrack mcTrack; ! tsGeoPoint msCurrentPos; ///< current true position of sensor ! float mfLookAz_rad; ///< azimuth of center of coverage relative to north float mountAz_rad; ///< mounted azimuth of boresight relative to nose/bow of platform float mfSensorHeight_m; ///< height of sensor relative to platform altitude --- 54,59 ---- int mnMode; tcTrack mcTrack; ! //tsGeoPoint msCurrentPos; ///< current true position of sensor ! //float mfLookAz_rad; ///< azimuth of center of coverage relative to north float mountAz_rad; ///< mounted azimuth of boresight relative to nose/bow of platform float mfSensorHeight_m; ///< height of sensor relative to platform altitude *************** *** 63,69 **** virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); void Serialize(tcFile& file, bool mbLoad); void SetParent(tcGameObject *obj) {parent = obj;} virtual void Update(double t); - void UpdateCoverage(tsGeoPoint p,float az_rad); int UpdateScan(double afTime); tcSensorState& operator=(tcSensorState& ss); --- 63,69 ---- virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); void Serialize(tcFile& file, bool mbLoad); + void SetMountAz(float az) {mountAz_rad = az;} void SetParent(tcGameObject *obj) {parent = obj;} virtual void Update(double t); int UpdateScan(double afTime); tcSensorState& operator=(tcSensorState& ss); Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcSimState.h 7 Feb 2004 02:19:54 -0000 1.14 --- tcSimState.h 12 Feb 2004 01:54:49 -0000 1.15 *************** *** 102,107 **** void AttachUserInfo(tcUserInfo *apUserInfo) {mpUserInfo=apUserInfo;} void BuildCollisionGroups(); - bool RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, - tsGeoPoint asSensorLocation, float afSensorAz, long fcID = -1, unsigned fcIdx = 0); void ChangeHeading(long anKey, float afNewHeading); void ChangeHeadingForced(tnPoolIndex anKey, float afNewHeading); // for scen edit mode --- 102,105 ---- *************** *** 144,147 **** --- 142,147 ---- void PrintToFile(tcString); void ProcessLanding(tcGameObject *receiver, tcGameObject *landing_unit); + bool RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, + tcGameObject* reference, float afSensorAz, long fcID = -1, unsigned fcIdx = 0); void RandInit(void); void RemoveDestroyedObjects(void); *************** *** 174,179 **** float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); ! bool IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, ! tcGameObject *apEmitterPlatform, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); void ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, --- 174,178 ---- float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); ! bool IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); void ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, |
From: <ddc...@us...> - 2004-02-07 02:23:07
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/src/sim Modified Files: tcLauncherState.cpp tcMissileObject.cpp tcPlatformObject.cpp tcSensorMap.cpp tcSensorState.cpp tcSimState.cpp Added Files: tcESMSensor.cpp tcGameObjIterator.cpp tcRadar.cpp Removed Files: tcESMSensorState.cpp tcRadarSensorState.cpp Log Message: --- NEW FILE: tcESMSensor.cpp --- /* * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. * * This file is part of the Global Conflict Blue (GCB) program. * GCB is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * GCB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GCB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tcESMSensor.h" #include "aerror.h" #include "nsNav.h" /** * */ bool tcESMSensor::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { tcSensorState::InitFromDB(apDatabase, anKey, mountAzimuth_rad); mpDBObj = dynamic_cast<tcESMDBObject*>(apDatabase->GetObject(anKey)); if (mpDBObj == NULL) { WTL("Error - tcESMSensor::InitFromDB - Not found in db or bad class for key"); return false; } mfSensorHeight_m = 10.0f; mnMode = SSMODE_SURVEILLANCE; mbActive = true; return true; } /** * */ bool tcESMSensor::IsDetected(const tsESMTargetInfo& asETI, float& rfAz_rad) { float fTargetAz_rad; float fTargetRange_km; float fCoverageAz1, fCoverageAz2; bool bInSearchVolume = false; bool bInEmitterScan = false; if (mpDBObj==NULL) { return false; } fTargetAz_rad = nsNav::GCHeadingApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, asETI.mfLat_rad,asETI.mfLon_rad); rfAz_rad = fTargetAz_rad; if (rfAz_rad < 0) {rfAz_rad += C_TWOPI;} if (mpDBObj->mfFieldOfView_deg >= 360.0f) { bInSearchVolume = true; } else { float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; fCoverageAz1 = mfLookAz_rad - fHalfFOV_rad; fCoverageAz2 = mfLookAz_rad + fHalfFOV_rad; bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInSearchVolume) {return false;} } // check same for emitter if (asETI.mfEmitterFOV_rad >= C_TWOPIM) { bInEmitterScan = true; } else { float fEmitterAz_rad = fTargetAz_rad + C_PI; // az of this plat relative to emitter if (fEmitterAz_rad > C_TWOPI) {fEmitterAz_rad -= C_TWOPI;} float fHalfFOV_rad = 0.5f*asETI.mfEmitterFOV_rad; fCoverageAz1 = asETI.mfEmitterAz_rad - fHalfFOV_rad; fCoverageAz2 = asETI.mfEmitterAz_rad + fHalfFOV_rad; bInEmitterScan = AngleWithinRange(fEmitterAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInEmitterScan) {return false;} } float fRadarHorizon = C_RADARHOR*(sqrtf(asETI.mfAlt_m) +sqrtf(msCurrentPos.mfAlt_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, asETI.mfLat_rad,asETI.mfLon_rad); //rfRange_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) { return false; } float fSNR = asETI.mfEmitterERP_dBW + 20.0f*(log10f(mpDBObj->mfRefRange_km)-log10f(fTargetRange_km)); if (fSNR >= 0) { return true; } return false; } /** * */ void tcESMSensor::Serialize(tcFile& file, bool mbLoad) { tcSensorState::Serialize(file, mbLoad); } void tcESMSensor::Update(double t) { } /** * */ tcESMSensor& tcESMSensor::operator=(tcESMSensor& ss) { tcSensorState::operator =(ss); mpDBObj = ss.mpDBObj; return(*this); } /** * */ tcESMSensor* tcESMSensor::Clone(void) { tcESMSensor *pNew = new tcESMSensor(); *pNew = *this; return pNew; } /** * */ tcESMSensor::tcESMSensor() : tcSensorState() { mpDBObj = NULL; } tcESMSensor::tcESMSensor(tcGameObject *obj) : tcSensorState(obj) { } /** * */ tcESMSensor::~tcESMSensor() {} --- NEW FILE: tcGameObjIterator.cpp --- /** @file tcGameObjIterator.cpp */ /** * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. * * This file is part of the Global Conflict Blue (GCB) program. * GCB is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * GCB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GCB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #endif #include "tcGameObjIterator.h" #include "tcGameObject.h" #include "tcSimState.h" tcSimState* tcGameObjIterator::simState = NULL; void tcGameObjIterator::First() { nSize = simState->maPlatformState.GetCount(); nIterated = 0; if (nSize == 0) { currentPos = -1; currentObj = NULL; return; } currentPos = simState->maPlatformState.GetStartPosition(); Next(); } tcGameObject* tcGameObjIterator::Get() { return currentObj; } /** * Advance to next object in pool that meets filter criteria. If * no objects are found, set currentObj to NULL */ void tcGameObjIterator::Next() { bool searching = true; while ((nIterated <= nSize) && searching) { long id; simState->maPlatformState.GetNextAssoc(currentPos, id, currentObj); nIterated++; if (PassesFilter(currentObj)) { searching = false; // found eligible object } else { currentObj = NULL; } } } bool tcGameObjIterator::NotDone() { return (nIterated <= nSize); } /** * Checks currentObj against filtering criteria. This is used * to iterate through a filtered set of objects. * @return true if current obj meets filtering criteria, false otherwise */ bool tcGameObjIterator::PassesFilter(const tcGameObject *obj) { if (!useRegion) return true; if (obj == NULL) return false; return region.ContainsPoint(obj->mcKin.mfLon_rad, obj->mcKin.mfLat_rad); } tcGameObjIterator::tcGameObjIterator(const tcGeoRect& filterRegion) { wxASSERT(simState); useRegion = true; region = filterRegion; First(); } tcGameObjIterator::tcGameObjIterator() { wxASSERT(simState); useRegion = false; First(); } tcGameObjIterator::~tcGameObjIterator() { } --- NEW FILE: tcRadar.cpp --- /* * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. * * This file is part of the Global Conflict Blue (GCB) program. * GCB is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * GCB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GCB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aerror.h" #include "nsNav.h" #include "tcRadar.h" #include "tcGameObject.h" #include "tcSurfaceObject.h" #include "tcAirObject.h" #include "tcMissileObject.h" #include "tcGenericDBObject.h" #include "tcMissileDBObject.h" #include "tcSimState.h" // break up this file later /** * */ bool tcRadar::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { tcSensorState::InitFromDB(apDatabase, anKey, mountAzimuth_rad); mpDBObj = dynamic_cast<tcRadarDBObject*>(apDatabase->GetObject(anKey)); if (mpDBObj == NULL) { WTL("Error - tcRadar::InitFromDB - Not found in db or bad class for key"); return false; } mnMode = mpDBObj->mbDetectsAir ? SSMODE_FCSURVEILLANCE : SSMODE_SURVEILLANCE; mfSensorHeight_m = 10.0f; isSemiactive = mpDBObj->isSemiactive; illuminatorID = -1; illuminatorSensorIdx = 0; isCommandReceiver = mpDBObj->isCommandReceiver; return true; } /** * */ bool tcRadar::CanDetectTarget(const tcGameObject* target, float& range_km) { float fTargetAz_rad; float fTargetRange_km; float fCoverageAz1, fCoverageAz2; bool bInSearchVolume = false; wxASSERT(mpDBObj); if (!mbActive) return false; float illuminatorTargetRange_km = 1e8; if (isSemiactive || isCommandReceiver) { tcRadar* illum = GetSemiactiveIlluminator(); if (illum == NULL) return false; if (!illum->CanDetectTarget(target, illuminatorTargetRange_km)) return false; if (isCommandReceiver) return true; } bool isSurface = false; bool isAir = false; float rcs_dBsm; if (const tcSurfaceObject* surfaceObj = dynamic_cast<const tcSurfaceObject*>(target)) { rcs_dBsm = surfaceObj->mpDBObject->mfRcs_dbsm; isSurface = true; } else if (const tcAirObject* airObj = dynamic_cast<const tcAirObject*>(target)) { rcs_dBsm = airObj->mpDBObject->mfRcs_dbsm; isAir = true; } else if (const tcMissileObject* missileObj = dynamic_cast<const tcMissileObject*>(target)) { rcs_dBsm = missileObj->mpDBObject->mfRcs_dbsm; isAir = true; } else { std::cerr << "CanDetectTarget called with illegal target class\n"; return false; } const tcKinematics *kin = &target->mcKin; if (mpDBObj->mfFieldOfView_deg >= 360.0f) { bInSearchVolume = true; } else { fTargetAz_rad = nsNav::GCHeadingApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, kin->mfLat_rad,kin->mfLon_rad); float fHalfFOV_rad = 0.5f*C_PIOVER180*mpDBObj->mfFieldOfView_deg; fCoverageAz1 = mfLookAz_rad - fHalfFOV_rad; fCoverageAz2 = mfLookAz_rad + fHalfFOV_rad; bInSearchVolume = AngleWithinRange(fTargetAz_rad,fCoverageAz1,fCoverageAz2) != 0; if (!bInSearchVolume) {range_km=0;return false;} } float fRadarHorizon = C_RADARHOR*(sqrtf(kin->mfAlt_m) +sqrtf(msCurrentPos.mfAlt_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(msCurrentPos.mfLat_rad,msCurrentPos.mfLon_rad, kin->mfLat_rad,kin->mfLon_rad); range_km = fTargetRange_km; if (fTargetRange_km > fRadarHorizon) { return false; } bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || (mpDBObj->mbDetectsSurface && isSurface); bool bDetectable; if (isSemiactive) { bDetectable = 20.0f*(2.0f*log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km) - log10f(illuminatorTargetRange_km) ) + rcs_dBsm >= 0; } else { bDetectable = (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) + rcs_dBsm >= 0); } return bDetectable && bTargetTypeMatch; } /** * @return semi-active illuminator object */ tcRadar* tcRadar::GetSemiactiveIlluminator() { wxASSERT(isSemiactive); wxASSERT(simState); tcPlatformObject *platObj = dynamic_cast<tcPlatformObject*>(simState->GetObject(illuminatorID)); if (platObj == NULL) return NULL; tcRadar* illum = dynamic_cast<tcRadar*>(platObj->GetSensor(illuminatorSensorIdx)); return illum; } /** * */ void tcRadar::Serialize(tcFile& file, bool mbLoad) { tcSensorState::Serialize(file, mbLoad); } /** * Sets illuminator info for semi-active radars and command receivers. * isCommandReceiver indicates the "radar" is a simple receiver of command * guidance from the fire control radar. */ void tcRadar::SetIlluminator(long illum_id, unsigned sensor_idx) { wxASSERT(isSemiactive || isCommandReceiver); illuminatorID = illum_id; illuminatorSensorIdx = sensor_idx; } /** * */ tcRadar& tcRadar::operator=(tcRadar& ss) { tcSensorState::operator =(ss); mpDBObj = ss.mpDBObj; return(*this); } /** * */ tcRadar* tcRadar::Clone(void) { tcRadar *pNew = new tcRadar(); *pNew = *this; return pNew; } /** * Does not test if radar can detect target. * @return true if track is available. */ bool tcRadar::IsTrackAvailable() { return (fireControlTrackCount < mpDBObj->maxFireControlTracks); } /** * if track is available, reserve a track. * The current approach to semi-active guidance is to require each * missile to request one track per target, even if it is the same * target as a pre-existing track. * Calling method must check if target is detectable for this to * work properly. */ bool tcRadar::RequestTrack() { if (IsTrackAvailable()) { fireControlTrackCount++; return true; } else { return false; } } bool tcRadar::ReleaseTrack() { if (fireControlTrackCount > 0) { fireControlTrackCount--; return true; } else { std::cerr << "tcRadar::ReleaseTrack called with no tracks." << std::endl; return false; } } void tcRadar::Update(double t) { if (!UpdateScan(t)) return; // only update once per scan period } /** * */ tcRadar::tcRadar() : tcSensorState() { mpDBObj = NULL; } tcRadar::tcRadar(tcGameObject *obj) : tcSensorState(obj) { fireControlTrackCount = 0; illuminatorID = -1; illuminatorSensorIdx = 0; isSemiactive = false; isCommandReceiver = false; } /** * */ tcRadar::~tcRadar() { // release fire control track if (isSemiactive || isCommandReceiver) { if (tcRadar *illuminator = GetSemiactiveIlluminator()) { illuminator->ReleaseTrack(); } } } Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcLauncherState.cpp 1 Feb 2004 22:19:09 -0000 1.5 --- tcLauncherState.cpp 7 Feb 2004 02:19:54 -0000 1.6 *************** *** 23,27 **** #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" ! #include "tcRadarSensorState.h" #include "tcSimState.h" #include <iostream> --- 23,27 ---- #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" ! #include "tcRadar.h" #include "tcSimState.h" #include <iostream> Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMissileObject.cpp 29 Jan 2004 00:05:43 -0000 1.5 --- tcMissileObject.cpp 7 Feb 2004 02:19:54 -0000 1.6 *************** *** 408,411 **** --- 408,412 ---- tnPoolIndex nSensorKey = database->GetKey(obj->maSensorClass[0]); mcSensorState.InitFromDB(database,nSensorKey, 0); // missile seeker always points forward + mcSensorState.SetParent(this); } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcPlatformObject.cpp 2 Feb 2004 01:21:37 -0000 1.14 --- tcPlatformObject.cpp 7 Feb 2004 02:19:54 -0000 1.15 *************** *** 28,33 **** #include "tcLauncherDBObject.h" #include "tcString.h" ! #include "tcRadarSensorState.h" ! #include "tcESMSensorState.h" #include "tc3DModel.h" --- 28,33 ---- #include "tcLauncherDBObject.h" #include "tcString.h" ! #include "tcRadar.h" ! #include "tcESMSensor.h" #include "tc3DModel.h" *************** *** 514,518 **** if (tcRadarDBObject *pRadarDBObj = dynamic_cast<tcRadarDBObject*>(pDBObj)) { ! tcRadar *pRadarSS = new tcRadar; pRadarSS->InitFromDB(database, nSensorKey, lookAz_rad); pRadarSS->mpDBObj = pRadarDBObj; --- 514,518 ---- if (tcRadarDBObject *pRadarDBObj = dynamic_cast<tcRadarDBObject*>(pDBObj)) { ! tcRadar *pRadarSS = new tcRadar(this); pRadarSS->InitFromDB(database, nSensorKey, lookAz_rad); pRadarSS->mpDBObj = pRadarDBObj; *************** *** 521,525 **** else if (tcESMDBObject *pESMDBObj = dynamic_cast<tcESMDBObject*>(pDBObj)) { ! tcESMSensorState *pESMSS = new tcESMSensorState; pESMSS->InitFromDB(database, nSensorKey, lookAz_rad); pESMSS->mpDBObj = pESMDBObj; --- 521,525 ---- else if (tcESMDBObject *pESMDBObj = dynamic_cast<tcESMDBObject*>(pDBObj)) { ! tcESMSensor *pESMSS = new tcESMSensor(this); pESMSS->InitFromDB(database, nSensorKey, lookAz_rad); pESMSS->mpDBObj = pESMDBObj; Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorMap.cpp 26 Oct 2003 21:21:17 -0000 1.3 --- tcSensorMap.cpp 7 Feb 2004 02:19:54 -0000 1.4 *************** *** 436,440 **** file.Read(maTrackToSensorTrack,MAX_TRACKS*sizeof(tnPoolIndex)); file.Read(&nMapSize,sizeof(nMapSize)); ! for(unsigned int i=0;i<nMapSize;i++) { psmtrack = new tcSensorMapTrack; file.Read(psmtrack,sizeof(tcSensorMapTrack)); --- 436,440 ---- file.Read(maTrackToSensorTrack,MAX_TRACKS*sizeof(tnPoolIndex)); file.Read(&nMapSize,sizeof(nMapSize)); ! for(int i=0;i<nMapSize;i++) { psmtrack = new tcSensorMapTrack; file.Read(psmtrack,sizeof(tcSensorMapTrack)); Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSensorState.cpp 5 Feb 2004 23:17:05 -0000 1.4 --- tcSensorState.cpp 7 Feb 2004 02:19:54 -0000 1.5 *************** *** 107,110 **** --- 107,114 ---- } + void tcSensorState::Update(double t) + { + } + /** * *************** *** 168,171 **** --- 172,176 ---- mfCurrentScanPeriod_s = 30.0f; mcTrack.mnID = NULL_INDEX; + parent = NULL; } Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcSimState.cpp 5 Feb 2004 23:17:05 -0000 1.29 --- tcSimState.cpp 7 Feb 2004 02:19:54 -0000 1.30 *************** *** 38,41 **** --- 38,42 ---- #include "tcAirDBObject.h" #include "tc3DModel.h" + #include "tcGameObjIterator.h" *************** *** 647,651 **** } case SSMODE_SURVEILLANCE: ! if ((dynamic_cast<tcESMSensorState*>(pSensorState)&& (mpUserInfo->IsOwnAlliance(pplat->mnAlliance)))) { int i = 3; --- 648,652 ---- } case SSMODE_SURVEILLANCE: ! if ((dynamic_cast<tcESMSensor*>(pSensorState)&& (mpUserInfo->IsOwnAlliance(pplat->mnAlliance)))) { int i = 3; *************** *** 654,658 **** break; default: ! if (dynamic_cast<tcESMSensorState*>(pSensorState)) { int i = 3; } --- 655,659 ---- break; default: ! if (dynamic_cast<tcESMSensor*>(pSensorState)) { int i = 3; } *************** *** 737,741 **** /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensorState *apESM, tcRadar *apEmitterRadar, tcGameObject *apEmitterPlatform, float& rfAz_rad) { --- 738,742 ---- /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, tcGameObject *apEmitterPlatform, float& rfAz_rad) { *************** *** 753,757 **** void tcSimState::ProcessESMDetection(tcGameObject *apESMPlat,tcGameObject *apTarget, ! tcESMSensorState *apESMSS) { enum {MAX_EMITTERS=4}; --- 754,758 ---- void tcSimState::ProcessESMDetection(tcGameObject *apESMPlat,tcGameObject *apTarget, ! tcESMSensor *apESMSS) { enum {MAX_EMITTERS=4}; *************** *** 882,886 **** ProcessRadarDetection(applat,pTarget,pRadarSS); } ! else if (tcESMSensorState *pESMSS = dynamic_cast<tcESMSensorState*>(apSensorState)) { ProcessESMDetection(applat,pTarget,pESMSS); } --- 883,887 ---- ProcessRadarDetection(applat,pTarget,pRadarSS); } ! else if (tcESMSensor *pESMSS = dynamic_cast<tcESMSensor*>(apSensorState)) { ProcessESMDetection(applat,pTarget,pESMSS); } *************** *** 1383,1398 **** } /********************************************************************/ ! void tcSimState::PrintToFile(tcString sFileName) { tcFile file; tcGameObject *pplat; ! tnPoolIndex cmappos = maPlatformState.GetStartPosition(); ! tnPoolIndex nSize = maPlatformState.GetCount(); ! tnPoolIndex nKey; ! file.Open(sFileName.GetBuffer(),tcFile::modeCreate|tcFile::modeWrite); ! for (tnPoolIndex i=0;i<nSize;i++) { ! maPlatformState.GetNextAssoc(cmappos,nKey,pplat); ! pplat->PrintToFile(file); } file.Close(); } --- 1384,1408 ---- } /********************************************************************/ ! void tcSimState::PrintToFile(tcString sFileName) ! { tcFile file; tcGameObject *pplat; ! char buff[256]; ! file.Open(sFileName.GetBuffer(),tcFile::modeCreate|tcFile::modeWrite|tcFile::modeText); ! ! ! tcGameObjIterator iter; ! int idx = 0; ! for (iter.First();iter.NotDone();iter.Next()) ! { ! pplat = iter.Get(); ! sprintf(buff,"%d %s (%s) AL:%d (lat: %.2f, lon: %.2f) \n",idx, ! pplat->mzUnit.mz, pplat->mzClass.mz, pplat->mnAlliance, ! pplat->mcKin.mfLat_rad*C_180OVERPI, pplat->mcKin.mfLon_rad*C_180OVERPI); ! file.WriteString(buff); ! idx++; } + file.Close(); } *************** *** 1461,1465 **** tnPoolIndex nKey; ! for (unsigned i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(pos,nKey,obj); --- 1471,1475 ---- tnPoolIndex nKey; ! for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(pos,nKey,obj); *************** *** 1592,1596 **** tnPoolIndex nListIndex=0; ! for (tnPoolIndex i=0;(i<nSize)&&(nListIndex<anMaxLength);i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pGameObj); --- 1602,1606 ---- tnPoolIndex nListIndex=0; ! for (int i=0;(i<nSize)&&(nListIndex<(int)anMaxLength);i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pGameObj); *************** *** 1770,1773 **** --- 1780,1784 ---- tcLauncherState::AttachSimState(this); tcSensorState::AttachSimState(this); + tcGameObjIterator::SetSimState(this); mcSensorMap.CreateMapForAlliance(1); --- tcESMSensorState.cpp DELETED --- --- tcRadarSensorState.cpp DELETED --- |
From: <ddc...@us...> - 2004-02-07 02:22:57
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/include/common Modified Files: simmath.h Log Message: Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** simmath.h 1 Feb 2004 22:19:08 -0000 1.8 --- simmath.h 7 Feb 2004 02:19:53 -0000 1.9 *************** *** 61,69 **** { public: ! float Width(); ! float XCenter(); void Offset(float dx, float dy); void Set(float x1,float x2,float y1,float y2); ! void ApplyBounds(tcGeoRect& r); bool operator==(const tcGeoRect& r); }; --- 61,72 ---- { public: ! void ApplyBounds(tcGeoRect& r); void Offset(float dx, float dy); + bool ContainsPoint(float lon, float lat); void Set(float x1,float x2,float y1,float y2); ! void SetDegrees(float lon1_deg, float lon2_deg, float lat1_deg, float lat2_deg); ! float Width(); ! float XCenter(); ! bool operator==(const tcGeoRect& r); }; |
From: <ddc...@us...> - 2004-02-07 02:22:57
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/include/sim Modified Files: tcAIData.h tcGameView.h tcHookInfo.h tcMapView.h tcMissileObject.h tcPool.h tcSensorState.h tcSimState.h Added Files: tcESMSensor.h tcGameObjIterator.h tcRadar.h Removed Files: tcESMSensorState.h tcRadarSensorState.h Log Message: --- NEW FILE: tcESMSensor.h --- /* * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. * * This file is part of the Global Conflict Blue (GCB) program. * GCB is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * GCB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GCB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #pragma once #ifndef _tcESMSensor_H_ #define _tcESMSensor_H_ #include "tcSensorState.h" #include "tcDatabase.h" #include "tcESMDBObject.h" class tcGameObject; using namespace Database; /** * */ typedef struct _ESMtargetinfo { float mfLat_rad; float mfLon_rad; float mfAlt_m; float mfEmitterAz_rad; // azimuth of center of emitter coverage float mfEmitterFOV_rad; float mfEmitterERP_dBW; } tsESMTargetInfo; /** * */ class tcESMSensor : public tcSensorState { public: tcESMDBObject *mpDBObj; bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); bool IsDetected(const tsESMTargetInfo& asETI, float& rfAz_rad); void Serialize(tcFile& file, bool mbLoad); virtual void Update(double t); tcESMSensor& operator=(tcESMSensor& ss); tcESMSensor* Clone(void); tcESMSensor(); tcESMSensor(tcGameObject *obj); virtual ~tcESMSensor(); }; #endif --- NEW FILE: tcGameObjIterator.h --- /** @file tcGameObjIterator.h */ /* ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GAMEOBJITERATOR_H_ #define _GAMEOBJITERATOR_H_ #pragma once #include "simmath.h" class tcSimState; class tcGameObject; class tcGameObjIterator { public: static SetSimState(tcSimState *ss) {simState = ss;} void First(); tcGameObject* Get(); void Next(); bool NotDone(); tcGameObjIterator(const tcGeoRect& filterRegion); tcGameObjIterator(); virtual ~tcGameObjIterator(); private: static tcSimState *simState; long firstPos; ///< index of first game object, last advances to first long currentPos; ///< current position index for pool tcGameObject *currentObj; bool useRegion; tcGeoRect region; unsigned nIterated; ///< count of elements iterated unsigned nSize; ///< size of list bool PassesFilter(const tcGameObject *obj); }; #endif --- NEW FILE: tcRadar.h --- /* * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. * * This file is part of the Global Conflict Blue (GCB) program. * GCB is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * GCB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GCB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #pragma once #ifndef _tcRadar_H_ #define _tcRadar_H_ #include "tcSensorState.h" #include "tcRadarDBObject.h" #include <vector> /** * */ struct tsRadarTargetInfo { float mfLat_rad; float mfLon_rad; float mfAlt_m; float mfHeading_rad; float mfSpeed_mps; float mfRCS_dbsm; } ; class tcGameObject; /** * Class to handle surveillance, fire control, and seeker radars. * May want to break this up use derived classes for detailed * functions. * */ class tcRadar : public tcSensorState { public: tcRadarDBObject *mpDBObj; // fire-control vars unsigned int fireControlTrackCount; // semi-active and command mode vars long illuminatorID; ///< id of SA illuminating platform unsigned illuminatorSensorIdx; ///< sensor index of illum platform virtual bool CanDetectTarget(const tcGameObject* target, float& range_km); virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); // fire control methods virtual bool IsTrackAvailable(); virtual bool RequestTrack(); virtual bool ReleaseTrack(); virtual bool IsCommandReceiver() {return isCommandReceiver;} virtual bool IsSemiactive() {return isSemiactive;} virtual void SetIlluminator(long illum_id, unsigned sensor_idx); void Serialize(tcFile& file, bool mbLoad); virtual void Update(double t); tcRadar& operator=(tcRadar& ss); tcRadar* Clone(); tcRadar(); tcRadar(tcGameObject *obj); virtual ~tcRadar(); protected: bool isSemiactive; bool isCommandReceiver; tcRadar* GetSemiactiveIlluminator(); }; #endif Index: tcAIData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAIData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcAIData.h 30 Nov 2003 17:23:52 -0000 1.4 --- tcAIData.h 7 Feb 2004 02:19:54 -0000 1.5 *************** *** 28,32 **** #ifndef NULL_INDEX ! #define NULL_INDEX 0xFFFFFFFF #endif --- 28,32 ---- #ifndef NULL_INDEX ! #define NULL_INDEX -1 #endif Index: tcGameView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameView.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcGameView.h 30 Nov 2003 17:23:52 -0000 1.5 --- tcGameView.h 7 Feb 2004 02:19:54 -0000 1.6 *************** *** 48,52 **** #ifndef tnPoolIndex ! typedef unsigned long tnPoolIndex; #endif --- 48,52 ---- #ifndef tnPoolIndex ! typedef long tnPoolIndex; #endif Index: tcHookInfo.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcHookInfo.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcHookInfo.h 30 Nov 2003 17:23:52 -0000 1.3 --- tcHookInfo.h 7 Feb 2004 02:19:54 -0000 1.4 *************** *** 44,48 **** #ifndef tnPoolIndex ! typedef unsigned long tnPoolIndex; #endif --- 44,48 ---- #ifndef tnPoolIndex ! typedef long tnPoolIndex; #endif Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMapView.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMapView.h 1 Feb 2004 22:19:08 -0000 1.14 --- tcMapView.h 7 Feb 2004 02:19:54 -0000 1.15 *************** *** 46,50 **** #define MAXMAPOBJ 256 #define MAXWORLDMAPOBJ 1024 ! #define NULL_INDEX 0xFFFFFFFF #define HEADING_UNKNOWN (float)-456.7 #define SCROLL_DELAY 8 --- 46,50 ---- #define MAXMAPOBJ 256 #define MAXWORLDMAPOBJ 1024 ! #define NULL_INDEX -1 #define HEADING_UNKNOWN (float)-456.7 #define SCROLL_DELAY 8 Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcMissileObject.h 29 Jan 2004 00:05:17 -0000 1.3 --- tcMissileObject.h 7 Feb 2004 02:19:54 -0000 1.4 *************** *** 26,30 **** #include "tcGameObject.h" #include "tcGuidanceState.h" ! #include "tcRadarSensorState.h" using namespace Aero; --- 26,30 ---- #include "tcGameObject.h" #include "tcGuidanceState.h" ! #include "tcRadar.h" using namespace Aero; Index: tcPool.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPool.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcPool.h 19 Oct 2003 17:46:01 -0000 1.2 --- tcPool.h 7 Feb 2004 02:19:54 -0000 1.3 *************** *** 25,30 **** #include "wx/wx.h" // for NULL definition ! #define NULL_INDEX 0xFFFFFFFF ! typedef unsigned long tnPoolIndex; template <class T, int POOLSIZE> class tcPool { --- 25,30 ---- #include "wx/wx.h" // for NULL definition ! #define NULL_INDEX -1 ! typedef long tnPoolIndex; template <class T, int POOLSIZE> class tcPool { *************** *** 63,70 **** template <class T, int POOLSIZE> bool tcPool<T,POOLSIZE>::Lookup(tnPoolIndex n,T*& pt) { ! if (n < POOLSIZE) { pt = mpool[n]; } ! else { pt = NULL; return false; --- 63,72 ---- template <class T, int POOLSIZE> bool tcPool<T,POOLSIZE>::Lookup(tnPoolIndex n,T*& pt) { ! if ((n >=0)&&(n < POOLSIZE)) ! { pt = mpool[n]; } ! else ! { pt = NULL; return false; *************** *** 181,185 **** template <class T, int POOLSIZE> void tcPool<T,POOLSIZE>::GetNextAssoc(tnPoolIndex& pos, tnPoolIndex& index, T*& pt){ ! if (pos >= POOLSIZE) { pt = NULL; index = NULL_INDEX; --- 183,187 ---- template <class T, int POOLSIZE> void tcPool<T,POOLSIZE>::GetNextAssoc(tnPoolIndex& pos, tnPoolIndex& index, T*& pt){ ! if ((pos < 0)||(pos >= POOLSIZE)) { pt = NULL; index = NULL_INDEX; *************** *** 193,197 **** template <class T, int POOLSIZE> tnPoolIndex tcPool<T,POOLSIZE>::GetNextKey(tnPoolIndex pos){ ! if (pos >= POOLSIZE) { return NULL_INDEX; } --- 195,199 ---- template <class T, int POOLSIZE> tnPoolIndex tcPool<T,POOLSIZE>::GetNextKey(tnPoolIndex pos){ ! if ((pos < 0)||(pos >= POOLSIZE)) { return NULL_INDEX; } *************** *** 206,210 **** template <class T, int POOLSIZE> tnPoolIndex tcPool<T,POOLSIZE>::GetPrevKey(tnPoolIndex pos){ ! if (pos >= POOLSIZE) { return NULL_INDEX; } --- 208,212 ---- template <class T, int POOLSIZE> tnPoolIndex tcPool<T,POOLSIZE>::GetPrevKey(tnPoolIndex pos){ ! if ((pos < 0)||(pos >= POOLSIZE)) { return NULL_INDEX; } *************** *** 219,223 **** template <class T, int POOLSIZE> T tcPool<T,POOLSIZE>::operator[] (tnPoolIndex index) const { ! if (index >= POOLSIZE) { return *mpool[0]; } --- 221,225 ---- template <class T, int POOLSIZE> T tcPool<T,POOLSIZE>::operator[] (tnPoolIndex index) const { ! if ((index < 0)||(index >= POOLSIZE)) { return *mpool[0]; } *************** *** 233,236 **** --- 235,239 ---- return false; // empty pool, nothing to remove } + if (n < 0) return false; // return key to available maAvailable[mnReturnIndex++] = n; *************** *** 266,269 **** --- 269,273 ---- return false; // empty pool, nothing to remove } + if (n < 0) return false; // return key to available maAvailable[mnReturnIndex++] = n; Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSensorState.h 5 Feb 2004 23:17:04 -0000 1.5 --- tcSensorState.h 7 Feb 2004 02:19:54 -0000 1.6 *************** *** 64,67 **** --- 64,68 ---- void Serialize(tcFile& file, bool mbLoad); void SetParent(tcGameObject *obj) {parent = obj;} + virtual void Update(double t); void UpdateCoverage(tsGeoPoint p,float az_rad); int UpdateScan(double afTime); Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcSimState.h 1 Feb 2004 22:19:08 -0000 1.13 --- tcSimState.h 7 Feb 2004 02:19:54 -0000 1.14 *************** *** 43,48 **** #include "commandlist.h" #include "tcString.h" ! #include "tcESMSensorState.h" ! #include "tcRadarSensorState.h" #include "cspDate.h" --- 43,48 ---- #include "commandlist.h" #include "tcString.h" ! #include "tcESMSensor.h" ! #include "tcRadar.h" #include "cspDate.h" *************** *** 174,178 **** float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); ! bool IsDetectedESM(tcESMSensorState *apESM, tcRadar *apEmitterRadar, tcGameObject *apEmitterPlatform, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); --- 174,178 ---- float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); ! bool IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, tcGameObject *apEmitterPlatform, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); *************** *** 180,184 **** tcRadar *apRadarSS); void ProcessESMDetection(tcGameObject *apESMPlat,tcGameObject *apTarget, ! tcESMSensorState *apESMSS); void UpdateFireControl(tcGameObject *apGameObj, tcRadar *apRadarSS); void UpdateSeeker(tcGameObject *applat, tcRadar *apRadarSS); --- 180,184 ---- tcRadar *apRadarSS); void ProcessESMDetection(tcGameObject *apESMPlat,tcGameObject *apTarget, ! tcESMSensor *apESMSS); void UpdateFireControl(tcGameObject *apGameObj, tcRadar *apRadarSS); void UpdateSeeker(tcGameObject *applat, tcRadar *apRadarSS); --- tcESMSensorState.h DELETED --- --- tcRadarSensorState.h DELETED --- |
From: <ddc...@us...> - 2004-02-07 02:22:50
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/src/common Modified Files: simmath.cpp Log Message: Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** simmath.cpp 1 Feb 2004 22:19:08 -0000 1.6 --- simmath.cpp 7 Feb 2004 02:19:54 -0000 1.7 *************** *** 102,105 **** --- 102,117 ---- /******************************* tcGeoRect ********************************/ + + /** + * @return true if point (lon,lat) in radians is within + * @return region. + */ + bool tcGeoRect::ContainsPoint(float lon, float lat) + { + tsGeoPoint p; + p.Set(lon, lat, 0); + return GeoWithinRegion(p, this) != 0; + } + float tcGeoRect::Width() { if (right > left) {return right-left;} *************** *** 123,126 **** --- 135,141 ---- } + /** + * radian units + */ void tcGeoRect::Set(float x1,float x2,float y1,float y2) { if (x1 < -C_PI) {x1 += C_TWOPI;} *************** *** 151,154 **** --- 166,178 ---- } + /** + * accepts longitude and latitude arguments in degrees units + */ + void tcGeoRect::SetDegrees(float lon1_deg, float lon2_deg, float lat1_deg, float lat2_deg) + { + tcGeoRect::Set(C_PIOVER180*lon1_deg, C_PIOVER180*lon2_deg, + C_PIOVER180*lat1_deg, C_PIOVER180*lat2_deg); + } + // forces r to be within tcGeoRect, assumes dimensions of r don't exceed tcGeoRect // dimensions |
From: <ddc...@us...> - 2004-02-07 02:22:50
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/src/database Modified Files: tcDatabase.cpp Log Message: Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcDatabase.cpp 30 Jan 2004 01:02:34 -0000 1.6 --- tcDatabase.cpp 7 Feb 2004 02:19:54 -0000 1.7 *************** *** 168,172 **** if (!IsVersionSupported()) {return BAD_VERSION;} file.Read(&nMapSize,sizeof(nMapSize)); ! for(unsigned int i=0;i<nMapSize;i++) { file.Read(&nClassID,sizeof(nClassID)); nResult = false; --- 168,172 ---- if (!IsVersionSupported()) {return BAD_VERSION;} file.Read(&nMapSize,sizeof(nMapSize)); ! for(int i=0;i<nMapSize;i++) { file.Read(&nClassID,sizeof(nClassID)); nResult = false; *************** *** 709,713 **** nMapSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for(unsigned int i=0;i<nMapSize;i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); nClassID = pdbobj->mnClassID; --- 709,713 ---- nMapSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for(int i=0;i<nMapSize;i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); nClassID = pdbobj->mnClassID; *************** *** 824,828 **** tcDatabaseObject *obj; ! for (unsigned i=0;i<nPoolSize;i++) { key = mcObjectData.GetNextKey(key); --- 824,828 ---- tcDatabaseObject *obj; ! for (int i=0;i<nPoolSize;i++) { key = mcObjectData.GetNextKey(key); *************** *** 847,851 **** nClassID = pobj->mnClassID; ! for (unsigned i=0;i<nPoolSize;i++) { nCurrentKey = mcObjectData.GetNextKey(nCurrentKey); if (mcObjectData.Lookup(nCurrentKey,pobj)==false) {return NULL_INDEX;} // error --- 847,851 ---- nClassID = pobj->mnClassID; ! for (int i=0;i<nPoolSize;i++) { nCurrentKey = mcObjectData.GetNextKey(nCurrentKey); if (mcObjectData.Lookup(nCurrentKey,pobj)==false) {return NULL_INDEX;} // error *************** *** 868,872 **** nClassID = pobj->mnClassID; ! for (unsigned i=0;i<nPoolSize;i++) { nCurrentKey = mcObjectData.GetPrevKey(nCurrentKey); if (mcObjectData.Lookup(nCurrentKey,pobj)==false) {return NULL_INDEX;} // error --- 868,872 ---- nClassID = pobj->mnClassID; ! for (int i=0;i<nPoolSize;i++) { nCurrentKey = mcObjectData.GetPrevKey(nCurrentKey); if (mcObjectData.Lookup(nCurrentKey,pobj)==false) {return NULL_INDEX;} // error *************** *** 885,889 **** nPoolSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for (unsigned i=0;i<nPoolSize;i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); if (pdbobj == NULL) { --- 885,889 ---- nPoolSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for (int i=0;i<nPoolSize;i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); if (pdbobj == NULL) { *************** *** 954,958 **** nMapSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for (unsigned int i=0;(i<nMapSize)&&(!bFound);i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); bFound = (pdbobj->mzClass == s); --- 954,958 ---- nMapSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for (int i=0;(i<nMapSize)&&(!bFound);i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); bFound = (pdbobj->mzClass == s); *************** *** 970,974 **** nMapSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for (unsigned int i=0;(i<nMapSize);i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); pdbobj->RandInit(); --- 970,974 ---- nMapSize = mcObjectData.GetCount(); nPoolPos = mcObjectData.GetStartPosition(); ! for (int i=0;(i<nMapSize);i++) { mcObjectData.GetNextAssoc(nPoolPos,nKey,pdbobj); pdbobj->RandInit(); |
From: <ddc...@us...> - 2004-02-07 02:22:50
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/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.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcPlatformInterface.cpp 1 Feb 2004 22:19:09 -0000 1.15 --- tcPlatformInterface.cpp 7 Feb 2004 02:19:54 -0000 1.16 *************** *** 488,492 **** tcTrackIterator tcPlatformInterface::GetFirstTrack(void) { tcTrackIterator t; ! t.mnID = 0xFFFFFFFF; if (mpSensorMap == NULL) {return t;} --- 488,492 ---- tcTrackIterator tcPlatformInterface::GetFirstTrack(void) { tcTrackIterator t; ! t.mnID = -1; if (mpSensorMap == NULL) {return t;} |
From: <ddc...@us...> - 2004-02-07 02:22:49
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** GCblue.vcproj 29 Jan 2004 00:04:49 -0000 1.35 --- GCblue.vcproj 7 Feb 2004 02:19:53 -0000 1.36 *************** *** 312,316 **** </File> <File ! RelativePath="src\sim\tcESMSensorState.cpp"> </File> <File --- 312,316 ---- </File> <File ! RelativePath="src\sim\tcESMSensor.cpp"> </File> <File *************** *** 324,327 **** --- 324,330 ---- </File> <File + RelativePath="src\sim\tcGameObjIterator.cpp"> + </File> + <File RelativePath="src\sim\tcGameObject.cpp"> </File> *************** *** 375,379 **** </File> <File ! RelativePath="src\sim\tcRadarSensorState.cpp"> </File> <File --- 378,382 ---- </File> <File ! RelativePath="src\sim\tcRadar.cpp"> </File> <File *************** *** 630,634 **** </File> <File ! RelativePath="include\sim\tcESMSensorState.h"> </File> <File --- 633,637 ---- </File> <File ! RelativePath="include\sim\tcESMSensor.h"> </File> <File *************** *** 642,645 **** --- 645,651 ---- </File> <File + RelativePath="include\sim\tcGameObjIterator.h"> + </File> + <File RelativePath="include\sim\tcGameObject.h"> </File> *************** *** 696,700 **** </File> <File ! RelativePath="include\sim\tcRadarSensorState.h"> </File> <File --- 702,706 ---- </File> <File ! RelativePath="include\sim\tcRadar.h"> </File> <File |
From: <ddc...@us...> - 2004-02-07 02:22:48
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/include/database Modified Files: tcDatabase.h Log Message: Index: tcDatabase.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabase.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDatabase.h 8 Dec 2003 03:06:36 -0000 1.2 --- tcDatabase.h 7 Feb 2004 02:19:53 -0000 1.3 *************** *** 46,50 **** #ifndef NULL_INDEX ! #define NULL_INDEX 0xFFFFFFFF #endif --- 46,50 ---- #ifndef NULL_INDEX ! #define NULL_INDEX -1 #endif |
From: <ddc...@us...> - 2004-02-05 23:19:42
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30786/src/database Modified Files: tcRadarDBObject.cpp Log Message: Index: tcRadarDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcRadarDBObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcRadarDBObject.cpp 30 Jan 2004 01:02:35 -0000 1.5 --- tcRadarDBObject.cpp 5 Feb 2004 23:17:04 -0000 1.6 *************** *** 114,117 **** --- 114,118 ---- *csv >> maxFireControlTracks; *csv >> val; isSemiactive = val != 0; + *csv >> val; isCommandReceiver = val != 0; *csv >> val; mbDetectsSurface = val != 0; *csv >> val; mbDetectsAir = val != 0; *************** *** 124,127 **** --- 125,129 ---- *csv << (long)maxFireControlTracks; *csv << (long)isSemiactive; + *csv << (long)isCommandReceiver; *csv << (long)mbDetectsSurface; *csv << (long)mbDetectsAir; *************** *** 140,143 **** --- 142,146 ---- *csv << "MaxFireControlTracks"; *csv << "IsSemiactive"; + *csv << "IsCommandReceiver"; *csv << "DetectsSurface"; *csv << "DetectsAir"; *************** *** 160,163 **** --- 163,168 ---- mbDetectsSurface = true; mbDetectsAir = true; + isSemiactive = false; + isCommandReceiver = false; } *************** *** 170,174 **** mfMinRangeRate_mps = obj.mfMinRangeRate_mps; mbDetectsSurface = obj.mbDetectsSurface; ! mbDetectsAir = obj.mbDetectsAir; } --- 175,181 ---- mfMinRangeRate_mps = obj.mfMinRangeRate_mps; mbDetectsSurface = obj.mbDetectsSurface; ! mbDetectsAir = obj.mbDetectsAir; ! isSemiactive = obj.isSemiactive; ! isCommandReceiver = obj.isCommandReceiver; } |
From: <ddc...@us...> - 2004-02-05 23:19:42
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30786/src/sim Modified Files: Game.cpp tcRadarSensorState.cpp tcSensorState.cpp tcSimState.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Game.cpp 29 Jan 2004 00:05:26 -0000 1.56 --- Game.cpp 5 Feb 2004 23:17:05 -0000 1.57 *************** *** 1503,1506 **** --- 1503,1517 ---- } return; + case 'A': + accelerateTime--; + if (accelerateTime == 6) + { + accelerateTime = 3; // jump to 8x from 4x + } + else if (accelerateTime < 0) + { + accelerateTime = 0; // return to normal time after 8x + } + return; case 'F': viewer->ToggleFog(); Index: tcRadarSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadarSensorState.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcRadarSensorState.cpp 1 Feb 2004 22:19:09 -0000 1.5 --- tcRadarSensorState.cpp 5 Feb 2004 23:17:05 -0000 1.6 *************** *** 50,53 **** --- 50,55 ---- illuminatorID = -1; illuminatorSensorIdx = 0; + isCommandReceiver = mpDBObj->isCommandReceiver; + return true; *************** *** 69,77 **** float illuminatorTargetRange_km = 1e8; ! if (isSemiactive) { tcRadar* illum = GetSemiactiveIlluminator(); if (illum == NULL) return false; if (!illum->CanDetectTarget(target, illuminatorTargetRange_km)) return false; } --- 71,80 ---- float illuminatorTargetRange_km = 1e8; ! if (isSemiactive || isCommandReceiver) { tcRadar* illum = GetSemiactiveIlluminator(); if (illum == NULL) return false; if (!illum->CanDetectTarget(target, illuminatorTargetRange_km)) return false; + if (isCommandReceiver) return true; } *************** *** 136,145 **** - log10f(fTargetRange_km) - log10f(illuminatorTargetRange_km) ! ) >= rcs_dBsm; } else { bDetectable = ! (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) >= rcs_dBsm); } return bDetectable && bTargetTypeMatch; --- 139,148 ---- - log10f(fTargetRange_km) - log10f(illuminatorTargetRange_km) ! ) + rcs_dBsm >= 0; } else { bDetectable = ! (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) + rcs_dBsm >= 0); } return bDetectable && bTargetTypeMatch; *************** *** 171,179 **** /** ! * Sets illuminator info for semi-active radars. */ void tcRadar::SetIlluminator(long illum_id, unsigned sensor_idx) { ! wxASSERT(isSemiactive); illuminatorID = illum_id; --- 174,184 ---- /** ! * Sets illuminator info for semi-active radars and command receivers. ! * isCommandReceiver indicates the "radar" is a simple receiver of command ! * guidance from the fire control radar. */ void tcRadar::SetIlluminator(long illum_id, unsigned sensor_idx) { ! wxASSERT(isSemiactive || isCommandReceiver); illuminatorID = illum_id; *************** *** 259,262 **** --- 264,268 ---- illuminatorSensorIdx = 0; isSemiactive = false; + isCommandReceiver = false; } *************** *** 267,271 **** { // release fire control track ! if (isSemiactive) { if (tcRadar *illuminator = GetSemiactiveIlluminator()) --- 273,277 ---- { // release fire control track ! if (isSemiactive || isCommandReceiver) { if (tcRadar *illuminator = GetSemiactiveIlluminator()) Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorState.cpp 1 Feb 2004 22:19:09 -0000 1.3 --- tcSensorState.cpp 5 Feb 2004 23:17:05 -0000 1.4 *************** *** 21,24 **** --- 21,25 ---- #include "aerror.h" #include "tcSimState.h" + #include "tcGameObject.h" tcSimState* tcSensorState::simState = NULL; *************** *** 169,172 **** --- 170,185 ---- } + tcSensorState::tcSensorState(tcGameObject *obj) + : parent(obj) + { + mbActive = false; + mnMode = 0; + mpDBObj = NULL; + mnDBKey = NULL_INDEX; + mfLastScan = 0; + mfCurrentScanPeriod_s = 30.0f; + mcTrack.mnID = NULL_INDEX; + } + /** * Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcSimState.cpp 2 Feb 2004 01:21:37 -0000 1.28 --- tcSimState.cpp 5 Feb 2004 23:17:05 -0000 1.29 *************** *** 740,744 **** tcGameObject *apEmitterPlatform, float& rfAz_rad) { ! if (!apEmitterRadar->mbActive) {return false;} tsESMTargetInfo sETI; sETI.mfLat_rad = (float)apEmitterPlatform->mcKin.mfLat_rad; --- 740,744 ---- tcGameObject *apEmitterPlatform, float& rfAz_rad) { ! if ((!apEmitterRadar->mbActive)||(apEmitterRadar->IsSemiactive())) {return false;} tsESMTargetInfo sETI; sETI.mfLat_rad = (float)apEmitterPlatform->mcKin.mfLat_rad; |
From: <ddc...@us...> - 2004-02-05 23:19:41
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30786/include/sim Modified Files: tcRadarSensorState.h tcSensorState.h Log Message: Index: tcRadarSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadarSensorState.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcRadarSensorState.h 1 Feb 2004 22:19:08 -0000 1.5 --- tcRadarSensorState.h 5 Feb 2004 23:17:04 -0000 1.6 *************** *** 68,71 **** --- 68,72 ---- virtual bool ReleaseTrack(); + virtual bool IsCommandReceiver() {return isCommandReceiver;} virtual bool IsSemiactive() {return isSemiactive;} virtual void SetIlluminator(long illum_id, unsigned sensor_idx); *************** *** 80,83 **** --- 81,85 ---- protected: bool isSemiactive; + bool isCommandReceiver; tcRadar* GetSemiactiveIlluminator(); Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSensorState.h 1 Feb 2004 22:19:08 -0000 1.4 --- tcSensorState.h 5 Feb 2004 23:17:04 -0000 1.5 *************** *** 38,41 **** --- 38,42 ---- class tcSimState; + class tcGameObject; /** *************** *** 45,48 **** --- 46,50 ---- { public: + tcGameObject *parent; int mbActive; tnPoolIndex mnDBKey; *************** *** 61,64 **** --- 63,67 ---- virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); void Serialize(tcFile& file, bool mbLoad); + void SetParent(tcGameObject *obj) {parent = obj;} void UpdateCoverage(tsGeoPoint p,float az_rad); int UpdateScan(double afTime); *************** *** 66,69 **** --- 69,73 ---- tcSensorState* Clone(void); tcSensorState(); + tcSensorState(tcGameObject *obj); virtual ~tcSensorState(); |
From: <ddc...@us...> - 2004-02-05 23:19:41
|
Update of /cvsroot/gcblue/gcb_wx/help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30786/help Modified Files: help.html Log Message: Index: help.html =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/help/help.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** help.html 5 Jan 2004 02:48:02 -0000 1.5 --- help.html 5 Feb 2004 23:17:03 -0000 1.6 *************** *** 80,84 **** <tr> <td>a</td> ! <td>Accelerate time 4x</td> </tr> <tr> --- 80,88 ---- <tr> <td>a</td> ! <td>Cycle time acceleration (1x - 2x - 3x - 4x - 8x)</td> ! </tr> ! <tr> ! <td>A</td> ! <td>Decrease time acceleration</td> </tr> <tr> *************** *** 86,90 **** <td>Pause</td> </tr> ! <tr> <td>F</td> <td>Toggle fog</td> --- 90,94 ---- <td>Pause</td> </tr> ! <tr> <td>F</td> <td>Toggle fog</td> |
From: <ddc...@us...> - 2004-02-05 23:19:41
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30786/include/database Modified Files: tcMissileDBObject.h tcRadarDBObject.h Log Message: Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMissileDBObject.h 1 Feb 2004 22:19:08 -0000 1.5 --- tcMissileDBObject.h 5 Feb 2004 23:17:04 -0000 1.6 *************** *** 44,52 **** typedef enum _guidancemode { ! GM_COMMAND, ///< command guidance ! GM_NAV, ///< inertial, GPS ! GM_SENSOR1, ///< use primary sensor ! GM_SENSOR2, ///< use secondary sensor ! GM_SENSORALL ///< use all sensors } teGuidanceMode; --- 44,52 ---- typedef enum _guidancemode { ! GM_COMMAND = 0, ///< command guidance ! GM_NAV = 1, ///< inertial, GPS ! GM_SENSOR1 = 2, ///< use primary sensor ! GM_SENSOR2 = 3, ///< use secondary sensor ! GM_SENSORALL = 4 ///< use all sensors, not supported } teGuidanceMode; Index: tcRadarDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcRadarDBObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcRadarDBObject.h 30 Jan 2004 01:02:34 -0000 1.4 --- tcRadarDBObject.h 5 Feb 2004 23:17:04 -0000 1.5 *************** *** 38,41 **** --- 38,42 ---- unsigned int maxFireControlTracks; ///< max number of simultaneous fire control tracks bool isSemiactive; ///< set true if this is a semiactive radar + bool isCommandReceiver; ///< set true if this is a command guidance receiver (a workaround) bool mbDetectsSurface; ///< set true if detects surface targets bool mbDetectsAir; ///< set true if detects airborne targets |
From: <ddc...@pr...> - 2004-02-02 01:23:35
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1681/src/sim Modified Files: tcObjectControl.cpp tcPlatformObject.cpp tcSimState.cpp Log Message: Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcObjectControl.cpp 1 Feb 2004 22:19:09 -0000 1.11 --- tcObjectControl.cpp 2 Feb 2004 01:21:37 -0000 1.12 *************** *** 1240,1245 **** if (mpCommandInterface == NULL) {return false;} ! bReadyForLaunch = mpSS->IsLauncherReady(mpHookedGameObj, anLauncher); ! switch (anButton) { --- 1240,1246 ---- if (mpCommandInterface == NULL) {return false;} ! //bReadyForLaunch = mpSS->IsLauncherReady(mpHookedGameObj, anLauncher); ! bReadyForLaunch = true; // SetLaunch upgraded to check readiness independently ! switch (anButton) { Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcPlatformObject.cpp 1 Feb 2004 22:19:09 -0000 1.13 --- tcPlatformObject.cpp 2 Feb 2004 01:21:37 -0000 1.14 *************** *** 60,63 **** --- 60,77 ---- } + /** + * set AI target, also set all launcher targets. This + * may have some undesirable side effects !? + */ + void tcPlatformObject::DesignateTarget(long anID) + { + mcAI.SetTarget(anID); + unsigned nLaunchers = mcLauncherState.launchers.size(); + for (size_t n=0; n<nLaunchers; n++) + { + mcLauncherState.SetLauncherTarget(n, anID); + } + } + // update guidance to maintain/achieve formation position void tcPlatformObject::UpdateFormationGuidance() { Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcSimState.cpp 1 Feb 2004 22:19:09 -0000 1.27 --- tcSimState.cpp 2 Feb 2004 01:21:37 -0000 1.28 *************** *** 334,345 **** pobj->mfDamageLevel += 1.0f; // missile destroys itself on impact ! ! if (mpUserInfo->IsOwnAlliance(ptarget->mnAlliance)) ! { ! mpSound->PlayEffect(SEFFECT_IMPLOSION); ! } ! else { ! mpSound->PlayEffect(SEFFECT_EXPLOSION2); } } --- 334,347 ---- pobj->mfDamageLevel += 1.0f; // missile destroys itself on impact ! if (fDamageFract > 0) { ! if (mpUserInfo->IsOwnAlliance(ptarget->mnAlliance)) ! { ! mpSound->PlayEffect(SEFFECT_IMPLOSION); ! } ! else ! { ! mpSound->PlayEffect(SEFFECT_EXPLOSION2); ! } } } *************** *** 1151,1209 **** if (pDBObject == NULL) {return;} ! switch (pDBObject->mnClassID) { ! case DTYPE_GENERIC: ! { ! tcGenericDBObject *pGenericData = (tcGenericDBObject*)pDBObject; ! pnew = CreateGameObject(pGenericData); ! if (pnew == NULL) {return;} ! pnew->SetHeading(plaunchingplatform->mcKin.mfHeading_rad); ! pnew->SetSpeed(pGenericData->mfMaxSpeed_kts); ! } ! break; ! case DTYPE_MISSILE: ! { ! tcMissileDBObject *pMissileData = (tcMissileDBObject*)pDBObject; ! tcMissileObject* pMissileObj = dynamic_cast<tcMissileObject*>(CreateGameObject(pMissileData)); ! if (pMissileObj == NULL) {return;} - pMissileObj->msKState.mfAltitude_m = plaunchingplatform->mcKin.mfAlt_m; - if (pMissileObj->msKState.mfAltitude_m < 5.0f) { - pMissileObj->msKState.mfAltitude_m = 5.0f; - } - pMissileObj->msKState.mfSpeed_mps = plaunchingplatform->mcKin.mfSpeed_kts* - (float)C_KTSTOMPS; - pMissileObj->mfGoalHeading_rad = plaunchingplatform->mcKin.mfHeading_rad; - tcLauncherState* pLauncherState; - plaunchingplatform->GetLauncherState(pLauncherState); - if (pLauncherState != NULL) - { - tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; - if (pLauncher->meLaunchMode == DATUM_ONLY) - { - pMissileObj->msWaypoint = pLauncher->msDatum; - } - else if ((pLauncher->meLaunchMode == SEEKER_TRACK) - || (pLauncher->meLaunchMode == FC_TRACK)) - { - pMissileObj->msWaypoint = pLauncher->msDatum; - pMissileObj->mcSensorState.mbActive = true; - pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; - pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; - if (pMissileObj->mcSensorState.IsSemiactive()) - { - pMissileObj->mcSensorState.SetIlluminator( - plaunchingplatform->mnID, pLauncher->fireControlSensorIdx); - pLauncher->fireControlSensor->RequestTrack(); - } - } - } - // add heading and pitch initializers eventually, have to deal with launcher angle - pnew = static_cast<tcGameObject*>(pMissileObj); - } - break; - } // switch pnew->mfStatusTime = plaunchingplatform->mfStatusTime; pnew->mcKin = plaunchingplatform->mcKin; tcString s; s.Format("From %s",plaunchingplatform->mzUnit.mz); --- 1153,1209 ---- if (pDBObject == NULL) {return;} ! // only missiles are supported with this (and not for long) ! tcMissileDBObject *pMissileData = dynamic_cast<tcMissileDBObject*>(pDBObject); ! wxASSERT(pMissileData); ! ! tcMissileObject* pMissileObj = dynamic_cast<tcMissileObject*>(CreateGameObject(pMissileData)); ! if (pMissileObj == NULL) {return;} ! ! pMissileObj->msKState.mfAltitude_m = plaunchingplatform->mcKin.mfAlt_m; ! if (pMissileObj->msKState.mfAltitude_m < 5.0f) ! { ! pMissileObj->msKState.mfAltitude_m = 5.0f; ! } ! pMissileObj->msKState.mfSpeed_mps = plaunchingplatform->mcKin.mfSpeed_kts* ! (float)C_KTSTOMPS; ! ! tcLauncherState* pLauncherState; ! plaunchingplatform->GetLauncherState(pLauncherState); ! wxASSERT(pLauncherState); ! ! tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; ! ! pMissileObj->mfGoalHeading_rad = ! plaunchingplatform->mcKin.mfHeading_rad + pLauncher->pointingAngle; ! ! if (pLauncher->meLaunchMode == DATUM_ONLY) ! { ! pMissileObj->msWaypoint = pLauncher->msDatum; ! } ! else if ((pLauncher->meLaunchMode == SEEKER_TRACK) ! || (pLauncher->meLaunchMode == FC_TRACK)) ! { ! pMissileObj->msWaypoint = pLauncher->msDatum; ! pMissileObj->mcSensorState.mbActive = true; ! pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; ! pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; ! if (pMissileObj->mcSensorState.IsSemiactive()) ! { ! pMissileObj->mcSensorState.SetIlluminator( ! plaunchingplatform->mnID, pLauncher->fireControlSensorIdx); ! pLauncher->fireControlSensor->RequestTrack(); ! } ! } ! ! // add heading and pitch initializers eventually, have to deal with launcher angle ! pnew = static_cast<tcGameObject*>(pMissileObj); ! pnew->mfStatusTime = plaunchingplatform->mfStatusTime; pnew->mcKin = plaunchingplatform->mcKin; + pnew->mcKin.mfHeading_rad += pLauncher->pointingAngle; + + // pnew->mcKin.mfHeading_rad += p tcString s; s.Format("From %s",plaunchingplatform->mzUnit.mz); |
From: <ddc...@pr...> - 2004-02-02 01:23:35
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1681/include/sim Modified Files: tcPlatformObject.h Log Message: Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcPlatformObject.h 1 Feb 2004 22:19:08 -0000 1.9 --- tcPlatformObject.h 2 Feb 2004 01:21:37 -0000 1.10 *************** *** 58,62 **** virtual void DesignateLauncherDatum(tcPoint p, unsigned int anLauncher); virtual bool DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher); ! virtual void DesignateTarget(long anID) {mcAI.SetTarget(anID);} virtual void GetDatum(tsGeoPoint& p) {p=msTargetDatum;} virtual int GetLauncherQuantity(unsigned anLauncher); --- 58,62 ---- virtual void DesignateLauncherDatum(tcPoint p, unsigned int anLauncher); virtual bool DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher); ! virtual void DesignateTarget(long anID); virtual void GetDatum(tsGeoPoint& p) {p=msTargetDatum;} virtual int GetLauncherQuantity(unsigned anLauncher); |
From: <ddc...@pr...> - 2004-02-02 01:23:35
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1681/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcPlatformInterface.h 1 Feb 2004 22:19:08 -0000 1.13 --- tcPlatformInterface.h 2 Feb 2004 01:21:37 -0000 1.14 *************** *** 121,125 **** // target commands ! void SetTarget(long anID) {mpPlatformObj->mcAI.SetTarget(anID);} long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} float GetRangeToTarget(void); --- 121,125 ---- // target commands ! void SetTarget(long anID) {mpPlatformObj->DesignateTarget(anID);} long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} float GetRangeToTarget(void); |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11210/src/sim Modified Files: tcLauncherState.cpp tcMapView.cpp tcObjectControl.cpp tcPlatformObject.cpp tcRadarSensorState.cpp tcSensorState.cpp tcSimState.cpp tcTerrainView.cpp Log Message: Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcLauncherState.cpp 30 Jan 2004 01:02:35 -0000 1.4 --- tcLauncherState.cpp 1 Feb 2004 22:19:09 -0000 1.5 *************** *** 29,41 **** tcDatabase* tcLauncherState::mpDatabase = NULL; tcSimState* tcLauncherState::simState = NULL; /** ! * */ ! void tcLauncherState::AddFullLauncher(tcDatabase *pDatabase, tnPoolIndex anKey, float azimuth_rad) { tcLauncherDBObject *ldata; unsigned long nChildKey; ! ldata = dynamic_cast<tcLauncherDBObject*>(pDatabase->GetObject(anKey)); if (ldata == NULL) { --- 29,45 ---- tcDatabase* tcLauncherState::mpDatabase = NULL; tcSimState* tcLauncherState::simState = NULL; + /** ! * @param anKey, key of launcher database object in database ! * @param azimuth_rad mount angle of (fixed) launcher in radians relative to bow/nose */ ! void tcLauncherState::AddFullLauncher(tnPoolIndex anKey, float azimuth_rad) { tcLauncherDBObject *ldata; unsigned long nChildKey; ! wxASSERT(mpDatabase); ! ! ldata = dynamic_cast<tcLauncherDBObject*>(mpDatabase->GetObject(anKey)); if (ldata == NULL) { *************** *** 51,56 **** // add new launcher ! nChildKey = pDatabase->GetKey(ldata->mzChildClass); ! tcDatabaseObject *pChildDBObj = pDatabase->GetObject(nChildKey); --- 55,60 ---- // add new launcher ! nChildKey = mpDatabase->GetKey(ldata->mzChildClass); ! tcDatabaseObject *pChildDBObj = mpDatabase->GetObject(nChildKey); *************** *** 82,86 **** new_launcher.fireControlSensor = NULL; // set detailed launch mode if missile ! tcMissileDBObject* pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pDatabase->GetObject(nChildKey)); if (pMissileDBObj != NULL) { --- 86,91 ---- new_launcher.fireControlSensor = NULL; // set detailed launch mode if missile ! tcMissileDBObject* pMissileDBObj = ! dynamic_cast<tcMissileDBObject*>(mpDatabase->GetObject(nChildKey)); if (pMissileDBObj != NULL) { *************** *** 103,106 **** --- 108,218 ---- } + + /** + * @return LAUNCHER_READY if launcher is ready to launch. Launch readiness + * @return conditions depend on meLaunchMode for the launcher. + * @return Otherwise return error code + * @see teWeaponLaunchMode + * @see tcLauncherState::teLauncherStatus + * This method needs to be separated into smaller pieces. + */ + int tcLauncherState::GetLauncherStatus(unsigned nLauncher) + { + using namespace Database; + + if (nLauncher > launchers.size()) + { + std::cerr << "Bad launcher index" << std::endl; + return BAD_LAUNCHER; + } + tsLData& ldata = launchers[nLauncher]; + + if (ldata.mnCurrent <= 0) {return LAUNCHER_EMPTY;} // launcher empty + if (ldata.mfTimeToReady > 0) {return LAUNCHER_BUSY;} // launcher not ready + if (!ldata.mbActive) {return LAUNCHER_INACTIVE;} // launcher inactive or damaged + + if (ldata.meLaunchMode == DATUM_ONLY) // needs a datum programmed to launch + { + if ((ldata.msDatum.mfLat_rad != 0) || (ldata.msDatum.mfLon_rad != 0)) + { + return LAUNCHER_READY; + } + else + { + return NO_DATUM; + } + } + + wxASSERT(simState); + wxASSERT(parent); + + tcGameObject *targetObj = simState->GetObject(ldata.mnTargetID); + + // needs a fire control track (launching platform) to launch + if ((ldata.meLaunchMode == FC_TRACK)||(ldata.meLaunchMode == SEEKER_TRACK)) + { + if (ldata.mnTargetID == NULL_INDEX) return NO_TARGET; // needs a target + if (!ldata.fireControlSensor) return NO_FIRECONTROL; // database error + + if (!ldata.fireControlSensor->IsTrackAvailable()) return FC_BUSY; // no FC tracks available + if (targetObj == NULL) return NOT_DETECTED_FC; // target doesn't exist + + float range; + if (!ldata.fireControlSensor->CanDetectTarget(targetObj, range)) + { + return NOT_DETECTED_FC; + } + + if (ldata.meLaunchMode == FC_TRACK) return LAUNCHER_READY; + } + + // needs a seeker track to launch + if (ldata.meLaunchMode == SEEKER_TRACK) + { + tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(ldata.mpChildDBObj); + if (pMissileDBObj==NULL) + { + std::cerr << "GetLauncherStatus -- Error: SEEKER_TRACK guidance with non-missile" << std::endl; + return LAUNCHER_ERROR; + } + tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); + + float seekerAz = parent->mcKin.mfHeading_rad + ldata.pointingAngle; + tsGeoPoint seekerLoc; + seekerLoc.Set((float)parent->mcKin.mfLon_rad,(float)parent->mcKin.mfLat_rad); + + long fcID = parent->mnID; + unsigned fcIdx = ldata.fireControlSensorIdx; + + bool canDetect = + simState->RadarCanDetect(nSensorKey,targetObj,seekerLoc,seekerAz, fcID, fcIdx); + if (canDetect) + { + return LAUNCHER_READY; + } + else + { + return NOT_DETECTED_SEEKER; + } + } + + // will launch and either proceed unguided or autonomously search out target + if (ldata.meLaunchMode == AUTO) + { + bool hasDatum = (ldata.msDatum.mfLat_rad != 0) || (ldata.msDatum.mfLon_rad != 0); + bool hasTarget = (ldata.mnTargetID == NULL_INDEX); + if ((!hasDatum) && (!hasTarget)) + { + return NO_TARGET; + } + else + { + return LAUNCHER_READY; + } + } + + return LAUNCHER_ERROR; // bad meLaunchMode + } + bool tcLauncherState::IsDatumLaunch(unsigned anLauncher) { *************** *** 108,111 **** --- 220,224 ---- return launchers[anLauncher].meLaunchMode == DATUM_ONLY; } + bool tcLauncherState::IsSeekerLaunch(unsigned anLauncher) { *************** *** 114,121 **** } ! void tcLauncherState::SetFireControlSensor(unsigned nLauncher, tcRadar* radar) { if (nLauncher > launchers.size()) {return;} launchers[nLauncher].fireControlSensor = radar; } --- 227,248 ---- } ! /** ! * @param nLauncher launcher index ! * @param radar pointer to tcRadar object that acts as fire control sensor ! * @param sensorIdx index of tcRadar object on parent platform ! */ ! void tcLauncherState::SetFireControlSensor(unsigned nLauncher, tcRadar* radar, unsigned sensorIdx) { + wxASSERT(radar); + if (nLauncher > launchers.size()) {return;} launchers[nLauncher].fireControlSensor = radar; + launchers[nLauncher].fireControlSensorIdx = sensorIdx; + // Launchers with fireControlSensor must have a FC track to launch + // SEEKER_TRACK already requires a fire control track (and a seeker track) so do not change + if (launchers[nLauncher].meLaunchMode != SEEKER_TRACK) + { + launchers[nLauncher].meLaunchMode = FC_TRACK; + } } *************** *** 150,212 **** /** ! * @return true if launcher is ready to launch. Launch readiness ! * conditions depend on meLaunchMode for the launcher ! * @see teWeaponLaunchMode ! */ ! bool tcLauncherState::ReadyToLaunch(unsigned nLauncher) { ! using namespace Database; ! if (nLauncher > launchers.size()) { ! std::cerr << "Bad launcher index" << std::endl; ! return false; } ! tsLData& ldata = launchers[nLauncher]; ! ! if (ldata.mnCurrent <= 0) {return false;} // launcher empty ! if (ldata.mfTimeToReady > 0) {return false;} // launcher not ready ! ! switch (ldata.meLaunchMode) { ! case DATUM_ONLY: // needs a datum programmed to launch ! { ! return (ldata.msDatum.mfLat_rad != 0) || (ldata.msDatum.mfLon_rad != 0); ! } ! case SA_TRACK: // needs a track (launching platform) to launch, semi-active or command guidance ! case SEEKER_TRACK: // needs a track to launch, seeker sensor checked before associating ! { ! wxASSERT(simState); ! ! if (ldata.mnTargetID == NULL_INDEX) return false; // needs a target ! tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(ldata.mpChildDBObj); ! if (pMissileDBObj==NULL) ! { ! std::cerr << "ReadyToLaunch -- Error: SA_TRACK guidance with non-missile" << std::endl; ! return false; ! } ! ! tnPoolIndex nSensorKey = pMissileDBObj->GetPrimarySeekerKey(); ! tcGameObject *targetObj = simState->GetObject(ldata.mnTargetID); ! ! float seekerAz = parent->mcKin.mfHeading_rad + ldata.pointingAngle; ! tsGeoPoint seekerLoc; ! seekerLoc.Set((float)parent->mcKin.mfLon_rad,(float)parent->mcKin.mfLat_rad); ! bool canDetect = simState->RadarCanDetect(nSensorKey,targetObj,seekerLoc,seekerAz); ! return canDetect; ! } ! ! case AUTO: // will launch and either proceed unguided or autonomously search out target ! { ! bool hasDatum = (ldata.msDatum.mfLat_rad != 0) || (ldata.msDatum.mfLon_rad != 0); ! bool hasTarget = (ldata.mnTargetID == NULL_INDEX); ! return hasDatum || hasTarget; ! } ! default: ! std::cerr << "Bad meLaunchMode" << std::endl; ! return false; } ! return false; } /** * --- 277,339 ---- /** ! * Converts launcher status code into string. ! */ ! std::string tcLauncherState::TranslateLauncherStatus(int status) { ! ! if (status == LAUNCHER_READY) { ! return "Launcher ready"; } ! if (status == BAD_LAUNCHER) { ! return "Launcher ready"; } ! if (status == LAUNCHER_EMPTY) ! { ! return "Launcher empty"; ! } ! if (status == LAUNCHER_BUSY) ! { ! return "Launcher busy"; ! } ! if (status == NO_DATUM) ! { ! return "No datum"; ! } ! if (status == NO_TARGET) ! { ! return "No target"; ! } ! if (status == NOT_DETECTED_FC) ! { ! return "Not detected by fire control"; ! } ! if (status == NOT_DETECTED_SEEKER) ! { ! return "Not detected by seeker"; ! } ! if (status == FC_BUSY) ! { ! return "Fire control busy"; ! } ! if (status == LAUNCHER_ERROR) ! { ! return "Corrupt launcher error"; ! } ! if (status == LAUNCHER_INACTIVE) ! { ! return "Launcher inactive or damaged"; ! } ! if (status == NO_FIRECONTROL) ! { ! return "No fire control sensor (database error)"; ! } ! ! std::cerr << "Bad launcher status code"; ! return "Bad launcher status code"; } + /** * Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcMapView.cpp 29 Jan 2004 00:05:40 -0000 1.17 --- tcMapView.cpp 1 Feb 2004 22:19:09 -0000 1.18 *************** *** 96,103 **** mfGridBaseLon_rad = mfGridSize_rad*floorf(mrectCurrentView.left/mfGridSize_rad); mfGridBaseLat_rad = mfGridSize_rad*floorf(mrectCurrentView.bottom/mfGridSize_rad); ! mfScale_pelprad = mnWidth/mfLonWidth; ! mfScale_radppel = 1/mfScale_pelprad; ! // TODO: update ! // if(mpDDS_Terrain!=NULL) mpMapData->UpdateSurface(mpDDS_Terrain,mrectCurrentView); } /** --- 96,116 ---- mfGridBaseLon_rad = mfGridSize_rad*floorf(mrectCurrentView.left/mfGridSize_rad); mfGridBaseLat_rad = mfGridSize_rad*floorf(mrectCurrentView.bottom/mfGridSize_rad); ! mfScaleX_pelprad = mnWidth/mfLonWidth; ! mfScaleX_radppel = 1/mfScaleX_pelprad; ! mfScaleY_pelprad = mnHeight/mfLatWidth; ! mfScaleY_radppel = 1/mfScaleY_pelprad; ! ! /* ! fprintf(stdout, "*** setting map view to L:%f R:%f T:%f B:%f\n", ! mrectCurrentView.left, mrectCurrentView.right, ! mrectCurrentView.top, mrectCurrentView.bottom); ! fprintf(stdout, " map window L:%d R:%d T:%d B:%d\n", ! mrectWindow.left, mrectWindow.right, mrectWindow.top, mrectWindow.bottom); ! tcPoint testPoint = GeoToScreen(mfGridBaseLon_rad, mfGridBaseLat_rad); ! fprintf(stdout, " base geo (%f,%f) screen(%f, %f)\n", ! mfGridBaseLon_rad,mfGridBaseLat_rad, ! testPoint.x, testPoint.y); ! */ ! } /** *************** *** 115,120 **** tcPoint tcMapView::GeoToScreen(tcPoint pgeo) { tcPoint pscreen; ! pscreen.x = (pgeo.x - mfLonCenter)*mfScale_pelprad + mnXCenter; ! pscreen.y = (-pgeo.y + mfLatCenter)*mfScale_pelprad + mnYCenter; return pscreen; } --- 128,133 ---- tcPoint tcMapView::GeoToScreen(tcPoint pgeo) { tcPoint pscreen; ! pscreen.x = (pgeo.x - mfLonCenter)*mfScaleX_pelprad + mnXCenter; ! pscreen.y = (-pgeo.y + mfLatCenter)*mfScaleY_pelprad + mnYCenter; return pscreen; } *************** *** 122,138 **** tcPoint tcMapView::GeoToScreen(float afLon, float afLat) { tcPoint pscreen; ! pscreen.x = (afLon - mfLonCenter)*mfScale_pelprad + mnXCenter; ! pscreen.y = (-afLat + mfLatCenter)*mfScale_pelprad + mnYCenter; return pscreen; } /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) { ! return afExtent_rad*mfScale_pelprad; } /***********************************************************************************/ tcPoint tcMapView::ScreenToGeo(wxPoint pscreen) { tcPoint pgeo; ! pgeo.x = ((float)pscreen.x - mnXCenter)*mfScale_radppel + mfLonCenter; ! pgeo.y = ((float)-pscreen.y + mnYCenter)*mfScale_radppel + mfLatCenter; return pgeo; } --- 135,151 ---- tcPoint tcMapView::GeoToScreen(float afLon, float afLat) { tcPoint pscreen; ! pscreen.x = (afLon - mfLonCenter)*mfScaleX_pelprad + mnXCenter; ! pscreen.y = (-afLat + mfLatCenter)*mfScaleY_pelprad + mnYCenter; return pscreen; } /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) { ! return afExtent_rad*mfScaleX_pelprad; } /***********************************************************************************/ tcPoint tcMapView::ScreenToGeo(wxPoint pscreen) { tcPoint pgeo; ! pgeo.x = ((float)pscreen.x - mnXCenter)*mfScaleX_radppel + mfLonCenter; ! pgeo.y = ((float)-pscreen.y + mnYCenter)*mfScaleY_radppel + mfLatCenter; return pgeo; } *************** *** 140,145 **** tcPoint tcMapView::ScreenToGeo(float x, float y) { tcPoint pgeo; ! pgeo.x = (x - mnXCenter)*mfScale_radppel + mfLonCenter; ! pgeo.y = (-y + mnYCenter)*mfScale_radppel + mfLatCenter; return pgeo; } --- 153,158 ---- tcPoint tcMapView::ScreenToGeo(float x, float y) { tcPoint pgeo; ! pgeo.x = (x - mnXCenter)*mfScaleX_radppel + mfLonCenter; ! pgeo.y = (-y + mnYCenter)*mfScaleY_radppel + mfLatCenter; return pgeo; } *************** *** 162,166 **** wxPoint pos = wxWindow::GetPosition(); // mnWidth and mnHeight updated by tcWindow::OnSize - terrainView->SetSize(wxRect(pos.x,pos.y,mnWidth,mnHeight)); CalcViewParameters(); } --- 175,178 ---- *************** *** 173,176 **** --- 185,197 ---- (p.y >= mrectCurrentView.bottom)&&(p.y <= mrectCurrentView.top); } + /** + * override of wxWindow::SetSize so that terrainView->SetSize is called as well + */ + void tcMapView::SetSize(const wxRect& rect) + { + terrainView->SetSize(rect); + wxWindow::SetSize(rect); + } + /***********************************************************************************/ void tcMapView::SetViewCenterZoom(wxPoint pscreen, float afZoom) *************** *** 337,344 **** ! fKmPerPel = mfScale_radppel*C_RADTOKM; // calculate closest power of 10 km dist that corresponds to (about) 100 pixels fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScale_pelprad); tcString sText; --- 358,365 ---- ! fKmPerPel = mfScaleX_radppel*C_RADTOKM; // calculate closest power of 10 km dist that corresponds to (about) 100 pixels fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScaleX_pelprad); tcString sText; *************** *** 1323,1327 **** // search for hook ! fHookDistance = mfScale_radppel*16.0f; // 16 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; --- 1344,1348 ---- // search for hook ! fHookDistance = mfScaleX_radppel*16.0f; // 16 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; *************** *** 1350,1354 **** float dx,dy; float fDirection_rad = (float)C_PIOVER180*afDirection_deg; ! float dr = mfScale_radppel*16.0f; // 32 pixels dx = sinf(fDirection_rad)*dr; --- 1371,1375 ---- float dx,dy; float fDirection_rad = (float)C_PIOVER180*afDirection_deg; ! float dr = mfScaleX_radppel*16.0f; // 32 pixels dx = sinf(fDirection_rad)*dr; Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcObjectControl.cpp 29 Jan 2004 00:05:45 -0000 1.10 --- tcObjectControl.cpp 1 Feb 2004 22:19:09 -0000 1.11 *************** *** 672,676 **** mcWeaponPanel.mastrCaption[i][4].Format("L-%s","DAT"); break; ! case SA_TRACK: mcWeaponPanel.mastrCaption[i][4].Format("L-%s","SA"); break; --- 672,676 ---- mcWeaponPanel.mastrCaption[i][4].Format("L-%s","DAT"); break; ! case FC_TRACK: mcWeaponPanel.mastrCaption[i][4].Format("L-%s","SA"); break; Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcPlatformObject.cpp 30 Jan 2004 01:02:35 -0000 1.12 --- tcPlatformObject.cpp 1 Feb 2004 22:19:09 -0000 1.13 *************** *** 254,257 **** --- 254,264 ---- lastHeadingDelta = 0; } + + tcSensorState* tcPlatformObject::GetSensor(unsigned idx) + { + if (idx >= mapSensorState.size()) return NULL; + else return mapSensorState[idx]; + } + /******************************************************************************/ // return key of object to launch, otherwise NULL_INDEX *************** *** 296,310 **** /** ! * increment pending of anLauncher by anQuantity. ! * this doesn't support targeting multiple targets */ ! void tcPlatformObject::SetLaunch(int anLauncher, int anQuantity) { ! tsLData *pLauncher; - if ((anLauncher<0)||(anLauncher>=mcLauncherState.mnCount)) {return;} - pLauncher = &mcLauncherState.launchers[anLauncher]; - if (!pLauncher->mbActive) {return;} pLauncher->mnPending += anQuantity; if (pLauncher->mnPending > pLauncher->mnCurrent) {pLauncher->mnPending=pLauncher->mnCurrent;} } --- 303,322 ---- /** ! * If launcher is ready, increment pending of anLauncher by anQuantity. ! * This method does not support targeting multiple targets. ! * @return tcLauncherState::teLauncherStatus error code, LAUNCHER_READY = 0 for success */ ! int tcPlatformObject::SetLaunch(int anLauncher, int anQuantity) ! { ! int statusCode; ! ! statusCode = mcLauncherState.GetLauncherStatus(anLauncher); ! if (statusCode != tcLauncherState::LAUNCHER_READY) return statusCode; ! ! tsLData *pLauncher = &mcLauncherState.launchers[anLauncher]; pLauncher->mnPending += anQuantity; if (pLauncher->mnPending > pLauncher->mnCurrent) {pLauncher->mnPending=pLauncher->mnCurrent;} + return tcLauncherState::LAUNCHER_READY; } *************** *** 445,449 **** if (fcSensor == radar->mpDBObj->mzClass.mz) { ! mcLauncherState.SetFireControlSensor(nLauncher, radar); bSearching = false; } --- 457,461 ---- if (fcSensor == radar->mpDBObj->mzClass.mz) { ! mcLauncherState.SetFireControlSensor(nLauncher, radar, n); bSearching = false; } *************** *** 518,522 **** tnPoolIndex nLauncherKey = database->GetKey(mpDBObject->maLauncherClass[nLauncher]); float launcherAz_deg = mpDBObject->launcherAz[nLauncher]; ! mcLauncherState.AddFullLauncher(database, nLauncherKey, C_PIOVER180*launcherAz_deg); } --- 530,534 ---- tnPoolIndex nLauncherKey = database->GetKey(mpDBObject->maLauncherClass[nLauncher]); float launcherAz_deg = mpDBObject->launcherAz[nLauncher]; ! mcLauncherState.AddFullLauncher(nLauncherKey, C_PIOVER180*launcherAz_deg); } Index: tcRadarSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadarSensorState.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcRadarSensorState.cpp 30 Jan 2004 01:02:50 -0000 1.4 --- tcRadarSensorState.cpp 1 Feb 2004 22:19:09 -0000 1.5 *************** *** 27,30 **** --- 27,31 ---- #include "tcGenericDBObject.h" #include "tcMissileDBObject.h" + #include "tcSimState.h" // break up this file later *************** *** 45,49 **** --- 46,54 ---- mnMode = mpDBObj->mbDetectsAir ? SSMODE_FCSURVEILLANCE : SSMODE_SURVEILLANCE; mfSensorHeight_m = 10.0f; + isSemiactive = mpDBObj->isSemiactive; + illuminatorID = -1; + illuminatorSensorIdx = 0; + return true; } *************** *** 59,66 **** bool bInSearchVolume = false; ! if (mpDBObj==NULL) { ! return false; } bool isSurface = false; bool isAir = false; --- 64,79 ---- bool bInSearchVolume = false; ! wxASSERT(mpDBObj); ! ! if (!mbActive) return false; ! ! float illuminatorTargetRange_km = 1e8; ! if (isSemiactive) { ! tcRadar* illum = GetSemiactiveIlluminator(); ! if (illum == NULL) return false; ! if (!illum->CanDetectTarget(target, illuminatorTargetRange_km)) return false; } + bool isSurface = false; bool isAir = false; *************** *** 113,126 **** } ! if (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) ! >= rcs_dBsm) ! { ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || (mpDBObj->mbDetectsSurface && isSurface); ! return bTargetTypeMatch; // detected } ! return false; } --- 126,163 ---- } ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || (mpDBObj->mbDetectsSurface && isSurface); ! bool bDetectable; ! if (isSemiactive) ! { ! bDetectable = ! 20.0f*(2.0f*log10f(mpDBObj->mfRefRange_km) ! - log10f(fTargetRange_km) ! - log10f(illuminatorTargetRange_km) ! ) >= rcs_dBsm; } + else + { + bDetectable = + (40.0f*(log10f(mpDBObj->mfRefRange_km) - log10f(fTargetRange_km)) >= rcs_dBsm); + } + return bDetectable && bTargetTypeMatch; + + } ! /** ! * @return semi-active illuminator object ! */ ! tcRadar* tcRadar::GetSemiactiveIlluminator() ! { ! wxASSERT(isSemiactive); ! wxASSERT(simState); ! ! tcPlatformObject *platObj = ! dynamic_cast<tcPlatformObject*>(simState->GetObject(illuminatorID)); ! if (platObj == NULL) return NULL; ! tcRadar* illum = dynamic_cast<tcRadar*>(platObj->GetSensor(illuminatorSensorIdx)); ! return illum; } *************** *** 166,190 **** /** ! * @return true if track is available and radar can detect target. */ ! bool tcRadar::IsTrackAvailable(const tcGameObject* target) { ! return false; } /** ! * if track is available and detectable, reserve a track. * The current approach to semi-active guidance is to require each * missile to request one track per target, even if it is the same * target as a pre-existing track. */ ! bool tcRadar::RequestTrack(const tcGameObject* target) { ! return false; } bool tcRadar::ReleaseTrack() { ! return false; } --- 203,247 ---- /** ! * Does not test if radar can detect target. ! * @return true if track is available. */ ! bool tcRadar::IsTrackAvailable() { ! return (fireControlTrackCount < mpDBObj->maxFireControlTracks); } /** ! * if track is available, reserve a track. * The current approach to semi-active guidance is to require each * missile to request one track per target, even if it is the same * target as a pre-existing track. + * Calling method must check if target is detectable for this to + * work properly. */ ! bool tcRadar::RequestTrack() { ! if (IsTrackAvailable()) ! { ! fireControlTrackCount++; ! return true; ! } ! else ! { ! return false; ! } } bool tcRadar::ReleaseTrack() { ! if (fireControlTrackCount > 0) ! { ! fireControlTrackCount--; ! return true; ! } ! else ! { ! std::cerr << "tcRadar::ReleaseTrack called with no tracks." << std::endl; ! return false; ! } } *************** *** 207,209 **** * */ ! tcRadar::~tcRadar() {} \ No newline at end of file --- 264,276 ---- * */ ! tcRadar::~tcRadar() ! { ! // release fire control track ! if (isSemiactive) ! { ! if (tcRadar *illuminator = GetSemiactiveIlluminator()) ! { ! illuminator->ReleaseTrack(); ! } ! } ! } \ No newline at end of file Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcSensorState.cpp 4 Jan 2004 22:24:53 -0000 1.2 --- tcSensorState.cpp 1 Feb 2004 22:19:09 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- #include "tcSensorState.h" #include "aerror.h" + #include "tcSimState.h" + + tcSimState* tcSensorState::simState = NULL; /** Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcSimState.cpp 30 Jan 2004 01:02:50 -0000 1.26 --- tcSimState.cpp 1 Feb 2004 22:19:09 -0000 1.27 *************** *** 1,20 **** /* ! * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #include "stdwx.h" --- 1,20 ---- /* ! * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #include "stdwx.h" *************** *** 125,134 **** * If this is used with a non forward looking radar, it will not work * correctly. */ bool tcSimState::RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, ! tsGeoPoint asSensorLocation, float afSensorAz) { float fRange_km; ! if (mcDefaultRadar.InitFromDB(mpDatabase,anSensorKey,0)==false) {return false;} mcDefaultRadar.UpdateCoverage(asSensorLocation,afSensorAz); return mcDefaultRadar.CanDetectTarget(target,fRange_km); --- 125,147 ---- * If this is used with a non forward looking radar, it will not work * correctly. + * @param fcID id of platform that has fire control sensor (for semi-active) + * @param fcIdx index of fire control sensor on fc platform (for semi-active) */ bool tcSimState::RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, ! tsGeoPoint asSensorLocation, float afSensorAz, ! long fcID, unsigned fcIdx) { float fRange_km; ! ! if (mcDefaultRadar.InitFromDB(mpDatabase,anSensorKey,0)==false) ! { ! return false; ! } ! mcDefaultRadar.mbActive = true; ! ! if (mcDefaultRadar.IsSemiactive()) ! { ! mcDefaultRadar.SetIlluminator(fcID, fcIdx); ! } mcDefaultRadar.UpdateCoverage(asSensorLocation,afSensorAz); return mcDefaultRadar.CanDetectTarget(target,fRange_km); *************** *** 173,187 **** bFound = maPlatformState.Lookup(anKey,po); if (!bFound) {WTL("Err - tcSimState::DesignateLauncherTarget - source not found");return false;} tcPlatformObject* pPlatformObj = dynamic_cast<tcPlatformObject*>(po); if (pPlatformObj==NULL) {return false;} ! tcGameObject *pTargetObj; ! if (maPlatformState.Lookup(anTargetKey,pTargetObj) == false) {return false;} ! if (pTargetObj==NULL) {return false;} tcLauncherState *pLauncherState; po->GetLauncherState(pLauncherState); ! if (pLauncherState->ReadyToLaunch(anLauncher)) { - pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { mpSound->PlayEffect(SEFFECT_NOISYBEEP); --- 186,199 ---- bFound = maPlatformState.Lookup(anKey,po); if (!bFound) {WTL("Err - tcSimState::DesignateLauncherTarget - source not found");return false;} + tcPlatformObject* pPlatformObj = dynamic_cast<tcPlatformObject*>(po); if (pPlatformObj==NULL) {return false;} ! ! pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); tcLauncherState *pLauncherState; po->GetLauncherState(pLauncherState); ! if (pLauncherState->GetLauncherStatus(anLauncher) == tcLauncherState::LAUNCHER_READY) { if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { mpSound->PlayEffect(SEFFECT_NOISYBEEP); *************** *** 191,195 **** else { ! return false; } /* --- 203,207 ---- else { ! return true; } /* *************** *** 204,232 **** if (pLauncher->meLaunchMode == SEEKER_TRACK) { // TODO: move this out of here to a modular function call ! tcMissileDBObject *pMissileDBObj = ! dynamic_cast<tcMissileDBObject*>(mpDatabase->GetObject(pLauncher->mnChildDBKey)); ! if (pMissileDBObj==NULL) {return false;} ! tnPoolIndex nSensorKey = mpDatabase->GetKey(pMissileDBObj->maSensorClass[0]); ! float fSeekerAz = po->mcKin.mfHeading_rad; // TODO: add launcher angle effect ! tsGeoPoint sSeekerLoc; ! sSeekerLoc.Set((float)po->mcKin.mfLon_rad,(float)po->mcKin.mfLat_rad); ! bool bCanDetect = RadarCanDetect(nSensorKey,pTargetObj,sSeekerLoc,fSeekerAz); ! if (bCanDetect) ! { ! pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); ! if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_NOISYBEEP); ! } ! return true; ! } ! else { ! //pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); ! //mpSound->PlayEffect(SEFFECT_LOWBEEP); ! return false; ! } } else { ! return false; // don't designate for other launch modes for now } */ --- 216,244 ---- if (pLauncher->meLaunchMode == SEEKER_TRACK) { // TODO: move this out of here to a modular function call ! tcMissileDBObject *pMissileDBObj = ! dynamic_cast<tcMissileDBObject*>(mpDatabase->GetObject(pLauncher->mnChildDBKey)); ! if (pMissileDBObj==NULL) {return false;} ! tnPoolIndex nSensorKey = mpDatabase->GetKey(pMissileDBObj->maSensorClass[0]); ! float fSeekerAz = po->mcKin.mfHeading_rad; // TODO: add launcher angle effect ! tsGeoPoint sSeekerLoc; ! sSeekerLoc.Set((float)po->mcKin.mfLon_rad,(float)po->mcKin.mfLat_rad); ! bool bCanDetect = RadarCanDetect(nSensorKey,pTargetObj,sSeekerLoc,fSeekerAz); ! if (bCanDetect) ! { ! pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); ! if (mpUserInfo->IsOwnAlliance(pPlatformObj->mnAlliance)) { ! mpSound->PlayEffect(SEFFECT_NOISYBEEP); ! } ! return true; } else { ! //pPlatformObj->DesignateLauncherTarget(anTargetKey, anLauncher); ! //mpSound->PlayEffect(SEFFECT_LOWBEEP); ! return false; ! } ! } ! else { ! return false; // don't designate for other launch modes for now } */ *************** *** 244,247 **** --- 256,260 ---- UpdateObjTerrainInfo(); + // needs to be re-written to use the toLaunch queue for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); *************** *** 332,336 **** } } ! --- 345,349 ---- } } ! *************** *** 1073,1078 **** } } ! else if (apRadarSS->mnMode == SSMODE_SEEKERTRACK) { ! applat->mfDamageLevel = 1.0f; // self destruct if track lost pTrack->mnID = NULL_INDEX; if(mpUserInfo->IsOwnAlliance(applat->mnAlliance)) { --- 1086,1094 ---- } } ! // shut down missile if track lost for > 7 seconds ! if ((apRadarSS->mnMode == SSMODE_SEEKERTRACK)&& ! (mfSimTime - pTrack->mfTimestamp) > 7.0) ! { ! applat->mfDamageLevel = 1.0f; pTrack->mnID = NULL_INDEX; if(mpUserInfo->IsOwnAlliance(applat->mnAlliance)) { *************** *** 1083,1088 **** return; } ! pTrack->mnID = NULL_INDEX; ! apRadarSS->mnMode = SSMODE_SEEKERSEARCH; break; case SSMODE_SEEKERSEARCH: --- 1099,1105 ---- return; } ! // this code to enter search mode after track lost ! //pTrack->mnID = NULL_INDEX; ! //apRadarSS->mnMode = SSMODE_SEEKERSEARCH; break; case SSMODE_SEEKERSEARCH: *************** *** 1159,1172 **** tcLauncherState* pLauncherState; plaunchingplatform->GetLauncherState(pLauncherState); ! if (pLauncherState != NULL) { tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; ! if (pLauncher->meLaunchMode == DATUM_ONLY) { pMissileObj->msWaypoint = pLauncher->msDatum; } ! else if (pLauncher->meLaunchMode == SEEKER_TRACK) { pMissileObj->msWaypoint = pLauncher->msDatum; pMissileObj->mcSensorState.mbActive = true; pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; } } --- 1176,1199 ---- tcLauncherState* pLauncherState; plaunchingplatform->GetLauncherState(pLauncherState); ! if (pLauncherState != NULL) ! { tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; ! if (pLauncher->meLaunchMode == DATUM_ONLY) ! { pMissileObj->msWaypoint = pLauncher->msDatum; } ! else if ((pLauncher->meLaunchMode == SEEKER_TRACK) ! || (pLauncher->meLaunchMode == FC_TRACK)) ! { pMissileObj->msWaypoint = pLauncher->msDatum; pMissileObj->mcSensorState.mbActive = true; pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; + if (pMissileObj->mcSensorState.IsSemiactive()) + { + pMissileObj->mcSensorState.SetIlluminator( + plaunchingplatform->mnID, pLauncher->fireControlSensorIdx); + pLauncher->fireControlSensor->RequestTrack(); + } } } *************** *** 1184,1188 **** pnew->mnAlliance = plaunchingplatform->mnAlliance; AddPlatform(pnew); ! if (mpUserInfo->IsOwnAlliance(plaunchingplatform->mnAlliance)) { mpSound->PlayEffect(SEFFECT_MISSILELAUNCH); } --- 1211,1216 ---- pnew->mnAlliance = plaunchingplatform->mnAlliance; AddPlatform(pnew); ! if (mpUserInfo->IsOwnAlliance(plaunchingplatform->mnAlliance)) ! { mpSound->PlayEffect(SEFFECT_MISSILELAUNCH); } *************** *** 1738,1743 **** --- 1766,1773 ---- msScenarioInfo.mbLoaded = false; goalTracker = new tcGoalTracker(); + tcGoal::AttachSimState(this); tcLauncherState::AttachSimState(this); + tcSensorState::AttachSimState(this); mcSensorMap.CreateMapForAlliance(1); Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTerrainView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcTerrainView.cpp 22 Dec 2003 02:32:37 -0000 1.7 --- tcTerrainView.cpp 1 Feb 2004 22:19:09 -0000 1.8 *************** *** 55,58 **** --- 55,59 ---- float fSurfaceWidth, fSurfaceHeight; // surface coordinate dimensions + if (mrectCurrentView == r) return; mrectCurrentView = r; if (mp2DSurface == NULL) {return;} *************** *** 65,69 **** rdisp.Height = (fSurfaceHeight)*(r.top - mrectMap.bottom)/mrectMap.Height() - rdisp.Y; SetDisplayRegion(rdisp); ! //mp2DSurface->SetDisplayRegion(rdisp.x1,rdisp.y1,rdisp.x2,rdisp.y2); } --- 66,74 ---- rdisp.Height = (fSurfaceHeight)*(r.top - mrectMap.bottom)/mrectMap.Height() - rdisp.Y; SetDisplayRegion(rdisp); ! /* ! fprintf(stdout, "setting terrain to view L:%f R:%f T:%f B:%f\n", r.left, r.right, r.top, r.bottom); ! fprintf(stdout, " terrain window L:%d R:%d T:%d B:%d\n", ! mrectWindow.left, mrectWindow.right, mrectWindow.top, mrectWindow.bottom); ! */ //mp2DSurface->SetDisplayRegion(rdisp.x1,rdisp.y1,rdisp.x2,rdisp.y2); } |
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11210/include/sim Modified Files: tcGameObject.h tcLauncherState.h tcMapView.h tcPlatformObject.h tcRadarSensorState.h tcSensorState.h tcSimState.h Log Message: Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcGameObject.h 30 Jan 2004 01:02:34 -0000 1.11 --- tcGameObject.h 1 Feb 2004 22:19:08 -0000 1.12 *************** *** 119,123 **** void SetVisible(bool vis) {rel_pos.isVisible = vis;} virtual void SetSpeed(float afNewSpeed) {} ! virtual void SetLaunch(int anLauncher, int anQuantity) {} virtual void SetFormation(tsFormationParameters asFP) {} static void SetGameObjectDatabase(Database::tcDatabase *db) {database = db;} --- 119,123 ---- void SetVisible(bool vis) {rel_pos.isVisible = vis;} virtual void SetSpeed(float afNewSpeed) {} ! virtual int SetLaunch(int anLauncher, int anQuantity) {return 9;} virtual void SetFormation(tsFormationParameters asFP) {} static void SetGameObjectDatabase(Database::tcDatabase *db) {database = db;} Index: tcLauncherState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncherState.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcLauncherState.h 30 Jan 2004 01:02:34 -0000 1.4 --- tcLauncherState.h 1 Feb 2004 22:19:08 -0000 1.5 *************** *** 47,63 **** { int mbActive; long mnDBKey; ///< key in launcher database tcLauncherDBObject *mpLauncherDBObj; long mnChildDBKey; tcDatabaseObject *mpChildDBObj; float mfTimeToReady; unsigned int mnCurrent; tsGeoPoint msDatum; ///< datum to pass to weapon nav guidance tnPoolIndex mnTargetID; ///< track that seeker can acquire teWeaponLaunchMode meLaunchMode; int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x03 - land - unsigned int mnPending; float pointingAngle; ///< boresight azimuth angle in radians relative nose/bow tcRadar *fireControlSensor; ///< sensor for fire control guidance }; --- 47,68 ---- { int mbActive; + long mnDBKey; ///< key in launcher database tcLauncherDBObject *mpLauncherDBObj; long mnChildDBKey; tcDatabaseObject *mpChildDBObj; + float mfTimeToReady; unsigned int mnCurrent; + unsigned int mnPending; + tsGeoPoint msDatum; ///< datum to pass to weapon nav guidance tnPoolIndex mnTargetID; ///< track that seeker can acquire teWeaponLaunchMode meLaunchMode; int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x03 - land float pointingAngle; ///< boresight azimuth angle in radians relative nose/bow + tcRadar *fireControlSensor; ///< sensor for fire control guidance + unsigned fireControlSensorIdx; ///< index of sensor on parent platform }; *************** *** 68,71 **** --- 73,91 ---- { public: + enum teLauncherStatus + { + LAUNCHER_READY = 0, + BAD_LAUNCHER = 1, ///< launcher index does not exist + LAUNCHER_EMPTY = 2, + LAUNCHER_BUSY = 3, ///< launcher reloading + NO_DATUM = 4, + NO_TARGET = 5, + NOT_DETECTED_FC = 6, ///< fire control sensor can't detect target (could be off) + NOT_DETECTED_SEEKER = 7, ///< seeker can't detect target + FC_BUSY = 8, ///< fire control sensor has no free tracks + LAUNCHER_ERROR = 9, + LAUNCHER_INACTIVE = 10, + NO_FIRECONTROL = 11, + }; ///< launcher status codes tcGameObject *parent; int mnCount; *************** *** 75,89 **** static void AttachSimState(tcSimState* ss) {simState = ss;} ! void AddFullLauncher(tcDatabase *pDatabase, tnPoolIndex anKey, float azimuth_rad); int GetLauncherQuantity(unsigned anLauncher); std::string GetLaunchMode(unsigned anLauncher); bool IsDatumLaunch(unsigned anLauncher); bool IsSeekerLaunch(unsigned anLauncher); ! bool ReadyToLaunch(unsigned nLauncher); void Serialize(tcFile& file, bool abLoad); ! void SetFireControlSensor(unsigned nLauncher, tcRadar* radar); bool SetLauncherDatum(unsigned nLauncher, double lon_rad, double lat_rad); bool SetLauncherTarget(unsigned nLauncher, long targetID); void SetParent(tcGameObject *obj) {parent = obj;} tcLauncherState(); tcLauncherState(tcGameObject *parentObj); --- 95,111 ---- static void AttachSimState(tcSimState* ss) {simState = ss;} ! void AddFullLauncher(tnPoolIndex anKey, float azimuth_rad); int GetLauncherQuantity(unsigned anLauncher); + int GetLauncherStatus(unsigned nLauncher); std::string GetLaunchMode(unsigned anLauncher); bool IsDatumLaunch(unsigned anLauncher); bool IsSeekerLaunch(unsigned anLauncher); ! void Serialize(tcFile& file, bool abLoad); ! void SetFireControlSensor(unsigned nLauncher, tcRadar* radar, unsigned sensorIdx); bool SetLauncherDatum(unsigned nLauncher, double lon_rad, double lat_rad); bool SetLauncherTarget(unsigned nLauncher, long targetID); void SetParent(tcGameObject *obj) {parent = obj;} + static std::string TranslateLauncherStatus(int status); tcLauncherState(); tcLauncherState(tcGameObject *parentObj); Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMapView.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcMapView.h 29 Jan 2004 00:05:17 -0000 1.13 --- tcMapView.h 1 Feb 2004 22:19:08 -0000 1.14 *************** *** 156,161 **** float mfGridSize_rad; float mfGridBaseLon_rad,mfGridBaseLat_rad; ! float mfScale_pelprad; ///< map scale, pixels per radian ! float mfScale_radppel; ///< map scale, radians per pixel std::vector<tcMapObject*> specialGraphics; ///< mission graphics display for now --- 156,163 ---- float mfGridSize_rad; float mfGridBaseLon_rad,mfGridBaseLat_rad; ! float mfScaleX_pelprad; ///< map scale in X, pixels per radian ! float mfScaleX_radppel; ///< map scale in X, radians per pixel ! float mfScaleY_pelprad; ///< map scale in Y, pixels per radian ! float mfScaleY_radppel; ///< map scale in Y, radians per pixel std::vector<tcMapObject*> specialGraphics; ///< mission graphics display for now *************** *** 192,195 **** --- 194,198 ---- tcPoint ScreenToGeo(float x, float y); void SetActive(bool abActive); ///< overrides base class + void SetSize(const wxRect& rect); void SetView(tcPoint center, float afLonSpan); void SetViewCenterZoom(wxPoint pscreen, float afZoom); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcPlatformObject.h 30 Jan 2004 01:02:34 -0000 1.8 --- tcPlatformObject.h 1 Feb 2004 22:19:08 -0000 1.9 *************** *** 67,70 **** --- 67,71 ---- virtual bool IsRadiating(void); virtual std::vector<tcSensorState*>* GetSensorStateArray(void) {return &mapSensorState;} + virtual tcSensorState* GetSensor(unsigned idx); virtual void Launch(tnPoolIndex& rnKey, unsigned& rnLauncher); virtual void RandInitNear(float afLon_deg, float afLat_deg); *************** *** 72,76 **** virtual void SetHeading(float afNewHeading) {mcGS.SetHeading(afNewHeading);} virtual void SetSpeed(float afNewSpeed); ! virtual void SetLaunch(int anLauncher, int anQuantity); virtual void SetFormation(tsFormationParameters asFP) {msFormationParameters=asFP;} virtual void UpdateKin(double afStatusTime); --- 73,77 ---- virtual void SetHeading(float afNewHeading) {mcGS.SetHeading(afNewHeading);} virtual void SetSpeed(float afNewSpeed); ! virtual int SetLaunch(int anLauncher, int anQuantity); virtual void SetFormation(tsFormationParameters asFP) {msFormationParameters=asFP;} virtual void UpdateKin(double afStatusTime); Index: tcRadarSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadarSensorState.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcRadarSensorState.h 30 Jan 2004 01:02:34 -0000 1.4 --- tcRadarSensorState.h 1 Feb 2004 22:19:08 -0000 1.5 *************** *** 64,71 **** // fire control methods ! virtual bool IsTrackAvailable(const tcGameObject* target); ! virtual bool RequestTrack(const tcGameObject* target); virtual bool ReleaseTrack(); virtual void SetIlluminator(long illum_id, unsigned sensor_idx); --- 64,72 ---- // fire control methods ! virtual bool IsTrackAvailable(); ! virtual bool RequestTrack(); virtual bool ReleaseTrack(); + virtual bool IsSemiactive() {return isSemiactive;} virtual void SetIlluminator(long illum_id, unsigned sensor_idx); *************** *** 79,82 **** --- 80,85 ---- protected: bool isSemiactive; + + tcRadar* GetSemiactiveIlluminator(); }; Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorState.h 29 Jan 2004 00:05:18 -0000 1.3 --- tcSensorState.h 1 Feb 2004 22:19:08 -0000 1.4 *************** *** 37,40 **** --- 37,42 ---- #define SSMODE_FCSURVEILLANCE 6 // both + class tcSimState; + /** * Represents the state of a sensor. *************** *** 55,58 **** --- 57,61 ---- float mfSensorHeight_m; ///< height of sensor relative to platform altitude + static void AttachSimState(tcSimState *ss) {simState = ss;} void GetTestArea(tcRect& region); virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); *************** *** 64,67 **** --- 67,73 ---- tcSensorState(); virtual ~tcSensorState(); + + protected: + static tcSimState *simState; }; #endif \ No newline at end of file Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcSimState.h 29 Jan 2004 00:05:21 -0000 1.12 --- tcSimState.h 1 Feb 2004 22:19:08 -0000 1.13 *************** *** 103,107 **** void BuildCollisionGroups(); bool RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, ! tsGeoPoint asSensorLocation, float afSensorAz); void ChangeHeading(long anKey, float afNewHeading); void ChangeHeadingForced(tnPoolIndex anKey, float afNewHeading); // for scen edit mode --- 103,107 ---- void BuildCollisionGroups(); bool RadarCanDetect(tnPoolIndex anSensorKey, const tcGameObject* target, ! tsGeoPoint asSensorLocation, float afSensorAz, long fcID = -1, unsigned fcIdx = 0); void ChangeHeading(long anKey, float afNewHeading); void ChangeHeadingForced(tnPoolIndex anKey, float afNewHeading); // for scen edit mode |
From: <ddc...@pr...> - 2004-02-01 22:21:06
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11210/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.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcPlatformInterface.cpp 29 Jan 2004 00:05:23 -0000 1.14 --- tcPlatformInterface.cpp 1 Feb 2004 22:19:09 -0000 1.15 *************** *** 39,42 **** --- 39,43 ---- #include "tcAeroAirObject.h" #include "tcGenericDBObject.h" + #include "tcLauncherState.h" *************** *** 416,420 **** void tcPlatformInterface::Launch(int anLauncher, int quantity) { ! mpPlatformObj->SetLaunch(anLauncher, quantity); } --- 417,426 ---- void tcPlatformInterface::Launch(int anLauncher, int quantity) { ! int launcherStatus = mpPlatformObj->SetLaunch(anLauncher, quantity); ! if (launcherStatus != tcLauncherState::LAUNCHER_READY) ! { ! ! DisplayMessage(tcLauncherState::TranslateLauncherStatus(launcherStatus)); ! } } *************** *** 735,741 **** // print message to user console ! void tcPlatformInterface::DisplayMessage(std::string text) { ! if (mpConsole == NULL) {return;} ! mpConsole->Print(text.c_str()); } --- 741,750 ---- // print message to user console ! void tcPlatformInterface::DisplayMessage(std::string text) ! { ! wxASSERT(mpConsole); ! ! if (isPlatformOwnAlliance) mpConsole->Print(text.c_str()); ! } *************** *** 765,768 **** --- 774,801 ---- } + void tcPlatformInterface::GetLocalObj(void) + { + wxASSERT(mpSimState); + + mpPlatformObj = mpStaticPlatformObj; + GetSensorMap(); + isPlatformOwnAlliance = (mpPlatformObj) ? + (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->mnAlliance) != 0) : false; + } + + /** + * This method directly sets local obj + */ + void tcPlatformInterface::SetPlatform(tcPlatformObject *obj) + { + wxASSERT(mpSimState); + + mpPlatformObj = obj; + GetSensorMap(); + isPlatformOwnAlliance = (mpPlatformObj) ? + (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->mnAlliance) != 0) : false; + } + + tcPlatformObject* tcPlatformInterface::mpStaticPlatformObj = NULL; tcSimState* tcPlatformInterface::mpSimState = NULL; |
From: <ddc...@pr...> - 2004-02-01 22:21:06
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11210/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcPlatformInterface.h 29 Jan 2004 00:05:03 -0000 1.12 --- tcPlatformInterface.h 1 Feb 2004 22:19:08 -0000 1.13 *************** *** 187,192 **** float GetRand() {return randf();} static void SetObj(tcPlatformObject *apObj) {mpStaticPlatformObj = apObj;} ! void GetLocalObj(void) {mpPlatformObj = mpStaticPlatformObj;GetSensorMap();} ! void SetPlatform(tcPlatformObject *obj) {mpPlatformObj = obj;GetSensorMap();} ///< this method directly sets local obj static void AttachCommandQueue(tcCommandQueue *cq) {mpCommandQueue = cq;} static void AttachSimState(tcSimState *apSS) {mpSimState = apSS;} --- 187,192 ---- float GetRand() {return randf();} static void SetObj(tcPlatformObject *apObj) {mpStaticPlatformObj = apObj;} ! void GetLocalObj(void); ! void SetPlatform(tcPlatformObject *obj); static void AttachCommandQueue(tcCommandQueue *cq) {mpCommandQueue = cq;} static void AttachSimState(tcSimState *apSS) {mpSimState = apSS;} *************** *** 196,199 **** --- 196,200 ---- private: tcPlatformObject *mpPlatformObj; + bool isPlatformOwnAlliance; ///< true if platform is part of user's alliance static tcPlatformObject *mpStaticPlatformObj; static tcSimState *mpSimState; |
From: <ddc...@pr...> - 2004-02-01 22:21:05
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11210/include/database Modified Files: tcMissileDBObject.h Log Message: Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcMissileDBObject.h 30 Jan 2004 01:02:34 -0000 1.4 --- tcMissileDBObject.h 1 Feb 2004 22:19:08 -0000 1.5 *************** *** 64,69 **** { DATUM_ONLY, ///< needs a datum programmed to launch ! SA_TRACK, ///< needs a track (launching platform) to launch, semi-active or command guidance ! SEEKER_TRACK, ///< needs a track to launch, seeker sensor checked before associating AUTO ///< will launch and either proceed unguided or autonomously search out target }; --- 64,69 ---- { DATUM_ONLY, ///< needs a datum programmed to launch ! FC_TRACK, ///< needs a fire-control track (launching platform) to launch, semi-active or command guidance ! SEEKER_TRACK, ///< needs seeker track and FC track to launch AUTO ///< will launch and either proceed unguided or autonomously search out target }; |