1
0
Fork 0

, : Fix/work-around for AI traffic issues

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
: AI aircraft respect the user a/c only when HOT is _disabled_ for them
: 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.
This commit is contained in:
ThorstenB 2011-06-25 20:44:44 +02:00
parent 029d2b00eb
commit c19664291f
9 changed files with 25 additions and 12 deletions

View file

@ -52,11 +52,15 @@ using std::string;
static string tempReg; 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; trafficRef = ref;
if (trafficRef) { if (trafficRef) {
groundOffset = trafficRef->getGroundOffset(); groundOffset = trafficRef->getGroundOffset();
setCallSign(trafficRef->getCallSign()); setCallSign(trafficRef->getCallSign());
} }
else else
groundOffset = 0; groundOffset = 0;

View file

@ -40,7 +40,7 @@ const double FGAIBallistic::slugs_to_kgs = 14.5939029372;
const double FGAIBallistic::slugs_to_lbs = 32.1740485564; const double FGAIBallistic::slugs_to_lbs = 32.1740485564;
FGAIBallistic::FGAIBallistic(object_type ot) : FGAIBallistic::FGAIBallistic(object_type ot) :
FGAIBase(ot), FGAIBase(ot, false),
_height(0.0), _height(0.0),
_speed(0), _speed(0),
_ht_agl_ft(0.0), _ht_agl_ft(0.0),

View file

@ -52,7 +52,7 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172; //conversion factor
using namespace simgear; using namespace simgear;
FGAIBase::FGAIBase(object_type ot) : FGAIBase::FGAIBase(object_type ot, bool enableHot) :
_max_speed(300), _max_speed(300),
_name(""), _name(""),
_parent(""), _parent(""),
@ -121,6 +121,10 @@ FGAIBase::FGAIBase(object_type ot) :
p = 1e5; p = 1e5;
a = 340; a = 340;
Mach = 0; Mach = 0;
// explicitly disable HOT for (most) AI models
if (!enableHot)
aip.getSceneGraph()->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
} }
FGAIBase::~FGAIBase() { FGAIBase::~FGAIBase() {

View file

@ -52,7 +52,7 @@ public:
otEscort, otMultiplayer, otEscort, otMultiplayer,
MAX_OBJECTS }; // Needs to be last!!! MAX_OBJECTS }; // Needs to be last!!!
FGAIBase(object_type ot); FGAIBase(object_type ot, bool enableHot);
virtual ~FGAIBase(); virtual ~FGAIBase();
virtual void readFromScenario(SGPropertyNode* scFileNode); virtual void readFromScenario(SGPropertyNode* scFileNode);

View file

@ -29,18 +29,18 @@
#include "AIMultiplayer.hxx" #include "AIMultiplayer.hxx"
#include <simgear/scene/util/SGNodeMasks.hxx>
// #define SG_DEBUG SG_ALERT // #define SG_DEBUG SG_ALERT
FGAIMultiplayer::FGAIMultiplayer() : FGAIBase(otMultiplayer) { FGAIMultiplayer::FGAIMultiplayer() :
FGAIBase(otMultiplayer, false)
{
no_roll = false; no_roll = false;
mTimeOffsetSet = false; mTimeOffsetSet = false;
mAllowExtrapolation = true; mAllowExtrapolation = true;
mLagAdjustSystemSpeed = 10; mLagAdjustSystemSpeed = 10;
mLastTimestamp = 0; mLastTimestamp = 0;
aip.getSceneGraph()->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
lastUpdateTime = 0; lastUpdateTime = 0;
} }

View file

@ -42,7 +42,8 @@
FGAIShip::FGAIShip(object_type ot) : FGAIShip::FGAIShip(object_type ot) :
FGAIBase(ot), // allow HOT to be enabled
FGAIBase(ot, true),
_waiting(false), _waiting(false),

View file

@ -33,7 +33,7 @@ using std::string;
#include "AIStatic.hxx" #include "AIStatic.hxx"
FGAIStatic::FGAIStatic() : FGAIBase(otStatic) { FGAIStatic::FGAIStatic() : FGAIBase(otStatic, false) {
} }

View file

@ -35,7 +35,9 @@ using std::string;
#include "AIStorm.hxx" #include "AIStorm.hxx"
FGAIStorm::FGAIStorm() : FGAIBase(otStorm) { FGAIStorm::FGAIStorm() :
FGAIBase(otStorm, false)
{
delay = 3.6; delay = 3.6;
subflashes = 1; subflashes = 1;
timer = 0.0; timer = 0.0;

View file

@ -35,7 +35,9 @@ using std::string;
#include "AIThermal.hxx" #include "AIThermal.hxx"
FGAIThermal::FGAIThermal() : FGAIBase(otThermal) { FGAIThermal::FGAIThermal() :
FGAIBase(otThermal, false)
{
max_strength = 6.0; max_strength = 6.0;
diameter = 0.5; diameter = 0.5;
strength = factor = 0.0; strength = factor = 0.0;