_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes
ai_force.cpp File Reference
#include "stratagus.h"
#include "ai_local.h"
#include "actions.h"
#include "action/action_attack.h"
#include "action/action_board.h"
#include "commands.h"
#include "depend.h"
#include "map.h"
#include "pathfinder.h"
#include "tileset.h"
#include "unit.h"
#include "unit_find.h"
#include "unittype.h"

Classes

class  EnemyUnitFinder
 
class  AiForceEnemyFinder< FIND_TYPE >
 
class  IsAnAlliedUnitOf
 
class  UnitTypePrioritySorter_Decreasing
 
class  AiForceCounter
 
class  AiForceRallyPointFinder
 

ai_force.cpp - AI force functions.

#define AIATTACK_RANGE   0
 
#define AIATTACK_ALLMAP   1
 
#define AIATTACK_BUILDING   2
 
#define AIATTACK_AGRESSIVE   3
 
int UnitTypeEquivs [UnitTypeMax+1]
 AI helper variables. More...
 
void AiResetUnitTypeEquiv ()
 equivalence between unittypes More...
 
void AiNewUnitTypeEquiv (const CUnitType &a, const CUnitType &b)
 Make two unittypes be considered equals. More...
 
int AiFindUnitTypeEquiv (const CUnitType &unittype, int *result)
 Finds all equivalents units to a given one. More...
 
int AiFindAvailableUnitTypeEquiv (const CUnitType &unittype, int *usableTypes)
 Finds all available equivalents units to a given one, in the preferred order. More...
 
void AiRemoveDeadUnitInForces ()
 Cleanup units in force. More...
 
bool AiAssignToForce (CUnit &unit)
 Assign a new unit to a force. More...
 
void AiAssignFreeUnitsToForce (int force)
 Assign a free units to a force. More...
 
void AiAttackWithForceAt (unsigned int force, int x, int y)
 Attack with force at position. More...
 
void AiAttackWithForce (unsigned int force)
 Attack with force. More...
 
void AiAttackWithForces (int *forces)
 Attack with forces in array. More...
 
static void AiGroupAttackerForTransport (AiForce &aiForce)
 
void AiForceManager ()
 Periodic called force manager handler. More...
 

Macro Definition Documentation

◆ AIATTACK_AGRESSIVE

#define AIATTACK_AGRESSIVE   3

◆ AIATTACK_ALLMAP

#define AIATTACK_ALLMAP   1

◆ AIATTACK_BUILDING

#define AIATTACK_BUILDING   2

◆ AIATTACK_RANGE

#define AIATTACK_RANGE   0

Function Documentation

◆ AiAssignFreeUnitsToForce()

void AiAssignFreeUnitsToForce ( int  force)

Assign a free units to a force.

Assign free units to force.

◆ AiAssignToForce()

bool AiAssignToForce ( CUnit unit)

Assign a new unit to a force.

Ai assign unit to force.

Parameters
unitUnit to assign to force.

◆ AiAttackWithForce()

void AiAttackWithForce ( unsigned int  force)

Attack with force.

Attack opponent with force.

Parameters
forceForce number to attack with.

◆ AiAttackWithForceAt()

void AiAttackWithForceAt ( unsigned int  force,
int  x,
int  y 
)

Attack with force at position.

Register ccl features.

Attack at position with force.

Parameters
forceForce number to attack with.
xX tile map position to be attacked.
yY tile map position to be attacked.

◆ AiAttackWithForces()

void AiAttackWithForces ( int *  forces)

Attack with forces in array.

Attack opponent with forces. Merge forces in array into one attack force and attack with it Merge is make because units in one force help each other during attack

Parameters
forcesArray with Force numbers to attack with (array should be finished with -1).

◆ AiFindAvailableUnitTypeEquiv()

int AiFindAvailableUnitTypeEquiv ( const CUnitType unittype,
int *  usableTypes 
)

Finds all available equivalents units to a given one, in the preferred order.

Find All unittypes equivalent to a given one, and which are available UnitType are returned in the preferred order (ie palladin >> knight...)

Parameters
unittypeThe unittype to find equivalence for
usableTypesint array which will hold the result. (Size UnitTypeMax+1)
Returns
the number of unittype found

◆ AiFindUnitTypeEquiv()

int AiFindUnitTypeEquiv ( const CUnitType unittype,
int *  result 
)

Finds all equivalents units to a given one.

Find All unittypes equivalent to a given one

Parameters
unittypethe unittype to find equivalence for
resultint array which will hold the result. (Size UnitTypeMax+1)
Returns
the number of unittype found

◆ AiForceManager()

Periodic called force manager handler.

Entry point of force manager, periodic called.

◆ AiGroupAttackerForTransport()

static void AiGroupAttackerForTransport ( AiForce aiForce)
static

Load all unit before attack.

Parameters
aiForceforce to group.

◆ AiNewUnitTypeEquiv()

void AiNewUnitTypeEquiv ( const CUnitType a,
const CUnitType b 
)

Make two unittypes be considered equals.

Make two unittypes equivalents from the AI's point of vue

Parameters
athe first unittype
bthe second unittype

◆ AiRemoveDeadUnitInForces()

void AiRemoveDeadUnitInForces ( )

Cleanup units in force.

Cleanup units in forces.

◆ AiResetUnitTypeEquiv()

void AiResetUnitTypeEquiv ( )

equivalence between unittypes

Remove any equivalence between unittypes.

Remove any equivalence between unittypes

Variable Documentation

◆ UnitTypeEquivs

int UnitTypeEquivs[UnitTypeMax+1]

AI helper variables.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.