]> git.mxchange.org Git - flightgear.git/commitdiff
#221, #242: Fix/work-around for AI traffic issues
authorThorstenB <brehmt@gmail.com>
Sat, 25 Jun 2011 18:44:44 +0000 (20:44 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 25 Jun 2011 18:44:44 +0000 (20:44 +0200)
Move the disable-HOT feature from the MP aircraft to the a/c base class,
disable HOT for all AIaircraft, since that's a fix/work-around for
#242: AI aircraft respect the user a/c only when HOT is _disabled_ for them
#221: AI aircraft don't stack at parking positions when HOT is disabled
Also generally disables HOT for ballistic and other models (suggested by vivian),
allowing it for ship/carrier models only.

src/AIModel/AIAircraft.cxx
src/AIModel/AIBallistic.cxx
src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/AIModel/AIMultiplayer.cxx
src/AIModel/AIShip.cxx
src/AIModel/AIStatic.cxx
src/AIModel/AIStorm.cxx
src/AIModel/AIThermal.cxx

index d0e3197052a77fe3e332f6be6fa0cc6042e27157..1c904b79b482123ac9a39e20eddbd042abd11caf 100644 (file)
@@ -52,11 +52,15 @@ using std::string;
 
 static string tempReg;
 
-FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : FGAIBase(otAircraft) {
+FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :
+     /* HOT must be disabled for AI Aircraft,
+      * otherwise traffic detection isn't working as expected.*/
+     FGAIBase(otAircraft, false) 
+{
     trafficRef = ref;
     if (trafficRef) {
         groundOffset = trafficRef->getGroundOffset();
-       setCallSign(trafficRef->getCallSign());
+        setCallSign(trafficRef->getCallSign());
     }
     else
         groundOffset = 0;
index 69e090e3d16ae6cd19c1b118c247fef9873b9831..74b882821af31aee60dbc13797ed42fdd4615056 100644 (file)
@@ -40,7 +40,7 @@ const double FGAIBallistic::slugs_to_kgs = 14.5939029372;
 const double FGAIBallistic::slugs_to_lbs = 32.1740485564;
 
 FGAIBallistic::FGAIBallistic(object_type ot) :
-FGAIBase(ot),
+FGAIBase(ot, false),
 _height(0.0),
 _speed(0),
 _ht_agl_ft(0.0),
index 33cb073cbd5a3b30c5480fe7d88f8dd5c9e4265c..ac907c2e383e5263546dfa30df4f62493e9a3a54 100644 (file)
@@ -52,7 +52,7 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172;   //conversion factor
 
 using namespace simgear;
 
-FGAIBase::FGAIBase(object_type ot) :
+FGAIBase::FGAIBase(object_type ot, bool enableHot) :
     _max_speed(300),
     _name(""),
     _parent(""),
@@ -121,6 +121,10 @@ FGAIBase::FGAIBase(object_type ot) :
     p = 1e5;
     a = 340;
     Mach = 0;
+
+    // explicitly disable HOT for (most) AI models
+    if (!enableHot)
+        aip.getSceneGraph()->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
 }
 
 FGAIBase::~FGAIBase() {
index 2f83623310c89f178ba42ff517f65920fcd7fd5b..61351adbbdc2f1f33b42c3f8d82da254b85fcc81 100644 (file)
@@ -52,7 +52,7 @@ public:
         otEscort, otMultiplayer,
         MAX_OBJECTS }; // Needs to be last!!!
 
-    FGAIBase(object_type ot);
+    FGAIBase(object_type ot, bool enableHot);
     virtual ~FGAIBase();
 
     virtual void readFromScenario(SGPropertyNode* scFileNode);
index a9635c5f7b5541902035b8ee508cd6fbda54f294..08f5afb400f907561cb055ebab574d4ab9a742eb 100644 (file)
 
 #include "AIMultiplayer.hxx"
 
-#include <simgear/scene/util/SGNodeMasks.hxx>
 
 // #define SG_DEBUG SG_ALERT
 
-FGAIMultiplayer::FGAIMultiplayer() : FGAIBase(otMultiplayer) {
+FGAIMultiplayer::FGAIMultiplayer() :
+   FGAIBase(otMultiplayer, false)
+{
    no_roll = false;
 
    mTimeOffsetSet = false;
    mAllowExtrapolation = true;
    mLagAdjustSystemSpeed = 10;
    mLastTimestamp = 0;
-   aip.getSceneGraph()->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
    lastUpdateTime = 0;
 
 } 
index 9b6a0470524e8fc2b017bc4fd3a412875a91abe0..b5df3d145c69a66f15025ac3bd6fad304dc3ced5 100644 (file)
@@ -42,7 +42,8 @@
 
 
 FGAIShip::FGAIShip(object_type ot) :
-FGAIBase(ot),
+// allow HOT to be enabled
+FGAIBase(ot, true),
 
 
 _waiting(false),
index 83be7c8d60ded55d3d1e58ed90907dd261dcc927..5ac1f4ce3aa2a78e007eb4208e9250050a315640 100644 (file)
@@ -33,7 +33,7 @@ using std::string;
 #include "AIStatic.hxx"
 
 
-FGAIStatic::FGAIStatic() : FGAIBase(otStatic) {
+FGAIStatic::FGAIStatic() : FGAIBase(otStatic, false) {
 }
 
 
index fded8012d9ef85e4ed623c4bd0adb2cda146d860..a4241df465c2f3e17399dae1a0c687f3c5589a04 100644 (file)
@@ -35,7 +35,9 @@ using std::string;
 #include "AIStorm.hxx"
 
 
-FGAIStorm::FGAIStorm() : FGAIBase(otStorm) {
+FGAIStorm::FGAIStorm() :
+   FGAIBase(otStorm, false)
+{
    delay = 3.6;
    subflashes = 1;
    timer = 0.0;
index 172d1e68aff1d55f23e334f60035ac52b8ba41bf..f47ba23569142a6c379daf0a47e55a8bad008e26 100644 (file)
@@ -35,7 +35,9 @@ using std::string;
 #include "AIThermal.hxx"
 
 
-FGAIThermal::FGAIThermal() : FGAIBase(otThermal) {
+FGAIThermal::FGAIThermal() :
+   FGAIBase(otThermal, false)
+{
    max_strength = 6.0;
    diameter = 0.5;
    strength = factor = 0.0;