Remove debugging statement.
Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
parent
b22960ffff
commit
f08012d14f
8 changed files with 85 additions and 70 deletions
|
@ -157,6 +157,7 @@ bool FGAIBallistic::init(bool search_in_AI_path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setParentNodes(_selected_ac);
|
setParentNodes(_selected_ac);
|
||||||
|
|
||||||
//props->setStringValue("vector/path", _vector_path.c_str());
|
//props->setStringValue("vector/path", _vector_path.c_str());
|
||||||
|
|
||||||
// start with high value so that animations don't trigger yet
|
// start with high value so that animations don't trigger yet
|
||||||
|
|
|
@ -533,8 +533,13 @@ void FGAIBase::_setSubID( int s ) {
|
||||||
_subID = s;
|
_subID = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAIBase::setParentNode() {
|
bool FGAIBase::setParentNode() {
|
||||||
// cout << "AIBase: setParentNode " << _parent << endl;
|
|
||||||
|
if (_parent == ""){
|
||||||
|
SG_LOG(SG_GENERAL, SG_ALERT, "AIBase: " << _name
|
||||||
|
<< " parent not set ");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true);
|
const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true);
|
||||||
|
|
||||||
|
@ -564,15 +569,16 @@ void FGAIBase::setParentNode() {
|
||||||
|
|
||||||
if (_selected_ac != 0){
|
if (_selected_ac != 0){
|
||||||
const string name = _selected_ac->getStringValue("name");
|
const string name = _selected_ac->getStringValue("name");
|
||||||
//setParent();
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "AIEscort: " << _name
|
SG_LOG(SG_GENERAL, SG_ALERT, "AIBase: " << _name
|
||||||
<< " parent not found: dying ");
|
<< " parent not found: dying ");
|
||||||
setDie(true);
|
setDie(true);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double FGAIBase::_getLongitude() const {
|
double FGAIBase::_getLongitude() const {
|
||||||
return pos.getLongitudeDeg();
|
return pos.getLongitudeDeg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
void setImpactLon( double lon );
|
void setImpactLon( double lon );
|
||||||
void setImpactElev( double e );
|
void setImpactElev( double e );
|
||||||
void setParentName(const string& p);
|
void setParentName(const string& p);
|
||||||
void setParentNode();
|
bool setParentNode();
|
||||||
|
|
||||||
int getID() const;
|
int getID() const;
|
||||||
int _getSubID() const;
|
int _getSubID() const;
|
||||||
|
|
|
@ -140,12 +140,13 @@ bool FGAIEscort::init(bool search_in_AI_path) {
|
||||||
no_roll = false;
|
no_roll = false;
|
||||||
|
|
||||||
props->setStringValue("controls/parent-name", _parent.c_str());
|
props->setStringValue("controls/parent-name", _parent.c_str());
|
||||||
setParentNode();
|
|
||||||
setParent();
|
|
||||||
|
|
||||||
pos = _tgtpos;
|
if (setParentNode()){
|
||||||
speed = _parent_speed;
|
setParent();
|
||||||
hdg = _parent_hdg;
|
pos = _tgtpos;
|
||||||
|
speed = _parent_speed;
|
||||||
|
hdg = _parent_hdg;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,4 +102,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FG_AIGROUNDVEHICLE_HXX
|
#endif // FG_AIGROUNDVEHICLE_HXX
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ FGAIShip(otGroundVehicle),
|
||||||
_pitch(0),
|
_pitch(0),
|
||||||
_pitch_deg(0),
|
_pitch_deg(0),
|
||||||
_speed_kt(0),
|
_speed_kt(0),
|
||||||
_selected_ac(0),
|
|
||||||
_range_ft(0),
|
_range_ft(0),
|
||||||
_relbrg (0),
|
_relbrg (0),
|
||||||
_parent_speed(0),
|
_parent_speed(0),
|
||||||
|
@ -50,6 +49,7 @@ _break_count(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
invisible = false;
|
invisible = false;
|
||||||
|
_parent = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
FGAIGroundVehicle::~FGAIGroundVehicle() {}
|
FGAIGroundVehicle::~FGAIGroundVehicle() {}
|
||||||
|
@ -149,7 +149,19 @@ bool FGAIGroundVehicle::init(bool search_in_AI_path) {
|
||||||
no_roll = true;
|
no_roll = true;
|
||||||
|
|
||||||
props->setStringValue("controls/parent-name", _parent.c_str());
|
props->setStringValue("controls/parent-name", _parent.c_str());
|
||||||
setParentNode();
|
|
||||||
|
if (setParentNode()){
|
||||||
|
_parent_x_offset = _selected_ac->getDoubleValue("hitch/x-offset-ft");
|
||||||
|
_parent_y_offset = _selected_ac->getDoubleValue("hitch/y-offset-ft");
|
||||||
|
_parent_z_offset = _selected_ac->getDoubleValue("hitch/z-offset-ft");
|
||||||
|
_hitch_x_offset_m = _selected_ac->getDoubleValue("hitch/x-offset-ft")
|
||||||
|
* SG_FEET_TO_METER;
|
||||||
|
_hitch_y_offset_m = _selected_ac->getDoubleValue("hitch/y-offset-ft")
|
||||||
|
* SG_FEET_TO_METER;
|
||||||
|
_hitch_z_offset_m = _selected_ac->getDoubleValue("hitch/z-offset-ft")
|
||||||
|
* SG_FEET_TO_METER;
|
||||||
|
setParent();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -344,56 +356,56 @@ bool FGAIGroundVehicle::getPitch() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAIGroundVehicle::setParentNode() {
|
//void FGAIGroundVehicle::setParentNode() {
|
||||||
|
//
|
||||||
if(_parent == "")
|
// if(_parent == "")
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true);
|
// const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true);
|
||||||
|
//
|
||||||
for (int i = ai->nChildren() - 1; i >= -1; i--) {
|
// for (int i = ai->nChildren() - 1; i >= -1; i--) {
|
||||||
SGPropertyNode_ptr model;
|
// SGPropertyNode_ptr model;
|
||||||
|
//
|
||||||
if (i < 0) { // last iteration: selected model
|
// if (i < 0) { // last iteration: selected model
|
||||||
model = _selected_ac;
|
// model = _selected_ac;
|
||||||
} else {
|
// } else {
|
||||||
model = ai->getChild(i);
|
// model = ai->getChild(i);
|
||||||
string path = ai->getPath();
|
// string path = ai->getPath();
|
||||||
const string name = model->getStringValue("name");
|
// const string name = model->getStringValue("name");
|
||||||
|
//
|
||||||
if (!model->nChildren()){
|
// if (!model->nChildren()){
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
if (name == _parent) {
|
// if (name == _parent) {
|
||||||
_selected_ac = model; // save selected model for last iteration
|
// _selected_ac = model; // save selected model for last iteration
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
if (!model)
|
// if (!model)
|
||||||
continue;
|
// continue;
|
||||||
|
//
|
||||||
}// end for loop
|
// }// end for loop
|
||||||
|
//
|
||||||
if (_selected_ac != 0){
|
// if (_selected_ac != 0){
|
||||||
const string name = _selected_ac->getStringValue("name");
|
// const string name = _selected_ac->getStringValue("name");
|
||||||
_parent_x_offset = _selected_ac->getDoubleValue("hitch/x-offset-ft");
|
// //_parent_x_offset = _selected_ac->getDoubleValue("hitch/x-offset-ft");
|
||||||
_parent_y_offset = _selected_ac->getDoubleValue("hitch/y-offset-ft");
|
// //_parent_y_offset = _selected_ac->getDoubleValue("hitch/y-offset-ft");
|
||||||
_parent_z_offset = _selected_ac->getDoubleValue("hitch/z-offset-ft");
|
// //_parent_z_offset = _selected_ac->getDoubleValue("hitch/z-offset-ft");
|
||||||
_hitch_x_offset_m = _selected_ac->getDoubleValue("hitch/x-offset-ft")
|
// //_hitch_x_offset_m = _selected_ac->getDoubleValue("hitch/x-offset-ft")
|
||||||
* SG_FEET_TO_METER;
|
// // * SG_FEET_TO_METER;
|
||||||
_hitch_y_offset_m = _selected_ac->getDoubleValue("hitch/y-offset-ft")
|
// //_hitch_y_offset_m = _selected_ac->getDoubleValue("hitch/y-offset-ft")
|
||||||
* SG_FEET_TO_METER;
|
// // * SG_FEET_TO_METER;
|
||||||
_hitch_z_offset_m = _selected_ac->getDoubleValue("hitch/z-offset-ft")
|
// //_hitch_z_offset_m = _selected_ac->getDoubleValue("hitch/z-offset-ft")
|
||||||
* SG_FEET_TO_METER;
|
// // * SG_FEET_TO_METER;
|
||||||
setParent();
|
// //setParent();
|
||||||
} else {
|
// } else {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "AIGroundVeh1cle: " << _name
|
// SG_LOG(SG_GENERAL, SG_ALERT, "AIGroundVeh1cle: " << _name
|
||||||
<< " parent not found: dying ");
|
// << " parent not found: dying ");
|
||||||
setDie(true);
|
// setDie(true);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
||||||
void FGAIGroundVehicle::setParent(){
|
void FGAIGroundVehicle::setParent(){
|
||||||
|
|
||||||
|
|
|
@ -62,10 +62,8 @@ private:
|
||||||
void setElevation(double _elevation, double dt, double _elevation_coeff);
|
void setElevation(double _elevation, double dt, double _elevation_coeff);
|
||||||
void setPitch(double _pitch, double dt, double _pitch_coeff);
|
void setPitch(double _pitch, double dt, double _pitch_coeff);
|
||||||
void setTowAngle(double _relbrg, double dt, double _towangle_coeff);
|
void setTowAngle(double _relbrg, double dt, double _towangle_coeff);
|
||||||
// void setParentName(const string& p);
|
|
||||||
void setTrainSpeed(double s, double dt, double coeff);
|
void setTrainSpeed(double s, double dt, double coeff);
|
||||||
void setParent();
|
void setParent();
|
||||||
void setParentNode();
|
|
||||||
void AdvanceFP();
|
void AdvanceFP();
|
||||||
void setTowSpeed();
|
void setTowSpeed();
|
||||||
void RunGroundVehicle(double dt);
|
void RunGroundVehicle(double dt);
|
||||||
|
@ -98,9 +96,6 @@ private:
|
||||||
double _dt_count, _next_run, _break_count;
|
double _dt_count, _next_run, _break_count;
|
||||||
|
|
||||||
const SGMaterial* _material;
|
const SGMaterial* _material;
|
||||||
SGPropertyNode_ptr _selected_ac;
|
|
||||||
|
|
||||||
// string _parent;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@ _range_rate(0),
|
||||||
_roll_constant(0.001),
|
_roll_constant(0.001),
|
||||||
_hdg_constant(0.01),
|
_hdg_constant(0.01),
|
||||||
_roll_factor(-0.0083335),
|
_roll_factor(-0.0083335),
|
||||||
_restart(false)
|
_restart(false),
|
||||||
|
_name("")
|
||||||
|
|
||||||
{
|
{
|
||||||
invisible = false;
|
invisible = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue