From: Vivian Meazza Date: Sat, 28 Aug 2010 23:08:50 +0000 (+0100) Subject: Merge branch 'next' of D:\Git_New\flightgear into next X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9e44be1df7d01515c1dc4a2cda9e340d00c4b887;p=flightgear.git Merge branch 'next' of D:\Git_New\flightgear into next Conflicts: src/AIModel/AIBallistic.cxx --- 9e44be1df7d01515c1dc4a2cda9e340d00c4b887 diff --cc src/AIModel/AIBallistic.cxx index 5f67d88e4,42e3f22c5..0306c3ec5 --- a/src/AIModel/AIBallistic.cxx +++ b/src/AIModel/AIBallistic.cxx @@@ -940,7 -855,7 +940,7 @@@ void FGAIBallistic::handle_impact() invisible = true; } else if (_subID == 0) // kill the AIObject if there is no subsubmodel setDie(true); -- } ++ } } void FGAIBallistic::handle_expiry() { diff --cc src/AIModel/AIBallistic.hxx index 6ce9c13d8,09efbd6e1..c9613de89 --- a/src/AIModel/AIBallistic.hxx +++ b/src/AIModel/AIBallistic.hxx @@@ -15,7 -15,7 +15,7 @@@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // --// You should have received a copy of the GNU General Public License ++// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --cc src/AIModel/AIBase.cxx index ac8c4fb57,d143296a1..517b91b1d --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@@ -236,7 -234,7 +236,7 @@@ void FGAIBase::initModel(osg::Node *nod SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path); } - //props->setStringValue("submodels/path", _path.c_str()); - props->setStringValue("submodels/path", _path.c_str()); ++ //props->setStringValue("submodels/path", _path.c_str()); setDie(false); } diff --cc src/AIModel/AIBase.hxx index 20bca1d9c,e47f778d0..4c2c591af --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@@ -1,7 -1,7 +1,7 @@@ // FGAIBase.hxx - abstract base class for AI objects // Written by David Culp, started Nov 2003, based on // David Luff's FGAIEntity class. --// - davidculp2@comcast.net ++// - davidculp2@comcast.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as diff --cc src/AIModel/AIManager.cxx index 1c83ca479,315920ab5..4255709ab --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@@ -2,7 -2,7 +2,7 @@@ // - a global management type for AI objects // // Written by David Culp, started October 2003. --// - davidculp2@comcast.net ++// - davidculp2@comcast.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as diff --cc src/AIModel/AIWingman.cxx index 0ed84e85a,4a081ee11..39c20bbc6 --- a/src/AIModel/AIWingman.cxx +++ b/src/AIModel/AIWingman.cxx @@@ -1,7 -1,7 +1,7 @@@ // FGAIWingman - FGAIBllistic-derived class creates an AI Wingman // // Written by Vivian Meazza, started February 2008. --// - vivian.meazza at lineone.net ++// - vivian.meazza at lineone.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as diff --cc src/AIModel/submodel.cxx index 7f9f80c02,0958923c1..471b45dd1 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@@ -819,106 -789,5 +819,106 @@@ void FGSubmodelMgr::setOffsetPos() SGVec3d cartoffsetPos = getCartOffsetPos(); SGGeodesy::SGCartToGeod(cartoffsetPos, offsetpos); + + //cout << "OFFSET POS" << offsetpos.getElevationFt(); + +} + +void FGSubmodelMgr::valueChanged(SGPropertyNode *prop) +{ +// cout << "LISTENER: " << endl; + + const char* _model_added = _model_added_node->getStringValue(); + + basic_string ::size_type indexCh2b; + + string str2 = _model_added; + const char *cstr2b = "ballistic"; + indexCh2b = str2.find( cstr2b, 0 ); + +// cout << "model added - " << str2 <<" now do something "<< endl; + + if (indexCh2b != string::npos ){ // we will ignore Ballistic Objects - there are potentially too many + return; + } else { + + SGPropertyNode *a_node = fgGetNode(_model_added, true ); + SGPropertyNode *sub_node = a_node->getChild("submodels", 0, true); + SGPropertyNode_ptr path_node = sub_node->getChild("path", 0, true); + + string path = path_node->getStringValue(); + + if (path.empty()){ + // nothing to do - return + //cout << "subpath empty - return" << endl << endl; + return; + } else { + //cout << "subpath found - loading" << endl << endl; + SGPropertyNode_ptr ident_node = a_node->getChild("id", 0, true); + int id = ident_node->getIntValue(); + + setData(id, path, true); + + _found_sub = true; + + while (_found_sub) + loadSubmodels(); + + } + + } + +} + +void FGSubmodelMgr::setParentNode(int id) { + + const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true); + + for (int i = ai->nChildren() - 1; i >= -1; i--) { + SGPropertyNode_ptr model; + + if (i < 0) { // last iteration: selected model + model = _selected_ac; + } else { + model = ai->getChild(i); + string path = ai->getPath(); + const string name = model->getStringValue("name"); + int parent_id = model->getIntValue("id"); + if (!model->nChildren()){ + continue; + } + if (parent_id == id) { + _selected_ac = model; // save selected model for last iteration + break; + } + + } + if (!model) + continue; + - }// end for loop ++ }// end for loop + + if (_selected_ac != 0){ + + //cout << " parent node found"<< endl; + + const string name = _selected_ac->getStringValue("name"); + IC.lat = _selected_ac->getDoubleValue("position/latitude-deg"); + IC.lon = _selected_ac->getDoubleValue("position/longitude-deg"); + IC.alt = _selected_ac->getDoubleValue("position/altitude-ft"); + IC.roll = _selected_ac->getDoubleValue("orientation/roll-deg"); + IC.elevation = _selected_ac->getDoubleValue("orientation/pitch-deg"); + IC.azimuth = _selected_ac->getDoubleValue("orientation/true-heading-deg"); + IC.speed = _selected_ac->getDoubleValue("velocities/true-airspeed-kt") * SG_KT_TO_FPS; + IC.speed_down_fps = -_selected_ac->getDoubleValue("velocities/vertical-speed-fps"); + IC.speed_east_fps = _selected_ac->getDoubleValue("velocities/speed-east-fps"); + IC.speed_north_fps = _selected_ac->getDoubleValue("velocities/speed-north-fps"); + + //cout << name << " IC.speed " << IC.speed << endl; + + } else { + SG_LOG(SG_GENERAL, SG_ALERT, "AISubmodel: parent node not found "); + } + } // end of submodel.cxx diff --cc src/AIModel/submodel.hxx index e6c9f9e1f,cd645f64e..2abff45ce --- a/src/AIModel/submodel.hxx +++ b/src/AIModel/submodel.hxx @@@ -20,7 -20,7 +20,7 @@@ #include
using std::vector; --using std::string; ++using std::string; using std::list; class FGAIBase;