Hi!

I'd like to point out that FGAIBase already has a member for storing
the callsign. In my ATC patchset I have included a diff that changes
the affected AI classes to use this common member. I have split my
modifications into smaller changes so that they can be reviewed and
applied individually, but nobody cared (it's not too late to check the
other parts).

Anyway, attached is a new version of the AI patch (for OSG branch)
which also takes care of a little naming inconsistency involving Path
vs. SMPath and some const issues.

Notes: I don't know why
* the *public* getter methods in AIBase begin with an underscore.
* the callsign is a tied property -- it surely doesn't change too often?

Greets,
Csaba
Index: src/AIModel/AIAircraft.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIAircraft.cxx,v
retrieving revision 1.67
diff -u -r1.67 AIAircraft.cxx
--- src/AIModel/AIAircraft.cxx  9 Jul 2007 05:07:56 -0000       1.67
+++ src/AIModel/AIAircraft.cxx  10 Jul 2007 00:44:06 -0000
@@ -115,8 +115,7 @@
                                                     
&FGAIAircraft::_getGearDown));
     props->tie("callsign",
                SGRawValueMethods<FGAIAircraft,const char *>(*this,
-                                                    
&FGAIAircraft::_getCallSign));
-    //props->setStringValue("callsign", callsign.c_str());
+                                                    &FGAIBase::getCallSign));
 }
 
 
@@ -325,10 +324,6 @@
     return _performance->gearExtensible(this);
 }
 
-const char * FGAIAircraft::_getCallSign() const {
-    return callsign.c_str();
-}
-
 
 void FGAIAircraft::loadNextLeg() {
 
@@ -410,11 +405,6 @@
 }
 
 
-void FGAIAircraft::setCallSign(const string& s) {
-    callsign = s;
-}
-
-
 void FGAIAircraft::doGroundAltitude() {
     if (fabs(altitude_ft - (tgt_altitude_ft+groundOffset)) > 1000.0)
         altitude_ft = (tgt_altitude_ft + groundOffset);
Index: src/AIModel/AIAircraft.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIAircraft.hxx,v
retrieving revision 1.30
diff -u -r1.30 AIAircraft.hxx
--- src/AIModel/AIAircraft.hxx  9 Jul 2007 05:07:56 -0000       1.30
+++ src/AIModel/AIAircraft.hxx  10 Jul 2007 00:44:06 -0000
@@ -60,8 +60,6 @@
     void YawTo(double angle);
     void ClimbTo(double altitude);
     void TurnTo(double heading);
-    
-    void setCallSign(const string& );
 
     void getGroundElev(double dt); //TODO these 3 really need to be public?
     void doGroundAltitude();
@@ -137,9 +135,7 @@
     bool holdPos;
 
     bool _getGearDown() const;
-    const char *_getCallSign() const;
     bool reachedWaypoint;
-    string callsign;             // The callsign of this tanker.
 
     PerformanceData* _performance; // the performance data for this aircraft
 };
Index: src/AIModel/AIBase.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIBase.cxx,v
retrieving revision 1.78
diff -u -r1.78 AIBase.cxx
--- src/AIModel/AIBase.cxx      7 Jun 2007 16:30:26 -0000       1.78
+++ src/AIModel/AIBase.cxx      10 Jul 2007 00:44:07 -0000
@@ -581,7 +581,11 @@
     return hdg;
 }
 
-const char* FGAIBase::_getPath() {
+const char* FGAIBase::_getPath() const {
+    return model_path.c_str();
+}
+
+const char* FGAIBase::_getSMPath() const {
     return _path.c_str();
 }
 
@@ -589,10 +593,14 @@
     return _name.c_str();
 }
 
-const char* FGAIBase::_getCallsign() {
+const char* FGAIBase::getCallSign() const {
     return _callsign.c_str();
 }
 
+void FGAIBase::setCallSign(const string& s) {
+    _callsign = s;
+}
+
 const char* FGAIBase::_getSubmodel() {
     return _submodel.c_str();
 }
Index: src/AIModel/AIBase.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIBase.hxx,v
retrieving revision 1.65
diff -u -r1.65 AIBase.hxx
--- src/AIModel/AIBase.hxx      24 Jun 2007 07:57:45 -0000      1.65
+++ src/AIModel/AIBase.hxx      10 Jul 2007 00:44:07 -0000
@@ -225,8 +225,10 @@
 
     SGPropertyNode* _getProps() const;
 
-    const char* _getPath();
-    const char* _getCallsign();
+    const char* _getPath() const;
+    const char* _getSMPath() const;
+    const char* getCallSign() const;
+    void setCallSign(const string&);
     const char* _getTriggerNode();
     const char* _getName();
     const char* _getSubmodel();
Index: src/AIModel/AIMultiplayer.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIMultiplayer.cxx,v
retrieving revision 1.17
diff -u -r1.17 AIMultiplayer.cxx
--- src/AIModel/AIMultiplayer.cxx       28 Jan 2007 11:40:56 -0000      1.17
+++ src/AIModel/AIMultiplayer.cxx       10 Jul 2007 00:44:07 -0000
@@ -48,7 +48,7 @@
     isTanker = false; // do this until this property is
                       // passed over the net
 
-    string str1 = mCallSign;
+    string str1 = getCallSign();
     string str2 = "MOBIL";
 
     string::size_type loc1= str1.find( str2, 0 );
Index: src/AIModel/AIMultiplayer.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIMultiplayer.hxx,v
retrieving revision 1.7
diff -u -r1.7 AIMultiplayer.hxx
--- src/AIModel/AIMultiplayer.hxx       13 Jan 2007 16:04:28 -0000      1.7
+++ src/AIModel/AIMultiplayer.hxx       10 Jul 2007 00:44:08 -0000
@@ -40,11 +40,6 @@
   void addMotionInfo(const FGExternalMotionData& motionInfo, long stamp);
   void setDoubleProperty(const std::string& prop, double val);
 
-  void setCallSign(const string& callSign)
-  { mCallSign = callSign; }
-  const char* getCallSign(void) const
-  { return mCallSign.c_str(); }
-
   long getLastTimestamp(void) const
   { return mLastTimestamp; }
 
@@ -77,8 +72,6 @@
   typedef std::map<unsigned, SGSharedPtr<SGPropertyNode> > PropertyMap;
   PropertyMap mPropertyMap;
 
-  std::string mCallSign;
-
   double mTimeOffset;
   bool mTimeOffsetSet;
 
Index: src/AIModel/submodel.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/submodel.cxx,v
retrieving revision 1.18
diff -u -r1.18 submodel.cxx
--- src/AIModel/submodel.cxx    24 Jun 2007 07:57:45 -0000      1.18
+++ src/AIModel/submodel.cxx    10 Jul 2007 00:44:09 -0000
@@ -517,7 +517,7 @@
     sm_list_iterator end = sm_list.end();
 
     while (sm_list_itr != end) {
-        string path = (*sm_list_itr)->_getPath();
+        string path = (*sm_list_itr)->_getSMPath();
 
         if (path.empty()) {
             ++sm_list_itr;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to