The [GNDAI]Class

Superclasses

VuEntity

FalconEntity

Other Subclasses: CampBaseClass , SimBaseClass,TeamClass

SimBaseClass

Other Subclasses:   SimStaticClass

SimMoverClass

Subclasses :SimWeaponClass, EjectedPilotClass

SimVehicleClass

Subclasses: SimGroundVehicle,SimAircraft,SimHelicopter

[GNDAI]

        // Public variables and functions
        //
        public:
        long lastMoveTime;
                UnitClass               *parent_unit;           // Generic unit class pointer to allow for naval units

                GNDAIFormType   formation;
                int                             squad_id;                       // Used for formation coordination
                int                             platoon_id;                     // Used for formation coordination
                int                             company_id;                     // Used for formation coordination
                int                             rank;

                // Platform specific routines, these routines do the low-level grunt
                // work
                //
            BOOL Follow_Road ( void );
                WayPointClass *Next_WayPoint ( void );
                void  Fire ( void );
 

                GNDAIClass ( GroundClass *s, GNDAIClass *l, short r, int unit_id, int skill );
                ~GNDAIClass (void);
                void Process ( void );
                void ProcessTargeting( void );
                void SetLeader (GNDAIClass*);

                // Managment routines
                //
                void Order_Battalion (void);
                void Order_Company (void);
                void Order_Platoon (void);
                void Order_Squad (void);
                int CheckThrough (void);

                void SetGroundTarget( SimObjectType *newTarget );
                void SetAirTarget( SimObjectType *newTarget );

                // when a leader dies, subordinates need to be promoted
                void PromoteSubordinates( void );

                // calc an LOD based on camera distance
                void SetDistLOD( void );

                // Movement routines
                //
                void Move_Towards_Dest ( void );

                // Public vars
                //
                float                   ideal_x;                        // Best X & Y, heading
                float                   ideal_y;
                float                   ideal_h;

                float                   through_x;                      // Point through which everyone must travel
                float                   through_y;                      // (For column movement)

                float                   icosh;                          // sin and cos for ideal heading (leaders only)
                float                   isinh;

                float                   leftToGoSq;                     // Distance squared remaining to travel

                float                   maxvel;                         // Fastest we can go (fps)
                float                   unitvel;                        // Unit's movement speed (as a whole battalion)

                float                   move_backwards;         // Set to PI if we move backwards (towed)

                GroundClass             *self;                          // Every AI Object has a Sim object
                GNDAIClass              *leader;                        // Our immediate superior (NULL for Battalion commander)
                GNDAIClass              *battalionCommand;      // highest in formation ("this" for Battalion commander)

                ulong                   nextAirFire;            // firing delay
                ulong                   nextGroundFire;         // firing delay
                ulong                   nextTurretCalc;         // when to recalculate for turret move

                ulong                   airFireRate;            // rate governing fire freq vs air
                ulong                   gndFireRate;            // rate governing fire freq vs ground

                int                             skillLevel;                     // How smart is this guy?

                float                   distLOD;                        // 0 - 1 LOD value based on cam dist

                // edg: these are used in campaign movement, mostly
                // for road and bridge following
                GridIndex               gridX,gridY;
                GridIndex               lastGridX,lastGridY;
                int                             moveDir;

                int                             moveState;                      // how are we moving?
                int                             moveFlags;

        protected:
                SimObjectType   *gndTargetPtr;          // Our campaign parent's ground target
                SimObjectType   *airTargetPtr;          // Our campaign parent's air target
 

#ifdef USE_SH_POOLS
   public:
      // Overload new/delete to use a SmartHeap fixed size pool
      void *operator new(size_t size) { ShiAssert( size == sizeof(GNDAIClass) ); return MemAllocFS(pool);       };
      void operator delete(void *mem) { if (mem) MemFreeFS(mem); };
      static void InitializeStorage()   { pool = MemPoolInitFS( sizeof(GNDAIClass), 200, 0 ); };
      static void ReleaseStorage()      { MemPoolFree( pool ); };
      static MEM_POOL   pool;
#endif