]> git.mxchange.org Git - flightgear.git/commitdiff
Merge branch 'next' of D:\Git_New\flightgear into next
authorVivian Meazza <vivian.meazza@lineone.net>
Sat, 28 Aug 2010 23:08:50 +0000 (00:08 +0100)
committerVivian Meazza <vivian.meazza@lineone.net>
Sat, 28 Aug 2010 23:08:50 +0000 (00:08 +0100)
Conflicts:
src/AIModel/AIBallistic.cxx

1  2 
src/AIModel/AIBallistic.cxx
src/AIModel/AIBallistic.hxx
src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/AIModel/AIManager.cxx
src/AIModel/AIWingman.cxx
src/AIModel/submodel.cxx
src/AIModel/submodel.hxx
src/Environment/environment_mgr.cxx

index 5f67d88e4c04b2507b21ca4fb41470f598188736,42e3f22c5f2e58c7560ef845c4fd85057213357b..0306c3ec5b39a1833204ea9752f742d844bef86f
@@@ -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() {
index 6ce9c13d80450f0877928433591ab68453b8dbd0,09efbd6e12cfccf5e2b1fd9f37fb1c3cc293222a..c9613de899132a1190a8e206501b93ba1056ea14
@@@ -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.
  
index ac8c4fb57980ada62fe1492170ba0d5b44547b7e,d143296a18f04b8f931701721924fb4bf5634fd8..517b91b1d31732f47063bd22f19c389b9201242b
@@@ -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);
  }
  
index 20bca1d9c85f3f9dc6bf1293213b5fd0522a70cb,e47f778d0ce20426816b5eecaf75fabb87fa4a62..4c2c591af19594e9457c14e5e0dbc660de6542b7
@@@ -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
index 1c83ca4796f7c28f7a1cd2d1934e47c8bc02db83,315920ab5ce15cb58a8b3a565fcb438d4562cc82..4255709ab285b139ffc4a73fc7dca7b5d1fd6252
@@@ -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
index 0ed84e85ac91aff88d3033a1c89a158be4a9fabb,4a081ee116e64b9af26e97d1945da4a10dd886a1..39c20bbc6aaa49f2e1ca6acd1c8218e326e13455
@@@ -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
index 7f9f80c02f0271d96b3c95d85663395bc5b49305,0958923c1bae9af9dc89a31a24109dcc0f03aa9f..471b45dd1307b165800817c94412e7ec8a37fb2a
@@@ -819,106 -789,5 +819,106 @@@ void FGSubmodelMgr::setOffsetPos()
      SGVec3d cartoffsetPos = getCartOffsetPos();
  
      SGGeodesy::SGCartToGeod(cartoffsetPos, offsetpos);
-     }// end for loop
 +
 +    //cout << "OFFSET POS" << offsetpos.getElevationFt();
 +
 +}
 +
 +void FGSubmodelMgr::valueChanged(SGPropertyNode *prop)
 +{
 +//    cout << "LISTENER: " << endl;
 +
 +    const char* _model_added = _model_added_node->getStringValue();
 +
 +    basic_string <char>::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 
 +
 +    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
index e6c9f9e1f58b53b7800dd7ddd8cacdaba8f885dc,cd645f64e66d4e9333b4518123b06f821eefea24..2abff45ce9ab621ecf76263a15262c04ce50ac84
@@@ -20,7 -20,7 +20,7 @@@
  #include <Main/fg_props.hxx>
  
  using std::vector;
--using std::string;
++using std::string; 
  using std::list;
  
  class FGAIBase;
Simple merge