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