X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2Fsubmodel.hxx;h=5d01d3d761b534d88d94b3ae71fe982129f67fe3;hb=9d995907db00728da7eac9297ecbab93ed8a7400;hp=cd645f64e66d4e9333b4518123b06f821eefea24;hpb=724cdac33596fdd0bff041103815b222a8c65f17;p=flightgear.git diff --git a/src/AIModel/submodel.hxx b/src/AIModel/submodel.hxx index cd645f64e..5d01d3d76 100644 --- a/src/AIModel/submodel.hxx +++ b/src/AIModel/submodel.hxx @@ -13,19 +13,15 @@ #include #include -#include +#include + #include #include -#include
- -using std::vector; -using std::string; -using std::list; - class FGAIBase; +class FGAIManager; -class FGSubmodelMgr : public SGSubsystem +class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener { public: @@ -37,8 +33,8 @@ public: SGPropertyNode_ptr submodel_node; SGPropertyNode_ptr speed_node; - string name; - string model; + std::string name; + std::string model; double speed; bool slaved; bool repeat; @@ -53,27 +49,28 @@ public: double drag_area; double life; double buoyancy; - double randomness; + double randomness; bool wind; bool first_time; double cd; double weight; + double mass; double contents; bool aero_stabilised; int id; bool no_roll; bool serviceable; - bool random; + bool random; bool collision; - bool expiry; + bool expiry; bool impact; - string impact_report; + std::string impact_report; double fuse_range; - string submodel; + std::string submodel; int sub_id; bool force_stabilised; bool ext_force; - string force_path; + std::string force_path; } submodel; typedef struct { @@ -95,6 +92,7 @@ public: double mass; int id; bool no_roll; + int parent_id; } IC_struct; FGSubmodelMgr(); @@ -110,17 +108,13 @@ public: private: - typedef vector submodel_vector_type; + typedef std::vector submodel_vector_type; typedef submodel_vector_type::iterator submodel_vector_iterator; submodel_vector_type submodels; submodel_vector_type subsubmodels; submodel_vector_iterator submodel_iterator, subsubmodel_iterator; - float trans[3][3]; - float in[3]; - float out[3]; - //double Rx, Ry, Rz; //double Sx, Sy, Sz; //double Tx, Ty, Tz; @@ -144,7 +138,9 @@ private: double _parent_pitch; double _parent_roll; double _parent_speed; - double _x_offset; + //double _parent_ID; + + double _x_offset; double _y_offset; double _z_offset; @@ -155,8 +151,8 @@ private: bool _impact; bool _hit; - bool _expiry; - bool _found_sub; + bool _expiry; + bool _found_sub; SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _user_lat_node; @@ -178,34 +174,34 @@ private: SGPropertyNode_ptr _count_node; SGPropertyNode_ptr _trigger_node; SGPropertyNode_ptr props; + SGPropertyNode_ptr _model_added_node; + SGPropertyNode_ptr _path_node; + SGPropertyNode_ptr _selected_ac; - FGAIManager* ai; IC_struct IC; - - // A list of pointers to AI objects - typedef list > sm_list_type; - typedef sm_list_type::iterator sm_list_iterator; - typedef sm_list_type::const_iterator sm_list_const_iterator; - - sm_list_type sm_list; - - + + /** + * Helper to retrieve the AI manager, if it currently exists + */ + FGAIManager* aiManager(); + void loadAI(); void loadSubmodels(); - void setData(int id, string& path, bool serviceable); - void setSubData(int id, string& path, bool serviceable); + void setData(int id, const std::string& path, bool serviceable); + void setSubData(int id, const std::string& path, bool serviceable); void valueChanged (SGPropertyNode *); void transform(submodel *); + void setParentNode(int parent_id); bool release(submodel *, double dt); int _count; - - SGGeod userpos; - SGGeod offsetpos; - SGVec3d getCartOffsetPos() const; - void setOffsetPos(); + + SGGeod userpos; + SGGeod offsetpos; + SGVec3d getCartOffsetPos() const; + void setOffsetPos(); };