[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.57,1.58 tcAeroAirObject.cpp,1.4,1.5 tcAirObject.cpp,1.6,1
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@us...> - 2004-02-13 01:36:55
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv386/src/sim Modified Files: Game.cpp tcAeroAirObject.cpp tcAirObject.cpp tcCarrierObject.cpp tcESMSensor.cpp tcMissileObject.cpp tcObjectControl.cpp tcPlatformObject.cpp tcRadar.cpp tcSensorMap.cpp tcSensorState.cpp tcSimState.cpp tcSurfaceObject.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Game.cpp 5 Feb 2004 23:17:05 -0000 1.57 --- Game.cpp 13 Feb 2004 01:31:33 -0000 1.58 *************** *** 132,139 **** mnLeftMargin = 200; mnBottomMargin = 200; } /** ! * The tcGame object constructor. * */ --- 132,141 ---- mnLeftMargin = 200; mnBottomMargin = 200; + + std::cout << "Game constructor success" << std::endl; } /** ! * The tcGame object destructor. * */ *************** *** 323,331 **** --- 325,337 ---- startTime = wxDateTime::Now(); + std::cout << "Time init success" << std::endl; + try { StartMusic(); + std::cout << "Music start success" << std::endl; Initialize3DViewer(); + std::cout << "3D viewer init success" << std::endl; /* ** Init graphics engine * **/ *************** *** 392,395 **** --- 398,402 ---- throw; } + std::cout << "Game init success" << std::endl << std::endl; } Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcAeroAirObject.cpp 29 Jan 2004 00:05:38 -0000 1.4 --- tcAeroAirObject.cpp 13 Feb 2004 01:31:33 -0000 1.5 *************** *** 104,108 **** } ! void tcAeroAirObject::UpdateKin(double afStatusTime) { const float min_update_s = 0.0f; --- 104,108 ---- } ! void tcAeroAirObject::Update(double afStatusTime) { const float min_update_s = 0.0f; *************** *** 129,132 **** --- 129,134 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcAirObject.cpp 29 Jan 2004 00:05:38 -0000 1.6 --- tcAirObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 224,228 **** } ! void tcAirObject::UpdateKin(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); --- 224,228 ---- } ! void tcAirObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 247,250 **** --- 247,252 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcCarrierObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCarrierObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcCarrierObject.cpp 5 Jan 2004 02:48:03 -0000 1.6 --- tcCarrierObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 180,186 **** } /******************************************************************************/ ! void tcCarrierObject::UpdateKin(double afStatusTime) { ! tcSurfaceObject::UpdateKin(afStatusTime); flight_deck.Update(afStatusTime); UpdateLaunch(); --- 180,186 ---- } /******************************************************************************/ ! void tcCarrierObject::Update(double afStatusTime) { ! tcSurfaceObject::Update(afStatusTime); flight_deck.Update(afStatusTime); UpdateLaunch(); Index: tcESMSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcESMSensor.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcESMSensor.cpp 12 Feb 2004 01:54:49 -0000 1.2 --- tcESMSensor.cpp 13 Feb 2004 01:31:33 -0000 1.3 *************** *** 52,56 **** if (emitter == NULL) {return false;} ! if ((!emitter->mbActive)||(emitter->IsSemiactive())) {return false;} const tcKinematics& emitter_kin = emitter->parent->mcKin; --- 52,56 ---- if (emitter == NULL) {return false;} ! if ((!emitter->GetActive())||(emitter->IsSemiactive())) {return false;} const tcKinematics& emitter_kin = emitter->parent->mcKin; Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcMissileObject.cpp 7 Feb 2004 02:19:54 -0000 1.6 --- tcMissileObject.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 23,27 **** * */ ! void tcMissileObject::UpdateKin(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); --- 23,27 ---- * */ ! void tcMissileObject::Update(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 79,82 **** --- 79,84 ---- } + mcSensorState.Update(afStatusTime); + mfStatusTime = afStatusTime; *************** *** 119,125 **** break; case GM_SENSOR1: ! if (!mcSensorState.mbActive) { ! mcSensorState.mbActive = true; mcSensorState.mnMode = SSMODE_SEEKERSEARCH; mfGuidanceUpdateInterval = 0.5f; --- 121,127 ---- break; case GM_SENSOR1: ! if (!mcSensorState.GetActive()) { ! mcSensorState.SetActive(true); mcSensorState.mnMode = SSMODE_SEEKERSEARCH; mfGuidanceUpdateInterval = 0.5f; *************** *** 242,247 **** void tcMissileObject::DesignateTarget(long anID) { ! mcSensorState.mcTrack.mnID=anID; ! mcSensorState.mnMode=SSMODE_SEEKERACQUIRE; } --- 244,249 ---- void tcMissileObject::DesignateTarget(long anID) { ! mcSensorState.mcTrack.mnID = anID; ! mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; } Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcObjectControl.cpp 2 Feb 2004 01:21:37 -0000 1.12 --- tcObjectControl.cpp 13 Feb 2004 01:31:33 -0000 1.13 *************** *** 791,795 **** { tcSensorState *pSensorState = pSS->at(i); ! bool bActive = pSensorState->mbActive ? true : false; teButtonState eSensorState = bActive ? BS_ACTIVE : BS_DISABLED; mcSensorPanel.SetCaption(pSensorState->mpDBObj->mzClass.mz, i, 0); --- 791,795 ---- { tcSensorState *pSensorState = pSS->at(i); ! bool bActive = pSensorState->GetActive() ? true : false; teButtonState eSensorState = bActive ? BS_ACTIVE : BS_DISABLED; mcSensorPanel.SetCaption(pSensorState->mpDBObj->mzClass.mz, i, 0); *************** *** 1297,1301 **** { tcSensorState *pSensorState = pSS->at(anSensor); ! pSensorState->mbActive = !pSensorState->mbActive; return true; } --- 1297,1301 ---- { tcSensorState *pSensorState = pSS->at(anSensor); ! pSensorState->SetActive(!pSensorState->GetActive()); return true; } *************** *** 1492,1496 **** tcSensorState *pSensorState = pSS->at(i); tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); ! bool bActive = pSensorState->mbActive ? true : false; if ((pRadarSS)&&(bActive)) { --- 1492,1496 ---- tcSensorState *pSensorState = pSS->at(i); tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorState); ! bool bActive = pSensorState->GetActive() ? true : false; if ((pRadarSS)&&(bActive)) { Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcPlatformObject.cpp 12 Feb 2004 21:41:53 -0000 1.16 --- tcPlatformObject.cpp 13 Feb 2004 01:31:33 -0000 1.17 *************** *** 220,224 **** } ! void tcPlatformObject::UpdateKin(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); --- 220,224 ---- } ! void tcPlatformObject::Update(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 255,259 **** for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (pSensorState->mbActive) {return true;} } return false; --- 255,259 ---- for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (pSensorState->GetActive()) {return true;} } return false; *************** *** 266,270 **** tcSensorState *pSensorState = mapSensorState[k]; if (dynamic_cast<tcRadar*>(pSensorState)) { ! if (pSensorState->mbActive) {return true;} } } --- 266,270 ---- tcSensorState *pSensorState = mapSensorState[k]; if (dynamic_cast<tcRadar*>(pSensorState)) { ! if (pSensorState->GetActive()) {return true;} } } Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcRadar.cpp 12 Feb 2004 21:41:53 -0000 1.3 --- tcRadar.cpp 13 Feb 2004 01:31:33 -0000 1.4 *************** *** 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 "aerror.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 "aerror.h" *************** *** 33,38 **** /** ! * ! */ bool tcRadar::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { --- 33,38 ---- /** ! * ! */ bool tcRadar::InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad) { *************** *** 58,63 **** /** ! * ! */ bool tcRadar::CanDetectTarget(const tcGameObject* target, float& range_km) { --- 58,63 ---- /** ! * ! */ bool tcRadar::CanDetectTarget(const tcGameObject* target, float& range_km) { *************** *** 130,136 **** return false; } ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface); bool bDetectable; --- 130,136 ---- return false; } ! bool bTargetTypeMatch = (mpDBObj->mbDetectsAir && isAir) || ! (mpDBObj->mbDetectsSurface && isSurface); bool bDetectable; *************** *** 139,145 **** bDetectable = 20.0f*(2.0f*log10f(mpDBObj->mfRefRange_km) ! - log10f(fTargetRange_km) ! - log10f(illuminatorTargetRange_km) ! ) + rcs_dBsm >= 0; } else --- 139,145 ---- bDetectable = 20.0f*(2.0f*log10f(mpDBObj->mfRefRange_km) ! - log10f(fTargetRange_km) ! - log10f(illuminatorTargetRange_km) ! ) + rcs_dBsm >= 0; } else *************** *** 149,153 **** } return bDetectable && bTargetTypeMatch; ! } --- 149,153 ---- } return bDetectable && bTargetTypeMatch; ! } *************** *** 168,173 **** /** ! * ! */ void tcRadar::Serialize(tcFile& file, bool mbLoad) { --- 168,173 ---- /** ! * ! */ void tcRadar::Serialize(tcFile& file, bool mbLoad) { *************** *** 183,187 **** { wxASSERT(isSemiactive || isCommandReceiver); ! illuminatorID = illum_id; illuminatorSensorIdx = sensor_idx; --- 183,187 ---- { wxASSERT(isSemiactive || isCommandReceiver); ! illuminatorID = illum_id; illuminatorSensorIdx = sensor_idx; *************** *** 189,194 **** /** ! * ! */ tcRadar& tcRadar::operator=(tcRadar& ss) { --- 189,194 ---- /** ! * ! */ tcRadar& tcRadar::operator=(tcRadar& ss) { *************** *** 200,205 **** /** ! * ! */ tcRadar* tcRadar::Clone(void) { --- 200,205 ---- /** ! * ! */ tcRadar* tcRadar::Clone(void) { *************** *** 254,257 **** --- 254,340 ---- /** + * Updates missile seeker radar. + */ + void tcRadar::UpdateSeeker(double t) + { + long nTargetID; + tcGameObject *ptarget; + int bFound; + + + switch (mnMode) + { + case SSMODE_SEEKERACQUIRE: // fall through to SEEKERTRACK + case SSMODE_SEEKERTRACK: + nTargetID = mcTrack.mnID; + if (nTargetID == parent->mnID) // no self detection + { + bFound = false; + } + else + { + bFound = simState->maPlatformState.Lookup(nTargetID,ptarget); + } + if (bFound) + { // own-alliance is allowed + float fRange_km; + if (CanDetectTarget(ptarget, fRange_km)) + { + UpdateTrack(ptarget, t); + return; + } + } + // shut down missile if track lost for > 7 seconds + if ((mnMode == SSMODE_SEEKERTRACK)&& + (t - mcTrack.mfTimestamp) > 7.0) + { + parent->mfDamageLevel = 1.0f; + mcTrack.mnID = NULL_INDEX; + if(simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) + { + char zBuff[128]; + sprintf(zBuff,"Missile %d shut down\n", parent->mnID); + simState->mpCommandInterface->DisplayInfoMessage(zBuff); + } + return; + } + // this code to enter search mode after track lost + //pTrack->mnID = NULL_INDEX; + //apRadarSS->mnMode = SSMODE_SEEKERSEARCH; + break; + case SSMODE_SEEKERSEARCH: + { + // get list of candidate tracks/detections + tcGeoRect region; + GetTestArea(region); + + tcGameObjIterator iter(region); + float minRange = 1e15f; + tnPoolIndex minID = NULL_INDEX; + + // find closest detectable target + for (iter.First();iter.NotDone();iter.Next()) + { + tcGameObject *target = iter.Get(); + if (target != parent) // no self detection + { + float range_km; + bool bDetected = (parent->mnAlliance != target->mnAlliance) && + CanDetectTarget(target,range_km); + if ((bDetected) && (range_km < minRange)) + { + minID = target->mnID; + minRange = range_km; + } + } + } + + if (minID==NULL_INDEX) return; // no targets found + parent->DesignateTarget(minID); // select closest as target + } + } + } + + /** * Called after a surveillance detection to update sensor map for * appropriate alliance. *************** *** 325,329 **** float range_km; bool bDetected = (parent->mnAlliance != target->mnAlliance) && ! CanDetectTarget(target,range_km); if (bDetected) UpdateSensorMap(t, target, range_km); --- 408,412 ---- float range_km; bool bDetected = (parent->mnAlliance != target->mnAlliance) && ! CanDetectTarget(target,range_km); if (bDetected) UpdateSensorMap(t, target, range_km); *************** *** 332,351 **** } ! void tcRadar::Update(double t) { ! if ((mnMode != SSMODE_SURVEILLANCE) && (mnMode != SSMODE_FCSURVEILLANCE)) { ! return; } if (!UpdateScan(t)) return; // only update once per scan period wxASSERT(parent); ! ! UpdateSurveillance(t); } /** ! * ! */ tcRadar::tcRadar() : tcSensorState() --- 415,464 ---- } ! /** ! * Update sensor track with target state. Normally used with ! * missile seekers. ! */ ! void tcRadar::UpdateTrack(const tcGameObject* target, double t) { ! ! mcTrack.mfLat_rad = (float)target->mcKin.mfLat_rad; ! mcTrack.mfLon_rad = (float)target->mcKin.mfLon_rad; ! mcTrack.mfAlt_m = target->mcKin.mfAlt_m; ! mcTrack.mfSpeed_kts = target->mcKin.mfSpeed_kts; ! mcTrack.mfHeading_rad = target->mcKin.mfHeading_rad; ! mcTrack.mfClimbAngle_rad = target->mcKin.mfClimbAngle_rad; ! mcTrack.mfTimestamp = t; ! mcTrack.mnFlags = (TRACK_HEADING_VALID | TRACK_SPEED_VALID ! | TRACK_ALT_VALID | TRACK_CLIMB_VALID); ! if (mnMode == SSMODE_SEEKERACQUIRE) { ! mnMode = SSMODE_SEEKERTRACK; ! if (simState->mpUserInfo->IsOwnAlliance(parent->mnAlliance)) ! { ! simState->mpSound->PlayEffect(SEFFECT_TWOBEEPS); ! } } + } + void tcRadar::Update(double t) + { if (!UpdateScan(t)) return; // only update once per scan period wxASSERT(parent); ! ! if ((mnMode == SSMODE_SURVEILLANCE) || (mnMode == SSMODE_FCSURVEILLANCE)) ! { ! UpdateSurveillance(t); ! } ! else if ((mnMode == SSMODE_SEEKERTRACK)||(mnMode == SSMODE_SEEKERSEARCH) ! ||(mnMode == SSMODE_SEEKERACQUIRE)) ! { ! UpdateSeeker(t); ! } ! } /** ! * ! */ tcRadar::tcRadar() : tcSensorState() *************** *** 365,370 **** /** ! * ! */ tcRadar::~tcRadar() { --- 478,483 ---- /** ! * ! */ tcRadar::~tcRadar() { Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSensorMap.cpp 7 Feb 2004 02:19:54 -0000 1.4 --- tcSensorMap.cpp 13 Feb 2004 01:31:33 -0000 1.5 *************** *** 358,362 **** } ! void tcAllianceSensorMap::Update(double afStatusTime) { tnPoolIndex cmappos = maTrack.GetStartPosition(); tnPoolIndex nSize = maTrack.GetCount(); --- 358,367 ---- } ! void tcAllianceSensorMap::Update(double afStatusTime) ! { ! #ifdef _DEBUG ! wxASSERT(maTrack.CheckForCorruption()==false); ! #endif ! tnPoolIndex cmappos = maTrack.GetStartPosition(); tnPoolIndex nSize = maTrack.GetCount(); *************** *** 367,381 **** mfPreviousStatusTime = afStatusTime; ! for (tnPoolIndex i=0;i<nSize;i++) { maTrack.GetNextAssoc(cmappos,nKey,psmtrack); bool bAgedReport = false; ! for(int n=0;(n<psmtrack->mnContributors)&&(!bAgedReport);n++) { ! if (afStatusTime - psmtrack->maSensorReport[n].mfTimestamp > SENSORMAP_AGEOUTTIME) { psmtrack->RemoveReport(n); bAgedReport = true; } } ! if (psmtrack->mnContributors == 0) { ! if (psmtrack->track.mnID >= 0) { maTrackToSensorTrack[psmtrack->track.mnID] = NULL_INDEX; // used to be = maTrack.GetPoolSize(); } --- 372,391 ---- mfPreviousStatusTime = afStatusTime; ! for (tnPoolIndex i=0;i<nSize;i++) ! { maTrack.GetNextAssoc(cmappos,nKey,psmtrack); bool bAgedReport = false; ! for(int n=0;(n<psmtrack->mnContributors)&&(!bAgedReport);n++) ! { ! if (afStatusTime - psmtrack->maSensorReport[n].mfTimestamp > SENSORMAP_AGEOUTTIME) ! { psmtrack->RemoveReport(n); bAgedReport = true; } } ! if (psmtrack->mnContributors <= 0) ! { ! if (psmtrack->track.mnID >= 0) ! { maTrackToSensorTrack[psmtrack->track.mnID] = NULL_INDEX; // used to be = maTrack.GetPoolSize(); } *************** *** 383,390 **** sprintf(zBuff,"Dropped track %d at time %.1f",psmtrack->track.mnID,afStatusTime); WTL(zBuff); maTrack.RemoveKey(nKey); } ! else { // check for new data and update psmtrack->UpdateTrack(); --- 393,407 ---- sprintf(zBuff,"Dropped track %d at time %.1f",psmtrack->track.mnID,afStatusTime); WTL(zBuff); + #ifdef _DEBUG + wxASSERT(maTrack.CheckForCorruption()==false); + #endif maTrack.RemoveKey(nKey); + #ifdef _DEBUG + wxASSERT(maTrack.CheckForCorruption()==false); + #endif } ! else ! { // check for new data and update psmtrack->UpdateTrack(); *************** *** 392,395 **** --- 409,416 ---- } } + + #ifdef _DEBUG + wxASSERT(maTrack.CheckForCorruption()==false); + #endif } *************** *** 539,544 **** } ! void tcSensorMap::Update(double afStatusTime) { ! for(int n=0;n<mnMaps;n++) { mapMap[n]->Update(afStatusTime); } --- 560,567 ---- } ! void tcSensorMap::Update(double afStatusTime) ! { ! for(int n=0;n<mnMaps;n++) ! { mapMap[n]->Update(afStatusTime); } Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSensorState.cpp 12 Feb 2004 01:54:49 -0000 1.6 --- tcSensorState.cpp 13 Feb 2004 01:31:33 -0000 1.7 *************** *** 91,94 **** --- 91,108 ---- } + /** + * Activate or deactivate sensor. If activated mfLastScan is + * set to current time to give one scan delay for new detections + */ + void tcSensorState::SetActive(bool active) + { + if (mbActive == (int)active) return; + if (active) + { + mfLastScan = simState->GetTime(); + } + mbActive = active; + } + void tcSensorState::Update(double t) { Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcSimState.cpp 12 Feb 2004 21:41:53 -0000 1.32 --- tcSimState.cpp 13 Feb 2004 01:31:33 -0000 1.33 *************** *** 141,145 **** return false; } ! mcDefaultRadar.mbActive = true; mcDefaultRadar.SetParent(reference); --- 141,145 ---- return false; } ! mcDefaultRadar.SetActive(true); mcDefaultRadar.SetParent(reference); *************** *** 263,267 **** for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); ! pplat->UpdateKin(mfSimTime); { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); --- 263,267 ---- for (int i=0;i<nSize;i++) { maPlatformState.GetNextAssoc(cmappos,nKey,pplat); ! pplat->Update(mfSimTime); { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); *************** *** 288,291 **** --- 288,295 ---- UpdateAI(mfSimTime); goalTracker->Update(mfSimTime); + + #ifdef _DEBUG + wxASSERT(maPlatformState.CheckForCorruption()==false); + #endif } /********************************************************************/ *************** *** 1194,1198 **** { pMissileObj->msWaypoint = pLauncher->msDatum; ! pMissileObj->mcSensorState.mbActive = true; pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; --- 1198,1202 ---- { pMissileObj->msWaypoint = pLauncher->msDatum; ! pMissileObj->mcSensorState.SetActive(true); pMissileObj->mcSensorState.mnMode = SSMODE_SEEKERACQUIRE; pMissileObj->mcSensorState.mcTrack.mnID = pLauncher->mnTargetID; *************** *** 1595,1599 **** else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { pSensorState = pMissileObj->GetSensorState(); ! bActiveFound = pSensorState->mbActive; } --- 1599,1603 ---- else if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(pplat)) { pSensorState = pMissileObj->GetSensorState(); ! bActiveFound = pSensorState->GetActive(); } Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcSurfaceObject.cpp 29 Jan 2004 00:05:54 -0000 1.7 --- tcSurfaceObject.cpp 13 Feb 2004 01:31:33 -0000 1.8 *************** *** 70,74 **** } ! void tcSurfaceObject::UpdateKin(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); --- 70,74 ---- } ! void tcSurfaceObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); *************** *** 92,95 **** --- 92,97 ---- UpdateLauncherState(dt_s); + UpdateSensors(afStatusTime); + mfStatusTime = afStatusTime; } |