#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
-#include <AIModel/AIBase.hxx>
+#include <simgear/math/SGMath.hxx>
+
#include <vector>
#include <string>
-#include <Main/fg_props.hxx>
-
-SG_USING_STD(vector);
-SG_USING_STD(string);
-SG_USING_STD(list);
-
class FGAIBase;
+class FGAIManager;
-class FGSubmodelMgr : public SGSubsystem
+class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener
{
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;
double drag_area;
double life;
double buoyancy;
+ 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 collision;
+ 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;
+ std::string force_path;
} submodel;
typedef struct {
double mass;
int id;
bool no_roll;
+ int parent_id;
} IC_struct;
FGSubmodelMgr();
private:
- typedef vector <submodel*> submodel_vector_type;
+ typedef std::vector <submodel*> submodel_vector_type;
typedef submodel_vector_type::iterator submodel_vector_iterator;
submodel_vector_type submodels;
float in[3];
float out[3];
- double Rx, Ry, Rz;
- double Sx, Sy, Sz;
- double Tx, Ty, Tz;
+ //double Rx, Ry, Rz;
+ //double Sx, Sy, Sz;
+ //double Tx, Ty, Tz;
float cosRx, sinRx;
float cosRy, sinRy;
double _parent_pitch;
double _parent_roll;
double _parent_speed;
+ double _parent_ID;
+
+ double _x_offset;
+ double _y_offset;
+ double _z_offset;
+
static const double lbs_to_slugs; //conversion factor
bool _impact;
bool _hit;
+ bool _expiry;
+ bool _found_sub;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _user_lat_node;
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 <SGSharedPtr<FGAIBase> > 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, std::string& path, bool serviceable);
+ void setSubData(int id, std::string& path, bool serviceable);
void valueChanged (SGPropertyNode *);
void transform(submodel *);
+ void setParentNode(int parent_id);
bool release(submodel *, double dt);
- double getRange(double lat, double lon, double lat2, double lon2) const;
int _count;
+ SGGeod userpos;
+ SGGeod offsetpos;
+ SGVec3d getCartOffsetPos() const;
+ void setOffsetPos();
+
};
#endif // __SYSTEMS_SUBMODEL_HXX