____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
Go to the source code of this file.
Functions | |
| void | AiEachCycle (CPlayer *player) |
| Called each game cycle. | |
| void | AiEachSecond (CPlayer *player) |
| Called each second. | |
| void | InitAiModule (void) |
| Init AI global structures. | |
| void | AiInit (CPlayer *player) |
| Init AI for this player. | |
| void | CleanAi (void) |
| Cleanup the AI module. | |
| void | FreeAi (void) |
| Free the AI resources. | |
| void | SaveAi (CFile *file) |
| Save the AI state. | |
| void | AiCclRegister (void) |
| Register ccl features. | |
| void | AiHelpMe (const CUnit *attacker, CUnit *defender) |
| < Called if AI unit is attacked | |
| void | AiUnitKilled (CUnit *unit) |
| Called if AI needs more farms. | |
| void | AiNeedMoreSupply (const CUnit *unit, const CUnitType *what) |
| Called if AI unit has completed work. | |
| void | AiWorkComplete (CUnit *unit, CUnit *what) |
| Called if AI unit can't build. | |
| void | AiCanNotBuild (CUnit *unit, const CUnitType *what) |
| Called if AI unit can't reach building place. | |
| void | AiCanNotReach (CUnit *unit, const CUnitType *what) |
| Called if an AI unit can't move. | |
| void | AiCanNotMove (CUnit *unit) |
| Called if AI unit has completed training. | |
| void | AiTrainingComplete (CUnit *unit, CUnit *what) |
Variables | |
| int | AiSleepCycles |
| Ai sleeps # cycles. | |
Definition in file ai.h.
Called if AI unit can't reach building place.
Called if building can't be build.
| unit | Pointer to unit what builds the building. | |
| what | Pointer to unit-type. |
Definition at line 769 of file ai.cpp.
References _C_, CPlayer::Ai, AiReduceMadeInBuilt(), Assert, DebugPrint, CUnitType::Ident, CPlayer::Index, CUnit::Player, PlayerPerson, CPlayer::Type, CUnit::Type, UnitNumber, CUnit::X, and CUnit::Y.
Referenced by CheckCanBuild(), and StartBuilding().
| void AiCanNotMove | ( | CUnit * | unit | ) |
Called if AI unit has completed training.
Called if a unit can't move. Try to move unit in the way
| unit | Pointer to unit what builds the building. |
Definition at line 924 of file ai.cpp.
References CPlayer::Ai, AiMoveUnitInTheWay(), CUnit::Orders, PlaceReachable(), CUnit::Player, CUnit::Type, CUnitType::UnitType, and UnitTypeFly.
Referenced by DoActionMove().
Called if an AI unit can't move.
Called if building place can't be reached.
| unit | Pointer to unit what builds the building. | |
| what | Pointer to unit-type. |
Definition at line 785 of file ai.cpp.
References CPlayer::Ai, AiReduceMadeInBuilt(), Assert, CUnit::Player, PlayerPerson, and CPlayer::Type.
Referenced by MoveToLocation().
| void AiCclRegister | ( | void | ) |
Register ccl features.
Register CCL features for unit-type.
Definition at line 1169 of file script_ai.cpp.
References CclAiAttackWithForce(), CclAiCheckForce(), CclAiDebug(), CclAiDebugPlayer(), CclAiDump(), CclAiForce(), CclAiForceRole(), CclAiGetSleepCycles(), CclAiNeed(), CclAiPlayer(), CclAiSet(), CclAiSleep(), CclAiWait(), CclAiWaitForce(), CclDefineAi(), CclDefineAiHelper(), CclDefineAiPlayer(), and Lua.
Referenced by InitCcl().
| void AiEachCycle | ( | CPlayer * | player | ) |
Called each game cycle.
This is called for each player, each game cycle.
| player | The player structure pointer. |
Definition at line 996 of file ai.cpp.
References CPlayer::Ai, COrder::Goal, int(), AiTransportRequest::Order, CUnit::RefsDecrease(), PlayerAi::TransportRequests, and AiTransportRequest::Unit.
Referenced by PlayersEachCycle().
| void AiEachSecond | ( | CPlayer * | player | ) |
Called each second.
This is called for each player each second.
| player | The player structure pointer. |
Definition at line 1015 of file ai.cpp.
References CPlayer::Ai, AiCheckMagic(), AiCheckUnits(), AiExecuteScript(), AiForceManager(), AiResourceManager(), AiSendExplorers(), CYCLES_PER_SECOND, GameCycle, and PlayerAi::LastExplorationGameCycle.
Referenced by PlayersEachSecond().
< Called if AI unit is attacked
Called if AI unit is killed
Called if a Unit is Attacked
| attacker | Pointer to attacker unit. | |
| defender | Pointer to unit that is being attacked. |
Definition at line 646 of file ai.cpp.
References _C_, CPlayer::Ai, AI_MAX_ATTACKING_FORCES, AiAttackWithForceAt(), AiForce::Attacking, CUnitType::CanAttack, DebugPrint, AiForce::Defending, PlayerAi::Force, CUnitType::Ident, CPlayer::Index, int(), CUnit::Player, CUnit::Type, UnitNumber, AiForce::Units, CUnitType::UnitType, UnitTypeFly, CUnit::X, and CUnit::Y.
Referenced by HitUnit().
| void AiInit | ( | CPlayer * | player | ) |
Init AI for this player.
Setup all at start.
| player | The player structure pointer. |
Definition at line 423 of file ai.cpp.
References _C_, CPlayer::Ai, CPlayer::AiName, PlayerAi::AiType, AiTypes, CAiType::Class, DebugPrint, Exit(), CPlayer::Index, int(), PlayerAi::Player, CAiType::Script, and PlayerAi::Script.
Referenced by HandleCheats(), and PlayersInitAi().
Called if AI unit has completed work.
Called if the AI needs more farms.
| unit | Point to unit. | |
| what | Pointer to unit-type. |
Definition at line 964 of file ai.cpp.
References CPlayer::Ai, Assert, PlayerAi::NeedSupply, CUnit::Player, PlayerPerson, and CPlayer::Type.
Referenced by HandleActionTrain().
Called if training of a unit is completed.
| unit | Pointer to unit making. | |
| what | Pointer to new ready trained unit. |
Definition at line 976 of file ai.cpp.
References _C_, CPlayer::Ai, AiAssignToForce(), AiCleanForces(), AiRemoveFromBuilt(), Assert, DebugPrint, CUnitType::Ident, CPlayer::Index, CUnit::Player, PlayerPerson, CPlayer::Type, CUnit::Type, UnitNumber, CUnit::X, and CUnit::Y.
Referenced by HandleActionTrain().
| void AiUnitKilled | ( | CUnit * | unit | ) |
Called if AI needs more farms.
Called if a unit is killed.
| unit | Pointer to unit. |
Definition at line 708 of file ai.cpp.
References _C_, CPlayer::Ai, AiReduceMadeInBuilt(), Assert, DebugPrint, CUnitType::Ident, CPlayer::Index, CUnit::Orders, CUnit::Player, PlayerPerson, CPlayer::Type, CUnit::Type, UnitActionAttack, UnitActionBuild, UnitActionBuilt, UnitActionMove, UnitActionStill, and UnitNumber.
Referenced by UnitLost().
Called if AI unit can't build.
Called if work complete (Buildings).
| unit | Pointer to unit that builds the building. | |
| what | Pointer to unit building that was built. |
Definition at line 748 of file ai.cpp.
References _C_, CPlayer::Ai, AiRemoveFromBuilt(), Assert, DebugPrint, CUnitType::Ident, CPlayer::Index, CUnit::Player, PlayerPerson, CPlayer::Type, CUnit::Type, UnitNumber, CUnit::X, and CUnit::Y.
Referenced by HandleActionBuilt().
| void CleanAi | ( | void | ) |
Cleanup the AI module.
Cleanup the AI in order to enable to restart a game.
Definition at line 486 of file ai.cpp.
References CPlayer::Ai, PlayerMax, and Players.
Referenced by CleanGame(), and FreeAi().
| void FreeAi | ( | void | ) |
Free the AI resources.
Free all AI resources.
Definition at line 500 of file ai.cpp.
References AiResetUnitTypeEquiv(), AiTypes, AiHelper::Build, CleanAi(), AiHelper::Equiv, int(), AiHelper::Repair, AiHelper::Train, and AiHelper::UnitLimit.
Referenced by CleanModules().
| void InitAiModule | ( | void | ) |
Init AI global structures.
Initialize global structures of the AI
Definition at line 477 of file ai.cpp.
References AiResetUnitTypeEquiv().
Referenced by InitModules(), and main().
| void SaveAi | ( | CFile * | file | ) |
Save the AI state.
Save state of AI to file.
| file | Output file. |
Definition at line 409 of file ai.cpp.
References DebugPrint, CFile::printf(), and SaveAiPlayers().
Referenced by SaveGame().
| int AiSleepCycles |
Ai sleeps # cycles.
Definition at line 152 of file ai.cpp.
Referenced by CclAiGetSleepCycles(), and main().
1.5.6