X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIEscort.cxx;h=9a816675597d88283aad6a25b43bb5b28472840c;hb=9d995907db00728da7eac9297ecbab93ed8a7400;hp=c88e9af334adf5afac1530819877a71a8c438e56;hpb=826107f132da375d18f13bc11e69233ad633ae20;p=flightgear.git diff --git a/src/AIModel/AIEscort.cxx b/src/AIModel/AIEscort.cxx index c88e9af33..9a8166755 100644 --- a/src/AIModel/AIEscort.cxx +++ b/src/AIModel/AIEscort.cxx @@ -27,12 +27,12 @@ #include #include -#include #include +#include #include #include
-#include
+#include #include @@ -91,46 +91,32 @@ void FGAIEscort::readFromScenario(SGPropertyNode* scFileNode) { void FGAIEscort::bind() { FGAIShip::bind(); - props->tie("station/rel-bearing-deg", + tie("station/rel-bearing-deg", SGRawValuePointer(&_stn_relbrg)); - props->tie("station/true-bearing-deg", + tie("station/true-bearing-deg", SGRawValuePointer(&_stn_truebrg)); - props->tie("station/range-nm", + tie("station/range-nm", SGRawValuePointer(&_stn_range)); - props->tie("station/range-limit-nm", + tie("station/range-limit-nm", SGRawValuePointer(&_stn_limit)); - props->tie("station/angle-limit-deg", + tie("station/angle-limit-deg", SGRawValuePointer(&_stn_angle_limit)); - props->tie("station/speed-kts", + tie("station/speed-kts", SGRawValuePointer(&_stn_speed)); - props->tie("station/height-ft", + tie("station/height-ft", SGRawValuePointer(&_stn_height)); - props->tie("controls/update-interval-sec", + tie("controls/update-interval-sec", SGRawValuePointer(&_interval)); - props->tie("controls/parent-mp-control", + tie("controls/parent-mp-control", SGRawValuePointer(&_MPControl)); - props->tie("station/target-range-nm", + tie("station/target-range-nm", SGRawValuePointer(&_tgtrange)); - props->tie("station/target-brg-deg-t", + tie("station/target-brg-deg-t", SGRawValuePointer(&_tgtbrg)); - props->tie("station/patrol", + tie("station/patrol", SGRawValuePointer(&_patrol)); } -void FGAIEscort::unbind() { - FGAIShip::unbind(); - - props->untie("station/rel-bearing-deg"); - props->untie("station/true-bearing-deg"); - props->untie("station/range-nm"); - props->untie("station/range-limit-nm"); - props->untie("station/angle-limit-deg"); - props->untie("station/speed-kts"); - props->untie("station/height-ft"); - props->untie("controls/update-interval-sec"); - -} - bool FGAIEscort::init(bool search_in_AI_path) { if (!FGAIShip::init(search_in_AI_path)) return false; @@ -204,13 +190,15 @@ bool FGAIEscort::getGroundElev(SGGeod inpos) { double height_m ; - if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(inpos, 3000), height_m, &_material,0)){ + const simgear::BVHMaterial* mat = 0; + if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(inpos, 3000), height_m, &mat, 0)){ + const SGMaterial* material = dynamic_cast(mat); _ht_agl_ft = inpos.getElevationFt() - height_m * SG_METER_TO_FEET; - if (_material) { - const vector& names = _material->get_names(); + if (material) { + const std::vector& names = material->get_names(); - _solid = _material->get_solid(); + _solid = material->get_solid(); if (!names.empty()) props->setStringValue("material/name", names[0].c_str());