TaskForce

Superclasses

VuEntity

FalconEntity

Subclasses: CampManagerClass , SimBaseClass,TeamClass

CampBaseClass

Subclasses: ObjectiveClass

UnitClass

Subclasses: AirUnitClass, GroundUnitClass



TaskForce


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

        private:
               CampaignTime            last_move;
                CampaignTime           last_combat;
                uchar                         orders;                 // Unit's mission
                uchar                         last_direction;         // Direction of last move
               Percentage                supply;                         // Unit's supply
                SmallPathClass            path;
                VU_ID                        air_target;                     // The ID of any air target (in addition to regular target)

        public:
                TaskForceClass(int type);
                TaskForceClass(VU_BYTE **stream);
                virtual ~TaskForceClass();
                virtual int SaveSize (void);
                virtual int Save (VU_BYTE **stream);

                // event Handlers
                virtual VU_ERRCODE Handle(VuFullUpdateEvent *event);

                // Required pure virtuals
                virtual MoveType GetMovementType (void)                 { return Naval; }
                virtual int Reaction (CampEntity e, int zone, float range);
                virtual int MoveUnit (CampaignTime time);
                virtual int DoCombat (void);
                virtual int ChooseTactic (void);
                virtual int CheckTactic (int tid);
                virtual int Real (void)                                                 { return 1; }
                virtual int GetUnitSpeed (void);
                virtual VU_ID GetAirTargetID (void)                             { return air_target; }
                virtual FalconEntity* GetAirTarget (void)              { return (FalconEntity*)vuDatabase->Find(air_target); }
                virtual void SetAirTarget (FalconEntity *t)             { if (t) air_target = t->Id(); else air_target = FalconNullId; }
                virtual CampaignTime UpdateTime (void)                 { return NAVAL_MOVE_CHECK_INTERVAL*CampaignSeconds; }
                virtual CampaignTime CombatTime (void)                 { return NAVAL_COMBAT_CHECK_INTERVAL*CampaignSeconds; }
                virtual int IsTaskForce (void)                                  { return TRUE; }
                virtual int OnGround (void)                                             { return TRUE; }
                virtual int GetVehicleDeagData (SimInitDataClass *simdata, int remote);
                virtual int GetDeaggregationPoint (int slot, CampEntity *ent);

                // core functions
                virtual void SetUnitOrders (uchar o)                            { orders = o; }
                virtual void SetUnitSupply (uchar s)                            { supply = s; }
                virtual void SetUnitNextMove (void)                            { path.StepPath(); }
                virtual void ClearUnitPath (void)                              { path.ClearPath(); }
                virtual int GetNextMoveDirection (void)                { return path.GetNextDirection(); }
                virtual int GetUnitOrders (void)                                { return orders; }
                virtual int GetUnitSupply (void)                               { return (int)supply; }
                virtual CampaignTime GetMoveTime (void);
                virtual CampaignTime GetCombatTime (void)               { return TheCampaign.CurrentTime - last_combat; }
                virtual void GetRealPosition (float *x, float *y, float *z);

                int DetectVs (AircraftClass *ac, float *d, int *combat, int *spot);
                int DetectVs (CampEntity e, float *d, int *combat, int *spot);