Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
AI Class Reference

#include <AI.h>

Inherits SubsystemInterface, and Snapshot.

Public Types

enum  {
  CAN_SEE = 1 << 0 , CAN_ATTACK = 1 << 1 , IGNORE_INSIGNIFICANT_BUILDINGS = 1 << 2 , ATTACK_BUILDINGS = 1 << 3 ,
  WITHIN_ATTACK_RANGE = 1 << 4 , UNFOGGED = 1 << 5
}
 

Public Member Functions

 AI (void)
 
 ~AI ()
 
virtual void init (void)
 initialize AI to default values
 
virtual void reset (void)
 reset the AI system to prepare for a new map
 
virtual void update (void)
 do one frame of AI computation
 
Pathfinderpathfinder (void)
 public access to the pathfind system
 
ObjectfindClosestEnemy (const Object *me, Real range, UnsignedInt qualifiers, const AttackPriorityInfo *info=NULL, PartitionFilter *optionalFilter=NULL)
 
ObjectfindClosestRepulsor (const Object *me, Real range)
 
ObjectfindClosestAlly (const Object *me, Real range, UnsignedInt qualifiers)
 
void crc (Xfer *xfer)
 run the "light" crc check on this data structure
 
void xfer (Xfer *xfer)
 
void loadPostProcess (void)
 
AIGroupcreateGroup (void)
 instantiate a new AI Group
 
void destroyGroup (AIGroup *group)
 destroy the given AI Group
 
AIGroupfindGroup (UnsignedInt id)
 return the AI Group with the given ID
 
enum FormationID getNextFormationID (void)
 
const TAiDatagetAiData ()
 
UnsignedInt getNextGroupID (void)
 
- Public Member Functions inherited from SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
virtual void draw (void)
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Static Public Member Functions

static void parseAiDataDefinition (INI *ini)
 
static Real getAdjustedVisionRangeForObject (const Object *object, Int factorsToConsider)
 
static void parseSideInfo (INI *ini, void *instance, void *store, const void *userData)
 Parse the image part of the INI file.
 
static void parseSkirmishBuildList (INI *ini, void *instance, void *store, const void *userData)
 Parse the image part of the INI file.
 
static void parseStructure (INI *ini, void *instance, void *store, const void *userData)
 Parse the image part of the INI file.
 
static void parseSkillSet (INI *ini, void *instance, void *store, const void *userData)
 Parse the image part of the INI file.
 
static void parseScience (INI *ini, void *instance, void *store, const void *userData)
 Parse the image part of the INI file.
 

Protected Member Functions

void newOverride (void)
 
void addSideInfo (AISideInfo *info)
 

Protected Attributes

Pathfinderm_pathfinder
 the pathfinding system
 
std::list< AIGroup * > m_groupList
 the list of AIGroups
 
TAiDatam_aiData
 
UnsignedInt m_nextGroupID
 
FormationID m_nextFormationID
 
- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Detailed Description

The AI subsystem is responsible for the implementation of the Artificial Intelligence of the game. This includes the behaviors or all game entities, pathfinding, etc.

Definition at line 242 of file AI.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
CAN_SEE 
CAN_ATTACK 
IGNORE_INSIGNIFICANT_BUILDINGS 
ATTACK_BUILDINGS 
WITHIN_ATTACK_RANGE 
UNFOGGED 

Definition at line 253 of file AI.h.

Constructor & Destructor Documentation

◆ AI()

AI::AI ( void )

Constructor for the AI system

Definition at line 310 of file AI.cpp.

◆ ~AI()

AI::~AI ( )

Destroy the AI system

Definition at line 371 of file AI.cpp.

Member Function Documentation

◆ addSideInfo()

void AI::addSideInfo ( AISideInfo * info)
protected

Definition at line 412 of file AI.cpp.

◆ crc()

void AI::crc ( Xfer * xfer)
virtual

run the "light" crc check on this data structure

Implements Snapshot.

Definition at line 1001 of file AI.cpp.

◆ createGroup()

AIGroup * AI::createGroup ( void )

instantiate a new AI Group

Create a new AI Group

Definition at line 447 of file AI.cpp.

◆ destroyGroup()

void AI::destroyGroup ( AIGroup * group)

destroy the given AI Group

Destroy the given AI Group

Definition at line 462 of file AI.cpp.

◆ findClosestAlly()

Object * AI::findClosestAlly ( const Object * me,
Real range,
UnsignedInt qualifiers )

Return the closest ally, according to the qualifiers.

Definition at line 738 of file AI.cpp.

