[Gcblue-commits] gcb_wx/src/sim tcESMSensor.cpp,NONE,1.1 tcGameObjIterator.cpp,NONE,1.1 tcRadar.cpp,
Status: Alpha
Brought to you by:
ddcforge
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 --- |