_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
#include "settings.h"#include "stratagus.h"#include "ai_local.h"#include "action/action_build.h"#include "action/action_repair.h"#include "action/action_resource.h"#include "commands.h"#include "depend.h"#include "map.h"#include "pathfinder.h"#include "player.h"#include "tileset.h"#include "unit.h"#include "unit_find.h"#include "unittype.h"#include "upgrade.h"#include "network.h"Classes | |
| class | IsAEnemyUnitOf< ignoreVisibility > |
| class | IsAEnemyUnitWhichCanCounterAttackOf< ignoreVisibility > |
| struct | cnode |
| class | IsAWorker |
| class | CompareDepotsByDistance |
ai_resource.cpp - AI resource manager. | |
| #define | COLLECT_RESOURCES_INTERVAL 4 |
| static int | AiMakeUnit (CUnitType &type, const Vec2i &nearPos) |
| static int | AiCheckCosts (const int *costs) |
| static int | AiCheckSupply (const PlayerAi &pai, const CUnitType &type) |
| static int | AiCheckUnitTypeCosts (const CUnitType &type) |
| 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... | |
| bool | AiEnemyUnitsInDistance (const CUnit &unit, unsigned range) |
| static bool | IsAlreadyWorking (const CUnit &unit) |
| static int | AiBuildBuilding (const CUnitType &type, CUnitType &building, const Vec2i &nearPos) |
| static bool | AiRequestedTypeAllowed (const CPlayer &player, const CUnitType &type) |
| static bool | cnode_cmp (const cnode &lhs, const cnode &rhs) |
| int | AiGetBuildRequestsCount (const PlayerAi &pai, int(&counter)[UnitTypeMax]) |
| CUnit * | FindDepositNearLoc (CPlayer &p, const Vec2i &pos, int range, int resource) |
| void | AiNewDepotRequest (CUnit &worker) |
| CUnit * | AiGetSuitableDepot (const CUnit &worker, const CUnit &oldDepot, CUnit **resUnit) |
| static bool | AiRequestSupply () |
| static bool | AiTrainUnit (const CUnitType &type, CUnitType &what) |
| static bool | AiResearchUpgrade (const CUnitType &type, CUpgrade &what) |
| void | AiAddResearchRequest (CUpgrade *upgrade) |
| Add research request to resource manager. More... | |
| static bool | AiUpgradeTo (const CUnitType &type, CUnitType &what) |
| void | AiAddUpgradeToRequest (CUnitType &type) |
| Add upgrade-to request to resource manager. More... | |
| static void | AiCheckingWork () |
| static int | AiAssignHarvesterFromTerrain (CUnit &unit, int resource) |
| static int | AiAssignHarvesterFromUnit (CUnit &unit, int resource) |
| static int | AiAssignHarvester (CUnit &unit, int resource) |
| static bool | CmpWorkers (const CUnit *lhs, const CUnit *rhs) |
| static void | AiCollectResources () |
| static bool | IsReadyToRepair (const CUnit &unit) |
| static bool | AiRepairBuilding (const CPlayer &player, const CUnitType &type, CUnit &building) |
| static int | AiRepairUnit (CUnit &unit) |
| static void | AiCheckRepair () |
| void | AiAddUnitTypeRequest (CUnitType &type, int count) |
| Current AI player. More... | |
| void | AiExplore (const Vec2i &pos, int mask) |
| Ask the ai to explore around pos. More... | |
| void | AiResourceManager () |
| Periodic called resource manager handler. More... | |
| #define COLLECT_RESOURCES_INTERVAL 4 |
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.
| 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 |
|
static |
Assign worker to gather a certain resource.
| unit | pointer to the unit. |
| resource | resource identification. |
|
static |
Assign worker to gather a certain resource from terrain.
| unit | pointer to the unit. |
| resource | resource identification. |
|
static |
Assign worker to gather a certain resource from Unit.
| unit | pointer to the unit. |
| resource | resource identification. |
|
static |
Check if we can build the building.
| type | Unit that can build the building. |
| building | Building to be build. |
|
static |
Check if the costs are available for the AI.
Take reserve and already used resources into account.
| costs | Costs for something. |
|
static |
Check what must be built / trained.
|
static |
Check if there's a unit that should be repaired.
Check if the AI player needs food.
It counts buildings in progress and units in training queues.
| pai | AI player. |
| type | Unit-type that should be build. |
|
static |
Check if the costs for an unit-type are available for the AI.
Take reserve and already used resources into account.
| type | Unit-type to check the costs for. |
|
static |
Assign workers to collect resources.
If we have a shortage of a resource, let many workers collecting this. If no shortage, split workers to all resources.
| 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. |
| bool AiEnemyUnitsInDistance | ( | const CUnit & | unit, |
| unsigned | range | ||
| ) |
Check if there are enemy units in a given range.
| unit | Find in distance for this unit. |
| 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 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 |
Check if we can make a unit-type.
| type | Unit-type that must be made. |
|
static |
Check if we can repair the building.
| type | Unit that can repair the building. |
| building | Building to be repaired. |
|
static |
Check if we can repair this unit.
| unit | Unit that must be repaired. |
|
static |
Build new units to reduce the food shortage.
Check if we can research the upgrade.
| type | Unit that can research the upgrade. |
| what | What should be researched. |
| void AiResourceManager | ( | ) |
Periodic called resource manager handler.
Entry point of resource manager, periodically called.
Check if we can train the unit.
| type | Unit that can train the unit. |
| what | What to be trained. |
Check if we can upgrade to unit-type.
| type | Unit that can upgrade to unit-type |
| what | To what should be upgraded. |
|
static |
|
static |
1.8.17
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.