◆ findClosestEnemy()

Object * AI::findClosestEnemy ( const Object * me,
Real range,
UnsignedInt qualifiers,
const AttackPriorityInfo * info = NULL,
PartitionFilter * optionalFilter = NULL )

Return the closest enemy, according to the qualifiers.

Definition at line 587 of file AI.cpp.

◆ findClosestRepulsor()

Object * AI::findClosestRepulsor ( const Object * me,
Real range )

Return the closest repulsor.

Definition at line 778 of file AI.cpp.

◆ findGroup()

AIGroup * AI::findGroup ( UnsignedInt id)

return the AI Group with the given ID

Given an ID, return the associated AIGroup

Todo
Optimize this (MSB)

Definition at line 483 of file AI.cpp.

◆ getAdjustedVisionRangeForObject()

Real AI::getAdjustedVisionRangeForObject ( const Object * object,
Int factorsToConsider )
static

Definition at line 804 of file AI.cpp.

◆ getAiData()

const TAiData * AI::getAiData ( )
inline

Definition at line 283 of file AI.h.

◆ getNextFormationID()

FormationID AI::getNextFormationID ( void )

Get the next formation id.

Definition at line 498 of file AI.cpp.

◆ getNextGroupID()

UnsignedInt AI::getNextGroupID ( void )
inline

Definition at line 294 of file AI.h.

◆ init()

void AI::init ( void )
virtual

initialize AI to default values

Initialize the AI system

Implements SubsystemInterface.

Definition at line 320 of file AI.cpp.

◆ loadPostProcess()

void AI::loadPostProcess ( void )
virtual

post process phase for loading save games. All save systems have their xfer run using XferLoad mode, and then all systems each have their post process run

Implements Snapshot.

Definition at line 1041 of file AI.cpp.

◆ newOverride()

void AI::newOverride ( void )
protected

Definition at line 386 of file AI.cpp.

◆ parseAiDataDefinition()

void AI::parseAiDataDefinition ( INI * ini)
static

Parse GameData entry

Definition at line 421 of file AI.cpp.

◆ parseScience()

void AI::parseScience ( INI * ini,
void * instance,
void * store,
const void * userData )
static

Parse the image part of the INI file.

Definition at line 261 of file AI.cpp.

◆ parseSideInfo()

void AI::parseSideInfo ( INI * ini,
void * instance,
void * store,
const void * userData )
static

Parse the image part of the INI file.

Definition at line 212 of file AI.cpp.

◆ parseSkillSet()

void AI::parseSkillSet ( INI * ini,
void * instance,
void * store,
const void * userData )
static

Parse the image part of the INI file.

Definition at line 248 of file AI.cpp.

◆ parseSkirmishBuildList()

void AI::parseSkirmishBuildList ( INI * ini,
void * instance,
void * store,
const void * userData )
static

Parse the image part of the INI file.

Definition at line 284 of file AI.cpp.

◆ parseStructure()

static void AI::parseStructure ( INI * ini,
void * instance,
void * store,
const void * userData )
static

Parse the image part of the INI file.

◆ pathfinder()

Pathfinder * AI::pathfinder ( void )
inline

public access to the pathfind system

Definition at line 252 of file AI.h.

◆ reset()

void AI::reset ( void )
virtual

reset the AI system to prepare for a new map

Reset the AI system in preparation for a new map

Implements SubsystemInterface.

Definition at line 328 of file AI.cpp.

◆ update()

void AI::update ( void )
virtual

do one frame of AI computation

Update the AI system

Implements SubsystemInterface.

Definition at line 356 of file AI.cpp.

◆ xfer()

void AI::xfer ( Xfer * xfer)
virtual

run save, load, or deep CRC check on this data structure, the type depends on the setup of the Xfer pointer

Implements Snapshot.

Definition at line 1030 of file AI.cpp.

Member Data Documentation

◆ m_aiData

TAiData* AI::m_aiData
protected

Definition at line 299 of file AI.h.

◆ m_groupList

std::list<AIGroup *> AI::m_groupList
protected

the list of AIGroups

Definition at line 298 of file AI.h.

◆ m_nextFormationID

FormationID AI::m_nextFormationID
protected

Definition at line 304 of file AI.h.

◆ m_nextGroupID

UnsignedInt AI::m_nextGroupID
protected

Definition at line 303 of file AI.h.

◆ m_pathfinder

Pathfinder* AI::m_pathfinder
protected

the pathfinding system

Definition at line 297 of file AI.h.


The documentation for this class was generated from the following files: