_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
Go to the source code of this file.
Classes | |
class | CAiType |
class | AiRequestType |
class | AiUnitType |
class | AiForce |
class | AiForceManager |
class | AiBuildQueue |
class | AiExplorationRequest |
class | PlayerAi |
class | AiHelper |
ai_local.h - The local AI header file. | |
#define | AI_WAIT_ON_RALLY_POINT 60 |
#define | AI_MAX_FORCES 50 |
#define | AI_MAX_FORCE_INTERNAL (AI_MAX_FORCES / 2) |
enum | AiForceRole { AiForceRoleDefault = 0, AiForceRoleAttack = 0, AiForceRoleDefend } |
enum | AiForceAttackingState { AiForceAttackingState_Free = -1, AiForceAttackingState_Waiting = 0, AiForceAttackingState_Boarding, AiForceAttackingState_GoingToRallyPoint, AiForceAttackingState_AttackingWithTransporter, AiForceAttackingState_Attacking } |
std::vector< CAiType * > | AiTypes |
Ai sleeps # cycles. More... | |
AiHelper | AiHelpers |
List of all AI types. More... | |
int | UnitTypeEquivs [UnitTypeMax+1] |
AI helper variables. More... | |
PlayerAi * | AiPlayer |
equivalence between unittypes More... | |
void | AiAddUnitTypeRequest (CUnitType &type, int count) |
Current AI player. More... | |
void | AiAddUpgradeToRequest (CUnitType &type) |
Add upgrade-to request to resource manager. More... | |
void | AiAddResearchRequest (CUpgrade *upgrade) |
Add research request to resource manager. More... | |
void | AiResourceManager () |
Periodic called resource manager handler. More... | |
void | AiExplore (const Vec2i &pos, int exploreMask) |
Ask the ai to explore around pos. More... | |
void | AiNewUnitTypeEquiv (const CUnitType &a, const CUnitType &b) |
Make two unittypes be considered equals. More... | |
void | AiResetUnitTypeEquiv () |
Remove any equivalence between unittypes. More... | |
int | AiFindUnitTypeEquiv (const CUnitType &type, int *result) |
Finds all equivalents units to a given one. More... | |
int | AiFindAvailableUnitTypeEquiv (const CUnitType &type, int *result) |
Finds all available equivalents units to a given one, in the preferred order. More... | |
int | AiGetBuildRequestsCount (const PlayerAi &pai, int(&counter)[UnitTypeMax]) |
void | AiNewDepotRequest (CUnit &worker) |
CUnit * | AiGetSuitableDepot (const CUnit &worker, const CUnit &oldDepot, CUnit **resUnit) |
bool | AiFindBuildingPlace (const CUnit &worker, const CUnitType &type, const Vec2i &nearPos, Vec2i *resultPos) |
Find nice building place. More... | |
void | AiRemoveDeadUnitInForces () |
Cleanup units in force. More... | |
bool | AiAssignToForce (CUnit &unit) |
Assign a new unit to a force. More... | |
void | AiAssignFreeUnitsToForce (int force=-1) |
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... | |
void | AiForceManager () |
Periodic called force manager handler. More... | |
int | AiFindWall (AiForce *force) |
Find a wall to attack. More... | |
void | AiSendExplorers () |
bool | AiEnemyUnitsInDistance (const CPlayer &player, const CUnitType *type, const Vec2i &pos, unsigned range) |
Check if there are enemy units in a given range (optionally of type) More... | |
void | AiCheckMagic () |
Check for magic. More... | |
#define AI_MAX_FORCE_INTERNAL (AI_MAX_FORCES / 2) |
#define AI_MAX_FORCES 50 |
#define AI_WAIT_ON_RALLY_POINT 60 |
enum AiForceRole |
Add research request to resource manager.
Check if the research can be done.
upgrade | Upgrade to research |
Current AI player.
Add unit-type request to resource manager
Add unit-type request to resource manager.
type | Unit type requested. |
count | How many units. |
Add upgrade-to request to resource manager.
Check if the upgrade-to can be done.
type | FIXME: docu |
void AiAssignFreeUnitsToForce | ( | int | force | ) |
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.
unit | Unit to assign to force. |
void AiAttackWithForce | ( | unsigned int | force | ) |
Attack with force.
Attack opponent with force.
force | Force number to attack with. |
void AiAttackWithForceAt | ( | unsigned int | force, |
int | x, | ||
int | y | ||
) |
Attack with force at position.
Attack at position with force.
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
forces | Array with Force numbers to attack with (array should be finished with -1). |
void AiCheckMagic | ( | ) |
Check for magic.
Check what computer units can do with magic. In fact, turn on autocast for AI.
bool AiEnemyUnitsInDistance | ( | const CPlayer & | player, |
const CUnitType * | type, | ||
const Vec2i & | pos, | ||
unsigned | range | ||
) |
Check if there are enemy units in a given range (optionally of type)
Check if there are enemy units in a given range.
player | Find enemies of this player |
type | Optional unit type to check if enemy can target this |
pos | location |
range | Distance range to look. |
Ask the ai to explore around pos.
Mark that a zone is requiring exploration.
pos | Pos of the zone |
mask | Mask to explore ( land/sea/air ) |
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...)
unittype | The unittype to find equivalence for |
usableTypes | int array which will hold the result. (Size UnitTypeMax+1) |
bool AiFindBuildingPlace | ( | const CUnit & | worker, |
const CUnitType & | type, | ||
const Vec2i & | nearPos, | ||
Vec2i * | resultPos | ||
) |
Find nice building place.
Find free building place.
worker | Worker to build building. |
type | Type of building. |
nearPos | Start search near nearPos position (or worker->X if nearPos is invalid). |
resultPos | Pointer for position returned. |
int AiFindUnitTypeEquiv | ( | const CUnitType & | unittype, |
int * | result | ||
) |
Finds all equivalents units to a given one.
Find All unittypes equivalent to a given one
unittype | the unittype to find equivalence for |
result | int array which will hold the result. (Size UnitTypeMax+1) |
int AiFindWall | ( | AiForce * | force | ) |
Find a wall to attack.
Find possible walls to target.
force | Attack force. |
void AiForceManager | ( | ) |
Periodic called force manager handler.
Entry point of force manager, periodic called.
int AiGetBuildRequestsCount | ( | const PlayerAi & | pai, |
int(&) | counter[UnitTypeMax] | ||
) |
Get a suitable depot for better resource harvesting.
worker | Worker itself. |
oldDepot | Old assigned depot. |
resUnit | Resource to harvest from, if succeed |
Make two unittypes be considered equals.
Make two unittypes equivalents from the AI's point of vue
a | the first unittype |
b | the second unittype |
void AiRemoveDeadUnitInForces | ( | ) |
Cleanup units in force.
Cleanup units in forces.
void AiResetUnitTypeEquiv | ( | ) |
Remove any equivalence between unittypes.
Remove any equivalence between unittypes.
Remove any equivalence between unittypes
void AiResourceManager | ( | ) |
Periodic called resource manager handler.
Entry point of resource manager, periodically called.
void AiSendExplorers | ( | ) |
Plan the an attack Send explorers around the map
Respond to ExplorationRequests
AiHelper AiHelpers |
List of all AI types.
PlayerAi* AiPlayer |
equivalence between unittypes
equivalence between unittypes
std::vector<CAiType *> AiTypes |
Ai sleeps # cycles.
int UnitTypeEquivs[UnitTypeMax+1] |
AI helper variables.