[Gcblue-commits] gcb_wx/include/sim tcWeaponObject.h,NONE,1.1 tcAIData.h,1.5,1.6 tcGameObject.h,1.13
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/include/sim Modified Files: tcAIData.h tcGameObject.h tcHookInfo.h tcMissileObject.h tcPlatformObject.h tcSensorMap.h Added Files: tcWeaponObject.h Log Message: --- NEW FILE: tcWeaponObject.h --- /** @file tcWeaponObject.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 _TCWEAPONOBJECT_H_ #define _TCWEAPONOBJECT_H_ #include "tcGameObject.h" namespace Database { class tcDatabaseObject; } /** * Base class for weapons, e.g. missiles, bombs, gun rounds. * * @see tcGameObject */ class tcWeaponObject : public tcGameObject { public: /// returns true if id is intended target of this weapon bool IsIntendedTarget(long id); /// sets intended target void SetIntendedTarget(long targetId); protected: long intendedTarget; tcWeaponObject(); tcWeaponObject(tcWeaponObject&); tcWeaponObject(tcDatabaseObject *obj); ~tcWeaponObject(); }; #endif Index: tcAIData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAIData.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcAIData.h 7 Feb 2004 02:19:54 -0000 1.5 --- tcAIData.h 15 Feb 2004 19:47:21 -0000 1.6 *************** *** 61,69 **** unsigned mnCurrentOrder; ! UINT32 mnScriptVar[N_VAR]; // variables for use in scripts ! UINT32 mnTargetID; // target for AI engagements ! double mfNextUpdate; // time for next update of AI ! float mfUpdateInterval; // interval for AI updates ! std::string mzActionText; // text for script to set to describe current platform action // order methods --- 61,69 ---- unsigned mnCurrentOrder; ! UINT32 mnScriptVar[N_VAR]; ///< variables for use in scripts ! long mnTargetID; ///< target for AI engagements ! double mfNextUpdate; ///< time for next update of AI ! float mfUpdateInterval; ///< interval for AI updates ! std::string mzActionText; ///< text for script to set to describe current platform action // order methods *************** *** 88,93 **** void ClearVars(); void GetActionText(std::string& text) {text = mzActionText;} ! void SetTarget(UINT32 anId) {mnTargetID = anId;} ! UINT32 GetTarget(void) {return mnTargetID;} // long to work better with Python void ClearTarget(void) {mnTargetID = NULL_INDEX;} --- 88,93 ---- void ClearVars(); void GetActionText(std::string& text) {text = mzActionText;} ! void SetTarget(long anId) {mnTargetID = anId;} ! long GetTarget(void) {return mnTargetID;} // long to work better with Python void ClearTarget(void) {mnTargetID = NULL_INDEX;} Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcGameObject.h 13 Feb 2004 01:31:32 -0000 1.13 --- tcGameObject.h 15 Feb 2004 19:47:21 -0000 1.14 *************** *** 39,42 **** --- 39,45 ---- class tcDatabase; } + + class tcSimState; + /** * 3D model coordinates relative to parent frame of *************** *** 123,126 **** --- 126,130 ---- static void SetGameObjectDatabase(Database::tcDatabase *db) {database = db;} static void SetGameObjectMapData(tcMapData *md) {mapData = md;} + static void SetSimState(tcSimState *ss) {simState = ss;} const tcGameObject* operator= (const tcGameObject *p) {return p;} tcGameObject(); *************** *** 131,134 **** --- 135,139 ---- static tcMapData *mapData; static Database::tcDatabase *database; + static tcSimState *simState; }; #endif \ No newline at end of file Index: tcHookInfo.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcHookInfo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcHookInfo.h 7 Feb 2004 02:19:54 -0000 1.4 --- tcHookInfo.h 15 Feb 2004 19:47:22 -0000 1.5 *************** *** 41,44 **** --- 41,49 ---- class tcDatabaseObject; } + namespace Sensor + { + class tcSensorMapTrack; + } + using namespace Database; *************** *** 56,59 **** --- 61,65 ---- void AttachOptions(tcOptions *apOptions) {mpOptions = apOptions;} void AttachUserInfo(tcUserInfo *apUserInfo) {mpUserInfo=apUserInfo;} + void SetEngagedDrawMode(int mode) {drawEngagedMode = mode;} void SetHookID(tnPoolIndex anID) {mnHookID=anID;} void OnLButtonDown(wxMouseEvent& event); *************** *** 63,66 **** --- 69,73 ---- virtual ~tcHookInfo(); private: + int drawEngagedMode; ///< = 1 to draw engaged by class name and quantity, 0 for id's tcSimState *mpSS; ///< pointer to SimState object to access hook info, change this ///< to a UserSimState reference when ready (state as known by user's side) *************** *** 73,76 **** --- 80,85 ---- Gdiplus::Font *mpFont, *mpFontLarge; + void DrawTrackEngaged(Gdiplus::Graphics *graphics, + const Sensor::tcSensorMapTrack *smtrack, float& x, float& y); void GetFunctionalName(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject); void GetObjectInfo(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject); Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMissileObject.h 13 Feb 2004 01:31:32 -0000 1.5 --- tcMissileObject.h 15 Feb 2004 19:47:22 -0000 1.6 *************** *** 24,28 **** #include "tcAero.h" ! #include "tcGameObject.h" #include "tcGuidanceState.h" #include "tcRadar.h" --- 24,28 ---- #include "tcAero.h" ! #include "tcWeaponObject.h" #include "tcGuidanceState.h" #include "tcRadar.h" *************** *** 35,39 **** * @see tcGameObject */ ! class tcMissileObject : public tcGameObject { public: --- 35,39 ---- * @see tcGameObject */ ! class tcMissileObject : public tcWeaponObject { public: Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcPlatformObject.h 13 Feb 2004 01:31:32 -0000 1.12 --- tcPlatformObject.h 15 Feb 2004 19:47:22 -0000 1.13 *************** *** 65,68 **** --- 65,69 ---- // virtual void GetSensorStateRef(tcSensorState**& rapSensorState, int& rnCount); virtual bool HasActivatedSensor(void); + virtual bool IsInterceptingTrack(long id); virtual bool IsRadiating(void); virtual std::vector<tcSensorState*>* GetSensorStateArray(void) {return &mapSensorState;} Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorMap.h 13 Feb 2004 01:31:32 -0000 1.3 --- tcSensorMap.h 15 Feb 2004 19:47:22 -0000 1.4 *************** *** 19,24 **** ! #if !defined(AFX_TCSENSORMAP_H__57EE0C2E_4C78_4B79_87F1_4770F3E989A9__INCLUDED_) ! #define AFX_TCSENSORMAP_H__57EE0C2E_4C78_4B79_87F1_4770F3E989A9__INCLUDED_ #if _MSC_VER > 1000 --- 19,24 ---- ! #ifndef _SENSORMAP_H_ ! #define _SENSORMAP_H_ #if _MSC_VER > 1000 *************** *** 31,34 **** --- 31,36 ---- #include <vector> + class tcSimState; + namespace Sensor { *************** *** 67,81 **** }; ! class tcSensorMapTrack { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: tcTrack track; double mfLastUpdateTime; tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; int mnEmitters; tnPoolIndex mnDatabaseID; // database ID of track bool AddReport(const tcSensorReport& report); ! int GetEmitterCount() {return mnEmitters;} const tsEmitterInfo* GetEmitter(int anIdx) { --- 69,105 ---- }; ! /** ! * State info for track stored in alliance sensor map. ! * The targetedRating is used by the AI to avoid inefficient ganging up on track. ! * engageRating controls how much ordance ! */ ! class tcSensorMapTrack ! { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: tcTrack track; double mfLastUpdateTime; + tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors + int mnContributors; tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; int mnEmitters; tnPoolIndex mnDatabaseID; // database ID of track + float matchupRating; ///< matchup rating for platforms that have targeted this track + float expectedDamage; ///< rating of expected fractional damage of weapons launched at target, 0 - none, 1.0 - totally destroyed + float assessedDamage; ///< fractional damage assessment + std::vector<long> intercepts; ///< vector of platform ids that are intercepting this track + std::vector<long> engaged; ///< vector of weapon ids that are tracking / engaging + + /// called to indicate weapon launched at target + bool AddEngagement(long id); + + /// called to indicate platform intercepting target + bool AddIntercept(long id); bool AddReport(const tcSensorReport& report); ! ! ///< static method to set pointer to tcSimState object ! static void AttachSimState(tcSimState* ss) {simState = ss;} ! int GetEmitterCount() {return mnEmitters;} const tsEmitterInfo* GetEmitter(int anIdx) { *************** *** 83,93 **** return &maEmitterInfo[anIdx]; } - const tcTrack* GetTrack() {return &track;} - bool UpdateEmitter(tsEmitterInfo*& rpEmitterInfo, tnPoolIndex anEmitterID); bool IsNew() {return track.mfTimestamp == 0;} bool UpdateActiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateClassification(UINT16 mnClassification, teAffiliation meAffiliation, tnPoolIndex mnDatabaseID); bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateTrack(void); --- 107,132 ---- return &maEmitterInfo[anIdx]; } + /// gets number of weapons engaging this track + unsigned GetEngagedCount() const; + + /// gets number of platforms intercepting this track + unsigned GetInterceptCount() const; + + const tcTrack* GetTrack() {return &track;} bool IsNew() {return track.mfTimestamp == 0;} + + bool UpdateActiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateClassification(UINT16 mnClassification, teAffiliation meAffiliation, tnPoolIndex mnDatabaseID); + bool UpdateEmitter(tsEmitterInfo*& rpEmitterInfo, tnPoolIndex anEmitterID); + + /// removes engagement ids for weapons no longer engaging this track + void UpdateEngagements(); + + /// removes intercept ids for platforms no longer intercepting this track + void UpdateIntercepts(); + bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateTrack(void); *************** *** 98,109 **** ~tcSensorMapTrack(); - tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; // most recent data from contributing sensors - int mnContributors; - void RemoveReport(int n); }; ! class tcAllianceSensorMap { enum {MAX_SMTRACKS = 512, MAX_TRACKS = 512}; public: --- 137,149 ---- ~tcSensorMapTrack(); void RemoveReport(int n); + + private: + static tcSimState *simState; }; ! class tcAllianceSensorMap ! { enum {MAX_SMTRACKS = 512, MAX_TRACKS = 512}; public: *************** *** 130,133 **** --- 170,174 ---- tnPoolIndex maTrackToSensorTrack[MAX_TRACKS]; double mfPreviousStatusTime; + double lastEngagementsUpdate; }; *************** *** 167,169 **** }; } ! #endif // !defined(AFX_TCSENSORMAP_H__57EE0C2E_4C78_4B79_87F1_4770F3E989A9__INCLUDED_) --- 208,210 ---- }; } ! #endif // _SENSORMAP_H_ |