Thread: [Gcblue-commits] gcb_wx/include/sim Game.h,1.54,1.55 tcAirfieldObject.h,1.2,1.3 tcCarrierObject.h,1.
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27186/include/sim Modified Files: Game.h tcAirfieldObject.h tcCarrierObject.h tcFlightOpsObject.h tcFlightPort.h tcGameObject.h tcPlatformObject.h tcSimState.h tcUserInfo.h Log Message: Index: tcUserInfo.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcUserInfo.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcUserInfo.h 23 Nov 2004 23:30:50 -0000 1.6 --- tcUserInfo.h 29 Apr 2005 18:52:02 -0000 1.7 *************** *** 29,49 **** #include "wx/wx.h" ! #ifdef WIN32 ! #include "wx/msw/private.h" // for MS Windows specific definitions ! #endif /** ! * */ class tcUserInfo { public: ! UINT8 mnOwnAlliance; ! int IsOwnAlliance(UINT anAlliance) const; - UINT8 GetOwnAlliance() const; - void SetOwnAlliance(UINT alliance) {mnOwnAlliance = alliance;} tcUserInfo(); ! virtual ~tcUserInfo(); }; --- 29,72 ---- #include "wx/wx.h" ! ! #include <string> /** ! * Singleton class with info on single-player player or multiplayer client ! * player. */ class tcUserInfo { public: ! enum ! { ! RANK_GM = 8 ! }; ! unsigned char mnOwnAlliance; ! ! ! bool IsOwnAlliance(unsigned char anAlliance) const; ! unsigned char GetOwnAlliance() const; ! void SetOwnAlliance(unsigned char alliance); ! ! const std::string& GetUsername() const; ! void SetUsername(const std::string& s); ! ! float GetScore() const; ! void SetScore(float x); ! ! ! unsigned char GetRank() const; ! const std::string RankToString(unsigned char rank); ! unsigned char ScoreToRank(float score); ! ! static tcUserInfo* Get(); ///< singleton accessor ! private: ! std::string username; ///< (client) username of player for multiplayer ! float score; ///< (client) score for user for info only, true score is maintained by server ! unsigned char rank; tcUserInfo(); ! ~tcUserInfo(); }; Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tcGameObject.h 17 Apr 2005 22:35:00 -0000 1.36 --- tcGameObject.h 29 Apr 2005 18:52:02 -0000 1.37 *************** *** 35,38 **** --- 35,39 ---- #include "tcSensorState.h" #include "tcLauncherState.h" + #include "tcControllableObject.h" namespace osg *************** *** 90,94 **** * Base class for all game objects. */ ! class tcGameObject { public: --- 91,95 ---- * Base class for all game objects. */ ! class tcGameObject : public tcControllableObject { public: *************** *** 103,107 **** tnPoolIndex mnDBKey; ///< key of database entry tcDBString mzUnit; ///< specific name of class instance ! UINT8 mnAlliance; /** derived objects can have different DB obj type in their scope --- 104,108 ---- tnPoolIndex mnDBKey; ///< key of database entry tcDBString mzUnit; ///< specific name of class instance ! /** derived objects can have different DB obj type in their scope *************** *** 114,117 **** --- 115,120 ---- virtual void ApplyDamage(float damage); ///< called when new damage occurs + virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) + float RangeTo(tcGameObject& p) const; float BearingTo(tcGameObject& p) const; *************** *** 139,142 **** --- 142,148 ---- virtual bool HasNewCommand() const; + bool GetRecreate() const; + void SetRecreate(bool state); + virtual bool IsDestroyed(); *************** *** 177,180 **** --- 183,187 ---- virtual ~tcGameObject(); protected: + bool recreateFlag; ///< workaround, true to resend create request for obj (multiplayer client only) static tcMapData *mapData; static Database::tcDatabase *database; Index: tcFlightOpsObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcFlightOpsObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcFlightOpsObject.h 6 Apr 2005 02:19:48 -0000 1.4 --- tcFlightOpsObject.h 29 Apr 2005 18:52:02 -0000 1.5 *************** *** 60,65 **** ! virtual bool AddChildToFlightDeck(std::string className, std::string unitName, teLocation loc); ! virtual bool AddChildToFlightDeck(tcDatabaseObject* databaseObject, std::string unitName, teLocation loc); virtual int CheckLanding(tcGameObject* obj); virtual void Clear(); --- 60,67 ---- ! virtual tcGameObject* AddChildToFlightDeck(std::string className, std::string unitName, ! teLocation loc, unsigned int position); ! virtual tcGameObject* AddChildToFlightDeck(tcDatabaseObject* databaseObject, std::string unitName, ! teLocation loc, unsigned int position); virtual int CheckLanding(tcGameObject* obj); virtual void Clear(); *************** *** 81,84 **** --- 83,89 ---- virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + tcFlightOpsObject(tcFlightportDBObject* dbObject, tcGameObject* gameObject); virtual ~tcFlightOpsObject(); Index: tcFlightPort.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcFlightPort.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcFlightPort.h 6 Apr 2005 02:19:48 -0000 1.9 --- tcFlightPort.h 29 Apr 2005 18:52:02 -0000 1.10 *************** *** 27,30 **** --- 27,35 ---- #include "tcGameObject.h" + class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; + namespace Database { *************** *** 45,54 **** enum teOperation { ! OP_NONE, ! OP_TRANSIT, ! OP_UNLOAD, ! OP_LOAD, ///< or refuel ! OP_REPAIR, ! OP_CHECK }; --- 50,59 ---- enum teOperation { ! OP_NONE = 0, ! OP_TRANSIT = 1, ! OP_UNLOAD = 2, ! OP_LOAD = 3, ///< or refuel ! OP_REPAIR = 4, ! OP_CHECK = 5 }; *************** *** 60,73 **** { public: ! teLocation current_location; ! int current_spot; ! teLocation goal_location; ! int goal_spot; // destination within deck1, deck2, or launch ! teOperation op; ! double ready_time; // time for op to be completed ! tcGameObject *obj; ! std::string LocationToString(teLocation loc); ! std::string OperationToString(teOperation op); }; --- 65,81 ---- { public: ! teLocation current_location; ! int current_spot; ! teLocation goal_location; ! int goal_spot; // destination within deck1, deck2, or launch ! teOperation op; ! double ready_time; // time for op to be completed ! tcGameObject *obj; ! tcUpdateStream& operator<<(tcUpdateStream& stream); ! tcUpdateStream& operator>>(tcUpdateStream& stream); ! ! std::string LocationToString(teLocation loc); ! std::string OperationToString(teOperation op); }; *************** *** 75,83 **** * for occupying unit. obj_info is NULL if the spot is empty. */ ! struct tsSpotInfo { tcAirState *obj_info; ///< air state info for object occupying or in transit to spot, NULL if empty float x,y,z; ///< surface assumed flat in between spots [m] float orientation; ///< orientation for runway, 0 along -z axis (heading axis for ships) float length; ///< [m] }; --- 83,94 ---- * for occupying unit. obj_info is NULL if the spot is empty. */ ! struct tsSpotInfo ! { tcAirState *obj_info; ///< air state info for object occupying or in transit to spot, NULL if empty float x,y,z; ///< surface assumed flat in between spots [m] float orientation; ///< orientation for runway, 0 along -z axis (heading axis for ships) float length; ///< [m] + + bool IsEmpty() const {return obj_info == 0;} }; *************** *** 95,99 **** double last_update_time; ! int AddObject(tcGameObject *obj, teLocation loc); void AddSpot(teLocation loc, float x, float y, float z, float orientation = 0, float length = 0); int CheckLanding(tcGameObject *obj); --- 106,110 ---- double last_update_time; ! int AddObject(tcGameObject *obj, teLocation loc, unsigned int position); void AddSpot(teLocation loc, float x, float y, float z, float orientation = 0, float length = 0); int CheckLanding(tcGameObject *obj); *************** *** 126,131 **** void UpdateUnitKin(tcAirState *airstate); // update unit kinematics based on parent info and rel_pos tcFlightPort(); ! virtual ~tcFlightPort(); private: /* tcAirState objects for all units in flightport are stored in --- 137,153 ---- void UpdateUnitKin(tcAirState *airstate); // update unit kinematics based on parent info and rel_pos + tcCommandStream& operator<<(tcCommandStream& stream); + tcCreateStream& operator<<(tcCreateStream& stream); + tcUpdateStream& operator<<(tcUpdateStream& stream); + + tcCommandStream& operator>>(tcCommandStream& stream); + tcCreateStream& operator>>(tcCreateStream& stream); + tcUpdateStream& operator>>(tcUpdateStream& stream); + + void ClearNewCommand(); + bool HasNewCommand() const; + tcFlightPort(); ! ~tcFlightPort(); private: /* tcAirState objects for all units in flightport are stored in *************** *** 137,140 **** --- 159,171 ---- unsigned hangarCapacity; unsigned inHangarCount; // count of units in hangar or in transit to hangar + short int localId; ///< used to assign object id within flightport + + // data for multiplayer commands + struct CommandInfo + { + short int id; ///< id of unit that command applies to + unsigned char op; ///< 0, launch unit, 1-3 move unit + }; + std::vector<CommandInfo> commandList; }; Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcSimState.h 29 Mar 2005 00:12:24 -0000 1.37 --- tcSimState.h 29 Apr 2005 18:52:02 -0000 1.38 *************** *** 177,180 **** --- 177,183 ---- void SetMultiplayerClient(); void SetMultiplayerServer(); + bool IsMultiplayerActive() const; + bool IsMultiplayerClient() const; + void SetScenarioDescription(std::string s); void SetScenarioLoaded(bool state); Index: tcAirfieldObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirfieldObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcAirfieldObject.h 17 Aug 2004 02:22:56 -0000 1.2 --- tcAirfieldObject.h 29 Apr 2005 18:52:02 -0000 1.3 *************** *** 31,34 **** --- 31,39 ---- #include "tcFlightOpsObject.h" + class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; + /** * Models an airfield *************** *** 39,42 **** --- 44,49 ---- { public: + virtual void ApplyDamage(float damage); + virtual void Clear(); virtual void RandInitNear(float afLon_deg, float afLat_deg); *************** *** 48,51 **** --- 55,71 ---- virtual void Update(double afStatusTime); + virtual tcCommandStream& operator<<(tcCommandStream& stream); + virtual tcCreateStream& operator<<(tcCreateStream& stream); + virtual tcUpdateStream& operator<<(tcUpdateStream& stream); + + virtual tcCommandStream& operator>>(tcCommandStream& stream); + virtual tcCreateStream& operator>>(tcCreateStream& stream); + virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + + + tcAirfieldObject(); tcAirfieldObject(tcAirfieldObject&); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcPlatformObject.h 17 Apr 2005 22:35:00 -0000 1.26 --- tcPlatformObject.h 29 Apr 2005 18:52:02 -0000 1.27 *************** *** 76,80 **** UPDATE_GUIDANCE = 0x01, UPDATE_LAUNCHERS = 0x02, ! UPDATE_SENSORS = 0x04 }; --- 76,81 ---- UPDATE_GUIDANCE = 0x01, UPDATE_LAUNCHERS = 0x02, ! UPDATE_SENSORS = 0x04, ! UPDATE_TASKS = 0x08 }; *************** *** 94,97 **** --- 95,99 ---- virtual void ApplyDamage(float damage); + virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) virtual void Clear(); virtual void DesignateDatum(tcPoint p); Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Game.h 20 Feb 2005 21:54:32 -0000 1.54 --- Game.h 29 Apr 2005 18:52:02 -0000 1.55 *************** *** 167,171 **** tcCommandQueue* commandQueue; tcSimPythonInterface* pythonInterface; ! tcUserInfo mcUserInfo; tcGameView mcGameView; tcGoalTracker* goalTracker; ///< monitors simstate vs. victory goals --- 167,171 ---- tcCommandQueue* commandQueue; tcSimPythonInterface* pythonInterface; ! tcUserInfo* userInfo; tcGameView mcGameView; tcGoalTracker* goalTracker; ///< monitors simstate vs. victory goals Index: tcCarrierObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCarrierObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcCarrierObject.h 6 Apr 2005 02:19:48 -0000 1.11 --- tcCarrierObject.h 29 Apr 2005 18:52:02 -0000 1.12 *************** *** 45,48 **** --- 45,50 ---- { public: + virtual void ApplyDamage(float damage); + virtual void Clear(); virtual void RandInitNear(float afLon_deg, float afLat_deg); *************** *** 62,65 **** --- 64,70 ---- virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + virtual void ClearNewCommand(); + virtual bool HasNewCommand() const; + tcCarrierObject(); tcCarrierObject(tcCarrierObject&); |