X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIShip.cxx;h=41f09550e010caa143ee71695889c81e17ace689;hb=ae50c054a9007b98f1a8dafe6d589d0b4cab8873;hp=8fbb4beb5e75fedd9b56cc68c6430282fdf66afc;hpb=d096455b7fa93f3731016426ccfcfc695d79df58;p=flightgear.git diff --git a/src/AIModel/AIShip.cxx b/src/AIModel/AIShip.cxx index 8fbb4beb5..41f09550e 100644 --- a/src/AIModel/AIShip.cxx +++ b/src/AIModel/AIShip.cxx @@ -43,7 +43,7 @@ FGAIShip::FGAIShip(object_type ot) : FGAIBase(ot), -_limit(40), +_limit(100), _elevation_m(0), _elevation_ft(0), _tow_angle(0), @@ -52,6 +52,7 @@ _next_run(0), _lead_angle(0), _xtrack_error(0), _tunnel(false), +_initial_tunnel(false), _curr_alt(0), _prev_alt(0), _until_time(""), @@ -200,6 +201,8 @@ void FGAIShip::bind() { SGRawValuePointer(&_fixed_turn_radius)); props->tie("controls/restart", SGRawValuePointer(&_restart)); + props->tie("velocities/speed-kts", + SGRawValuePointer(&speed)); } void FGAIShip::unbind() { @@ -236,6 +239,7 @@ void FGAIShip::unbind() { props->untie("controls/fixed-turn-radius-ft"); props->untie("controls/constants/speed"); props->untie("controls/restart"); + props->untie("velocities/speed-kts"); } void FGAIShip::update(double dt) { @@ -309,8 +313,7 @@ void FGAIShip::Run(double dt) { } // do not allow unreasonable speeds - if (speed > _limit) - speed = _limit; + SG_CLAMP_RANGE(speed, -_limit * 0.75, _limit); // convert speed to degrees per second speed_north_deg_sec = cos(hdg / SGD_RADIANS_TO_DEGREES) @@ -337,7 +340,7 @@ void FGAIShip::Run(double dt) { //we assume that at slow speed ships will manoeuvre using engines/bow thruster - if(type == "ship" || type == "carrier"){ + if(type == "ship" || type == "carrier" || type == "escort"){ if (fabs(speed)<=5) _sp_turn_radius_ft = _fixed_turn_radius; @@ -418,7 +421,7 @@ void FGAIShip::Run(double dt) { } // set the _rudder limit by speed - if (type == "ship" || type == "carrier"){ + if (type == "ship" || type == "carrier" || type == "escort"){ if (speed <= 40) rudder_limit = (-0.825 * speed) + 35;