X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIThermal.hxx;h=1f37acdf0ff4a5c74d142db91fe91c83fef61c93;hb=afcdbd3158503773644aa07dd86cd92d67946bd4;hp=c4eb171d12c1c2fcfa8583ca91279e572faa615e;hpb=ed4509d8b5ad725a19b91bcfb841c56c2aa9de61;p=flightgear.git diff --git a/src/AIModel/AIThermal.hxx b/src/AIModel/AIThermal.hxx index c4eb171d1..1f37acdf0 100644 --- a/src/AIModel/AIThermal.hxx +++ b/src/AIModel/AIThermal.hxx @@ -1,8 +1,10 @@ -// FGAIThermal - AIBase derived class creates an AI thunderstorm +// FGAIThermal - FGAIBase-derived class creates an AI thermal // -// Written by David Culp, started Feb 2004. +// Original by Written by David Culp // -// Copyright (C) 2004 David P. Culp - davidculp2@comcast.net +// An attempt to refine the thermal shape and behaviour by WooT 2009 +// +// Copyright (C) 2009 Patrice Poly ( WooT ) // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -16,7 +18,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef _FG_AIThermal_HXX #define _FG_AIThermal_HXX @@ -25,37 +27,67 @@ #include "AIBase.hxx" #include -SG_USING_STD(string); +using std::string; class FGAIThermal : public FGAIBase { public: - - FGAIThermal(FGAIManager* mgr); + FGAIThermal(); ~FGAIThermal(); - - bool init(); - virtual void bind(); - virtual void unbind(); - void update(double dt); - - inline void setStrength( double s ) { strength = s; }; - inline void setDiameter( double d ) { diameter = d; }; - -protected: - static FGAIThermal *_self; - -private: - double dt; - void Run(double dt); - SGPropertyNode* wind_from_down; - double strength; - double diameter; - double scaler; -}; + void readFromScenario(SGPropertyNode* scFileNode); + + virtual bool init(bool search_in_AI_path=false); + virtual void bind(); + virtual void update(double dt); + inline void setMaxStrength( double s ) { max_strength = s; }; + inline void setDiameter( double d ) { diameter = d; }; + inline void setHeight( double h ) { height = h; }; + inline void setMaxUpdraft( double lift ) { v_up_max = lift; }; + inline void setMinUpdraft( double sink ) { v_up_min = sink; }; + inline void setR_up_frac( double r ) { r_up_frac = r; }; + inline double getStrength() const { return strength; }; + inline double getDiameter() const { return diameter; }; + inline double getHeight() const { return height; }; + inline double getV_up_max() const { return v_up_max; }; + inline double getV_up_min() const { return v_up_min; }; + inline double getR_up_frac() const { return r_up_frac; }; + + virtual const char* getTypeString(void) const { return "thermal"; } + void getGroundElev(double dt); + +private: + void Run(double dt); + double get_strength_fac(double alt_frac); + double max_strength; + double strength; + double diameter; + double height; + double factor; + double alt_rel; + double alt; + double v_up_max; + double v_up_min; + double r_up_frac; + double cycle_timer; + double dt_count; + double time; + double xx; + double ground_elev_ft; // ground level in ft + double altitude_agl_ft; // altitude above ground in feet + bool do_agl_calc; + bool is_forming; + bool is_formed; + bool is_dying; + bool is_dead; + SGPropertyNode_ptr _surface_wind_from_deg_node; + SGPropertyNode_ptr _surface_wind_speed_node; + SGPropertyNode_ptr _aloft_wind_from_deg_node; + SGPropertyNode_ptr _aloft_wind_speed_node; + +}; #endif // _FG_AIThermal_HXX