[Gcblue-commits] gcb_wx/include/database tcDatabaseIterator.h,NONE,1.1 tcOpticalDBObject.h,NONE,1.1
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-11-06 15:14:46
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31472/include/database Modified Files: tcBallisticDBObject.h tcDatabase.h tcDatabaseObject.h tcESMDBObject.h tcGenericDBObject.h tcMissileDBObject.h tcRadarDBObject.h tcSensorDBObject.h Added Files: tcDatabaseIterator.h tcOpticalDBObject.h Log Message: Added optical sensor model, fixed generic model display for sensor tracks --- NEW FILE: tcDatabaseIterator.h --- /** ** @file tcDatabaseIterator.h */ /* Copyright (C) 2004 Dewitt 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 _DATABASEITERATOR_H_ #define _DATABASEITERATOR_H_ #if _MSC_VER > 1000 #pragma once #endif #include "simmath.h" namespace Database { class tcDatabase; class tcDatabaseObject; class tcDatabaseIterator { public: void First(); tcDatabaseObject* Get(); void Next(); bool IsDone(); tcDatabaseIterator(unsigned int classificationMask); virtual ~tcDatabaseIterator(); private: static tcDatabase* database; long firstPos; ///< index of first game object, last advances to first long currentPos; ///< current position index tcDatabaseObject* currentObj; const unsigned int mask; unsigned nIterated; ///< count of elements iterated unsigned nSize; ///< size of list bool PassesMask(const tcDatabaseObject* obj); }; } #endif Index: tcGenericDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcGenericDBObject.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcGenericDBObject.h 8 Aug 2004 00:31:32 -0000 1.10 --- tcGenericDBObject.h 6 Nov 2004 15:13:39 -0000 1.11 *************** *** 74,77 **** --- 74,78 ---- tcDBString maLauncherClass[MAXLAUNCHERS]; tcDBString maSensorClass[MAXSENSORS]; + std::vector<long> sensorId; ///< database id's of sensors float launcherAz[MAXLAUNCHERS]; ///< pointing angles of launchers in degrees tc3DPoint launcherPosition[MAXLAUNCHERS]; ///< relative position of launchers in meters *************** *** 86,89 **** --- 87,91 ---- tcFlightportDBObject* GetFlightport(); tc3DPoint GetLauncherPosition(unsigned n); + bool HasAllEmitters(std::vector<long>& emitters); void RandInit(); virtual void PrintToFile(tcFile& file); *************** *** 100,103 **** --- 102,108 ---- tcGenericDBObject(tcGenericDBObject& obj); ///< copy constructor virtual ~tcGenericDBObject(); + + private: + void UpdateSensorList(); }; Index: tcRadarDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcRadarDBObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcRadarDBObject.h 8 Aug 2004 00:31:32 -0000 1.9 --- tcRadarDBObject.h 6 Nov 2004 15:13:39 -0000 1.10 *************** *** 1,6 **** ! /* ! ** tcRadarDBObject.h ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcRadarDBObject.h ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 48,51 **** --- 48,52 ---- bool mbDetectsGround; ///< set true if detects ground targets + virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method virtual const char* GetClassName() {return "Radar";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); Index: tcSensorDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSensorDBObject.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSensorDBObject.h 8 Aug 2004 00:31:32 -0000 1.6 --- tcSensorDBObject.h 6 Nov 2004 15:13:39 -0000 1.7 *************** *** 1,6 **** ! /* ! ** tcSensorDBObject.h ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcSensorDBObject.h ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 30,33 **** --- 30,35 ---- class TiXmlElement; + class tcSensorState; + class tcGameObject; namespace Database *************** *** 43,46 **** --- 45,49 ---- float mfScanPeriod_s; ///< [s] + virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method virtual const char* GetClassName() {return "Sensor";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcDatabaseObject.h 8 Aug 2004 00:31:32 -0000 1.15 --- tcDatabaseObject.h 6 Nov 2004 15:13:39 -0000 1.16 *************** *** 105,108 **** --- 105,109 ---- #define DTYPE_WEAPON 10 #define DTYPE_BALLISTIC 11 + #define DTYPE_OPTICAL 12 #define DTYPE_NULL 0xFFFFFFFF Index: tcBallisticDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcBallisticDBObject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcBallisticDBObject.h 8 Aug 2004 00:31:32 -0000 1.3 --- tcBallisticDBObject.h 6 Nov 2004 15:13:39 -0000 1.4 *************** *** 41,45 **** float GetMaxLevelGunRangeKm(); ! virtual const char* GetClassName() {return "Sensor";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); --- 41,45 ---- float GetMaxLevelGunRangeKm(); ! virtual const char* GetClassName() {return "Ballistic";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); --- NEW FILE: tcOpticalDBObject.h --- /** ** @file tcOpticalDBObject.h */ /* Copyright (C) 2004 Dewitt 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 _OPTICALDBOBJECT_H_ #define _OPTICALDBOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "tcSensorDBObject.h" class TiXmlElement; namespace Database { class tcSqlReader; class tcOpticalDBObject : public tcSensorDBObject { public: bool mbDetectsSurface; ///< set true if detects surface targets bool mbDetectsAir; ///< set true if detects airborne targets bool mbDetectsGround; ///< set true if detects ground targets bool isIR; ///< set true if detects infrared targets float nightFactor; ///< peak darkness range reduction factor virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method virtual const char* GetClassName() {return "Optical";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); virtual void SerializeXml(TiXmlElement* node, bool load); ///< XML serialization static void AddSqlColumns(std::string& columnString); void ReadSql(tcSqlReader& entry); void WriteSql(std::string& valueString); tcOpticalDBObject(); tcOpticalDBObject(tcOpticalDBObject& obj); ///< copy constructor virtual ~tcOpticalDBObject(); }; } // namespace Database #endif Index: tcDatabase.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabase.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcDatabase.h 1 Sep 2004 02:55:35 -0000 1.8 --- tcDatabase.h 6 Nov 2004 15:13:39 -0000 1.9 *************** *** 32,35 **** --- 32,36 ---- #include "tcDBString.h" #include "tcDatabaseObject.h" + #include <map> #include <wx/wx.h> *************** *** 68,82 **** tcPool<tcDatabaseObject,N_DATABASE_OBJECTS> mcObjectData; ///< need to add accessor and iterator for this tcString mstrCurrentFile; UINT32 mnVersion; ! ! void Clear(void); ! void CreateDefaultDB(void); int CreateObjectCopy(tnPoolIndex anKey); int CreateObjectByType(UINT anClassID); int DeleteObject(tnPoolIndex anKey); ! tnPoolIndex GetRandomKey(void); tcDatabaseObject* GetRandomOfType(UINT model_type); ! tnPoolIndex GetSize(void) {return mcObjectData.GetCount();} int GetObject(tnPoolIndex anKey, tcDatabaseObject*& rpobj); tcDatabaseObject* GetObject(tnPoolIndex anKey); --- 69,85 ---- tcPool<tcDatabaseObject,N_DATABASE_OBJECTS> mcObjectData; ///< need to add accessor and iterator for this + tcString mstrCurrentFile; UINT32 mnVersion; ! ! void BuildDictionaries(); ! void Clear(); ! void CreateDefaultDB(); int CreateObjectCopy(tnPoolIndex anKey); int CreateObjectByType(UINT anClassID); int DeleteObject(tnPoolIndex anKey); ! tnPoolIndex GetRandomKey(); tcDatabaseObject* GetRandomOfType(UINT model_type); ! tnPoolIndex GetSize() {return mcObjectData.GetCount();} int GetObject(tnPoolIndex anKey, tcDatabaseObject*& rpobj); tcDatabaseObject* GetObject(tnPoolIndex anKey); *************** *** 88,92 **** tnPoolIndex GetKey(tcDBString& s); void GetVersion(int& v1, int& v2, int& v3); ! void LoadDB(void); void LoadDB(tcString astrDBFileName); void SaveDB(tcString astrDBFileName); --- 91,95 ---- tnPoolIndex GetKey(tcDBString& s); void GetVersion(int& v1, int& v2, int& v3); ! void LoadDB(); void LoadDB(tcString astrDBFileName); void SaveDB(tcString astrDBFileName); *************** *** 95,99 **** void LoadDBXml(std::string suffix = ""); void SaveDBXml(std::string suffix = ""); ! void RandomizePlatforms(void); void PrintToFile(tcString); int Serialize(tcFile& file, bool mbLoad); --- 98,102 ---- void LoadDBXml(std::string suffix = ""); void SaveDBXml(std::string suffix = ""); ! void RandomizePlatforms(); void PrintToFile(tcString); int Serialize(tcFile& file, bool mbLoad); *************** *** 103,110 **** private: tcDatabase(); ~tcDatabase(); - - bool IsVersionSupported(void); }; --- 106,114 ---- private: + std::map<std::string, long> nameToKey; ///< dictionary of (className, key) pairs + + bool IsVersionSupported(); tcDatabase(); ~tcDatabase(); }; Index: tcESMDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcESMDBObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcESMDBObject.h 8 Aug 2004 00:31:32 -0000 1.5 --- tcESMDBObject.h 6 Nov 2004 15:13:39 -0000 1.6 *************** *** 1,6 **** ! /* ! ** tcESMDBObject.h ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcESMDBObject.h ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 37,40 **** --- 37,41 ---- { public: + virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method virtual const char* GetClassName() {return "ESM";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMissileDBObject.h 8 Aug 2004 00:31:32 -0000 1.11 --- tcMissileDBObject.h 6 Nov 2004 15:13:39 -0000 1.12 *************** *** 28,31 **** --- 28,32 ---- #include "tcWeaponDBObject.h" + #include <vector> class TiXmlElement; *************** *** 137,140 **** --- 138,142 ---- teWeaponLaunchMode GetLaunchMode(void); tnPoolIndex GetPrimarySeekerKey(); + bool HasAllEmitters(std::vector<long>& emitters); virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); |