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

src/ai/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 "unit.h"
#include "unit_find.h"
#include "unittype.h"

Classes

class  AiForceEnemyFinder< FIND_TYPE >
class  UnitTypePrioritySorter_Decreasing
class  AiForceCounter

ai_force.cpp - AI force functions.

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

Define Documentation

#define AIATTACK_ALLMAP   1

#define AIATTACK_BUILDING   2

#define AIATTACK_RANGE   0


Function Documentation

void AiAssignFreeUnitsToForce (  ) 

Assign a free units to a force.

Assign free units to force.

bool AiAssignToForce ( CUnit unit  ) 

Assign a new unit to a force.

Ai assign unit to force.

Parameters:
unit Unit to assign to force.

void AiAttackWithForce ( unsigned int  force  ) 

Attack with force.

Attack opponent with force.

Parameters:
force Force number to attack with.

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

Attack with force at position.

Register ccl features.

Attack at position with force.

Parameters:
force Force number to attack with.
x X tile map position to be attacked.
y Y tile map position to be attacked.

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:
forces Array with Force numbers to attack with (array should be finished with -1).

int AiFindAvailableUnitTypeEquiv ( const CUnitType unittype,
int *  usableTypes 
)

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

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

Parameters:
unittype The unittype to find equivalence for
usableTypes int array which will hold the result. (Size UnitTypeMax+1)
Returns:
the number of unittype found

int AiFindUnitTypeEquiv ( const CUnitType unittype,
int *  result 
)

Finds all equivalents units to a given one.

Find All unittypes equivalent to a given one

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

void AiForceManager (  ) 

Periodic called force manager handler.

Entry point of force manager, periodic called.

static void AiGroupAttackerForTransport ( AiForce aiForce  )  [static]

Load all unit before attack.

Parameters:
aiForce force to group.

void AiNewUnitTypeEquiv ( CUnitType a,
CUnitType b 
)

Make two unittypes be considered equals.

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

Parameters:
a the first unittype
b the second unittype

void AiRemoveDeadUnitInForces (  ) 

Cleanup units in force.

Cleanup units in forces.

void AiResetUnitTypeEquiv (  ) 

equivalence between unittypes

Remove any equivalence between unittypes.

Remove any equivalence between unittypes


Variable Documentation

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.