Browse Source

might as well go ahead and allow substitution statement support

AzaezelX 5 tháng trước cách đây
mục cha
commit
7ed3f11c8e
2 tập tin đã thay đổi với 79 bổ sung2 xóa
  1. 75 0
      Engine/source/T3D/AI/AIController.cpp
  2. 4 2
      Engine/source/T3D/AI/AIController.h

+ 75 - 0
Engine/source/T3D/AI/AIController.cpp

@@ -507,6 +507,30 @@ AIControllerData::AIControllerData()
    resolveStuckPtr.bind(this, &AIControllerData::resolveStuck);
 }
 
+AIControllerData::AIControllerData(const AIControllerData& other, bool temp_clone) : SimDataBlock(other, temp_clone)
+{
+   mMoveTolerance = other.mMoveTolerance;
+   mFollowTolerance = other.mFollowTolerance;
+   mAttackRadius = other.mAttackRadius;
+   mMoveStuckTolerance = other.mMoveStuckTolerance;
+   mMoveStuckTestDelay = other.mMoveStuckTestDelay;
+   mLinkTypes = other.mLinkTypes;
+   mNavSize = other.mNavSize;
+   mHeightTolerance = other.mHeightTolerance;
+
+   mFlocking.mChance = other.mFlocking.mChance;
+   mFlocking.mMin = other.mFlocking.mMin;
+   mFlocking.mMax = other.mFlocking.mMax;
+   mFlocking.mSideStep = other.mFlocking.mSideStep;
+
+   resolveYawPtr.bind(this, &AIControllerData::resolveYaw);
+   resolvePitchPtr.bind(this, &AIControllerData::resolvePitch);
+   resolveRollPtr.bind(this, &AIControllerData::resolveRoll);
+   resolveSpeedPtr.bind(this, &AIControllerData::resolveSpeed);
+   resolveTriggerStatePtr.bind(this, &AIControllerData::resolveTriggerState);
+   resolveStuckPtr.bind(this, &AIControllerData::resolveStuck);
+}
+
 void AIControllerData::initPersistFields()
 {
    docsURL;
@@ -583,6 +607,48 @@ void AIControllerData::initPersistFields()
    Parent::initPersistFields();
 }
 
+void AIControllerData::packData(BitStream* stream)
+{
+   Parent::packData(stream);
+   stream->write(mMoveTolerance);
+   stream->write(mFollowTolerance);
+   stream->write(mAttackRadius);
+   stream->write(mMoveStuckTolerance);
+   stream->write(mMoveStuckTestDelay);
+   //enums
+   stream->write(mLinkTypes.getFlags());
+   stream->write((U32)mNavSize);
+   // end enums
+   stream->write(mHeightTolerance);
+   stream->write(mFlocking.mChance);
+   stream->write(mFlocking.mMin);
+   stream->write(mFlocking.mMax);
+   stream->write(mFlocking.mSideStep);
+};
+
+void AIControllerData::unpackData(BitStream* stream)
+{
+   Parent::unpackData(stream);
+
+   stream->read(&mMoveTolerance);
+   stream->read(&mFollowTolerance);
+   stream->read(&mAttackRadius);
+   stream->read(&mMoveStuckTolerance);
+   stream->read(&mMoveStuckTestDelay);
+   //enums
+   U16 linkFlags;
+   stream->read(&linkFlags);
+   mLinkTypes = LinkData(linkFlags);
+   U32 navSize;
+   stream->read(&navSize);
+   mNavSize = (AINavigation::NavSize)(navSize);   
+   // end enums
+   stream->read(&mHeightTolerance);
+   stream->read(&(mFlocking.mChance));
+   stream->read(&(mFlocking.mMin));
+   stream->read(&(mFlocking.mMax));
+   stream->read(&(mFlocking.mSideStep));
+};
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 IMPLEMENT_CO_DATABLOCK_V1(AIPlayerControllerData);
@@ -729,6 +795,15 @@ void AIFlyingVehicleControllerData::initPersistFields()
    Parent::initPersistFields();
 }
 
+AIFlyingVehicleControllerData::AIFlyingVehicleControllerData(const AIFlyingVehicleControllerData& other, bool temp_clone) : AIControllerData(other, temp_clone)
+{
+   mFlightCeiling = other.mFlightCeiling;
+   mFlightFloor = other.mFlightFloor;
+   resolveYawPtr.bind(this, &AIFlyingVehicleControllerData::resolveYaw);
+   resolvePitchPtr.bind(this, &AIFlyingVehicleControllerData::resolvePitch);
+   resolveSpeedPtr.bind(this, &AIFlyingVehicleControllerData::resolveSpeed);
+}
+
 void AIFlyingVehicleControllerData::resolveYaw(AIController* obj, Point3F location, Move* movePtr)
 {
    if (obj->mMovement.mMoveState < AIController::ModeSlowing) return;

+ 4 - 2
Engine/source/T3D/AI/AIController.h

@@ -146,9 +146,10 @@ class AIControllerData : public SimDataBlock {
 public:
 
    AIControllerData();
+   AIControllerData(const AIControllerData&, bool = false);
    ~AIControllerData() {};
-   void packData(BitStream* stream) override { Parent::packData(stream); };
-   void unpackData(BitStream* stream) override { Parent::unpackData(stream); };
+   void packData(BitStream* stream) override;
+   void unpackData(BitStream* stream) override;
    static void initPersistFields();
    DECLARE_CONOBJECT(AIControllerData);
 
@@ -234,6 +235,7 @@ public:
       mFlightCeiling = 200.0f;
       mFlightFloor = 1.0;
    }
+   AIFlyingVehicleControllerData(const AIFlyingVehicleControllerData&, bool = false);
    static void initPersistFields();
    void resolveYaw(AIController* obj, Point3F location, Move* movePtr);
    void resolveSpeed(AIController* obj, Point3F location, Move* movePtr);