Vassilii Khachaturov <[EMAIL PROTECTED]> writes:

>>  http://caliban.lbl.gov/fgfs_patches/flightgear.diff
>
> Great work. I wonder if there is a way to profile fg/sg for this kind
> of inefficiencies somewhere in a tight loop.
>
> A couple of comments:
>
> diff -u -r1.43 AIBase.hxx
> --- src/AIModel/AIBase.hxx    15 Oct 2005 14:55:51 -0000      1.43
> +++ src/AIModel/AIBase.hxx    25 Oct 2005 06:59:49 -0000
> @@ -108,7 +108,7 @@
>      FGAIBase();
>      virtual ~FGAIBase();
>      virtual void update(double dt);
> -    inline Point3D GetPos() { return(pos); }
> +    inline const Point3D& GetPos() { return(pos); }
>
>      enum object_type { otNull = 0, otAircraft, otShip, otCarrier, 
> otBallistic,
>                         otRocket, otStorm, otThermal, otStatic,
>
>
> If you return the pos as a const Point3D&, you should
> probably mark the method to be const as well on the same occasion.

this change is okay. i am not sure what you mean by "marking the
method to be const" but if it's this:

  inline const Point3D& GetPos() const

that would mean it acts on a const object which is what we want anyway
(but not necessarily). so can we apply this patch as well:

Index: src/AIModel/AIBase.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/AIModel/AIBase.hxx,v
retrieving revision 1.43
diff -u -r1.43 AIBase.hxx
--- src/AIModel/AIBase.hxx      15 Oct 2005 14:55:51 -0000      1.43
+++ src/AIModel/AIBase.hxx      25 Oct 2005 17:15:33 -0000
@@ -108,7 +108,7 @@
     FGAIBase();
     virtual ~FGAIBase();
     virtual void update(double dt);
-    inline Point3D GetPos() { return(pos); }
+    inline const Point3D& GetPos() const { return(pos); }
 
     enum object_type { otNull = 0, otAircraft, otShip, otCarrier, otBallistic,
                        otRocket, otStorm, otThermal, otStatic,

thanks.

btw, there are still some more cleanups i would like to do so get
ready for a second round (provided i manage to find some time soon).

--alex--

-- 
| I believe the moment is at hand when, by a paranoiac and active |
|  advance of the mind, it will be possible (simultaneously with  |
|  automatism and other passive states) to systematize confusion  |
|  and thus to help to discredit completely the world of reality. |

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to