#include <AIPlayer.h>
Inherits MemoryPoolObject, and Snapshot.
Inherited by AISkirmishPlayer.
Public Member Functions | |
| AIPlayer (Player *p) | |
| constructor | |
| virtual Bool | computeSuperweaponTarget (const SpecialPowerTemplate *power, Coord3D *pos, Int playerNdx, Real weaponRadius) |
| Calculates best pos for weapon given radius. | |
| virtual void | update () |
| simulates the behavior of a player | |
| virtual void | newMap () |
| New map loaded call. | |
| virtual void | onUnitProduced (Object *factory, Object *unit) |
| Invoked when a unit I am training comes into existence. | |
| virtual void | onStructureProduced (Object *factory, Object *structure) |
| Invoked when a structure I am building comes into existence. | |
| virtual void | buildSpecificAITeam (TeamPrototype *teamProto, Bool priorityBuild) |
| Builds this team immediately. | |
| virtual void | buildAIBaseDefense (Bool flank) |
| Builds base defense on front or flank of base. | |
| virtual void | buildAIBaseDefenseStructure (const AsciiString &thingName, Bool flank) |
| Builds base defense on front or flank of base. | |
| virtual void | buildSpecificAIBuilding (const AsciiString &thingName) |
| Builds this building as soon as possible. | |
| virtual void | recruitSpecificAITeam (TeamPrototype *teamProto, Real recruitRadius) |
| Builds this team immediately. | |
| virtual Bool | isSkirmishAI (void) |
| virtual Player * | getAiEnemy (void) |
| Solo AI attacks based on scripting. Only skirmish auto-acquires an enemy at this point. jba. | |
| virtual Bool | checkBridges (Object *unit, Waypoint *way) |
| virtual void | repairStructure (ObjectID structure) |
| virtual void | selectSkillset (Int skillset) |
| Bool | getBaseCenter (Coord3D *pos) const |
| GameDifficulty | getAIDifficulty (void) const |
| Difficulty level for this player. | |
| void | setAIDifficulty (GameDifficulty difficulty) |
| void | buildBySupplies (Int minimumCash, const AsciiString &thingName) |
| Builds a building by supplies. | |
| void | buildSpecificBuildingNearestTeam (const AsciiString &thingName, const Team *team) |
| void | buildUpgrade (const AsciiString &upgrade) |
| void | aiPreTeamDestroy (const Team *team) |
| A team is about to be destroyed. | |
| Bool | isSupplySourceSafe (Int minSupplies) |
| Is the nearest supply source safe? | |
| Bool | isSupplySourceAttacked (void) |
| Is a supply source attacked? | |
| Bool | isLocationSafe (const Coord3D *pos, const ThingTemplate *tthing) |
| void | guardSupplyCenter (Team *team, Int minSupplies) |
| Have the team guard a supply center. | |
| void | setTeamDelaySeconds (Int delay) |
| Bool | calcClosestConstructionZoneLocation (const ThingTemplate *constructTemplate, Coord3D *location) |
| Calculates the closest construction zone location based on a template. | |
Public Member Functions inherited from MemoryPoolObject | |
| void | deleteInstance () |
Public Member Functions inherited from Snapshot | |
| Snapshot (void) | |
| ~Snapshot (void) | |
Protected Types | |
| enum | { MAX_STRUCTURES_TO_REPAIR = 2 } |
Protected Member Functions | |
| virtual void | crc (Xfer *xfer) |
| virtual void | xfer (Xfer *xfer) |
| virtual void | loadPostProcess (void) |
| virtual void | doBaseBuilding (void) |
| virtual void | checkReadyTeams (void) |
| virtual void | checkQueuedTeams (void) |
| virtual void | doTeamBuilding (void) |
| virtual void | doUpgradesAndSkills (void) |
| virtual Object * | findDozer (const Coord3D *pos) |
| virtual void | queueDozer (void) |
| virtual Bool | selectTeamToBuild (void) |
| determine the next team to build | |
| virtual Bool | selectTeamToReinforce (Int minPriority) |
| determine the next team to reinforce | |
| virtual Bool | startTraining (WorkOrder *order, Bool busyOK, AsciiString teamName) |
| find a production building that can handle the order, and start building | |
| virtual Bool | isAGoodIdeaToBuildTeam (TeamPrototype *proto) |
| return true if team should be built | |
| virtual void | processBaseBuilding (void) |
| do base-building behaviors | |
| virtual void | processTeamBuilding (void) |
| do team-building behaviors | |
| MAKE_DLINK_HEAD (TeamInQueue, TeamBuildQueue) | |
| List of teams being build. | |
| MAKE_DLINK_HEAD (TeamInQueue, TeamReadyQueue) | |
| List of teams built, waiting to reach rally point. | |
| Bool | isPossibleToBuildTeam (TeamPrototype *proto, Bool requireIdleFactory, Bool &needMoney) |
| return true if team can be considered for building | |
| Object * | buildStructureNow (const ThingTemplate *bldgPlan, BuildListInfo *info) |
| Build a base buiding. | |
| Object * | buildStructureWithDozer (const ThingTemplate *bldgPlan, BuildListInfo *info) |
| Build a base buiding. | |
| void | clearTeamsInQueue (void) |
| Delete all teams in the build queue. | |
| void | computeCenterAndRadiusOfBase (Coord3D *center, Real *radius) |
| Object * | findFactory (const ThingTemplate *thing, Bool busyOK) |
| Find a factory to build a unit. If force is true, may return a busy factory. | |
| void | queueUnits (void) |
| Check the team build list, & queue up units at any idle factories. | |
| void | checkForSupplyCenter (BuildListInfo *info, Object *bldg) |
| void | queueSupplyTruck (void) |
| void | updateBridgeRepair (void) |
| Bool | dozerInQueue (void) |
| Object * | findSupplyCenter (Int minSupplies) |
Protected Member Functions inherited from MemoryPoolObject | |
| virtual | ~MemoryPoolObject () |
| void * | operator new (size_t s) |
| void | operator delete (void *p) |
| virtual MemoryPool * | getObjectMemoryPool ()=0 |
Static Protected Member Functions | |
| static Int | getPlayerSuperweaponValue (Coord3D *center, Int playerNdx, Real radius, Bool includeMilitaryUnits=TRUE) |
| static void | getPlayerStructureBounds (Region2D *bounds, Int playerNdx, Bool conservative=FALSE) |
The computer-controlled opponent.
Definition at line 153 of file AIPlayer.h.
|
protected |
| Enumerator | |
|---|---|
| MAX_STRUCTURES_TO_REPAIR | |
Definition at line 286 of file AIPlayer.h.
| AIPlayer::AIPlayer | ( | Player * | p | ) |
constructor
Definition at line 77 of file AIPlayer.cpp.
| void AIPlayer::aiPreTeamDestroy | ( | const Team * | deletedTeam | ) |
A team is about to be destroyed.
A team is about to be destroyed
Definition at line 860 of file AIPlayer.cpp.
|
virtual |
Builds base defense on front or flank of base.
Build a base defense.
Reimplemented in AISkirmishPlayer.
Definition at line 2258 of file AIPlayer.cpp.
|
virtual |
Builds base defense on front or flank of base.
Build a base defense.
Reimplemented in AISkirmishPlayer.
Definition at line 2268 of file AIPlayer.cpp.
| void AIPlayer::buildBySupplies | ( | Int | minimumCash, |
| const AsciiString & | thingName ) |
Builds a building by supplies.
Build a supply center near a supply source with minimumCash or more resources.
Definition at line 1850 of file AIPlayer.cpp.
|
virtual |
Builds this building as soon as possible.
Build a specific team. If priorityBuild, put at front of queue with priority set.
Reimplemented in AISkirmishPlayer.
Definition at line 1740 of file AIPlayer.cpp.
|
virtual |
Builds this team immediately.
Build a specific team. If priorityBuild, put at front of queue with priority set.
Reimplemented in AISkirmishPlayer.
Definition at line 2413 of file AIPlayer.cpp.
| void AIPlayer::buildSpecificBuildingNearestTeam | ( | const AsciiString & | thingName, |
| const Team * | team ) |
Build a specific building nearest specified team.
Definition at line 2077 of file AIPlayer.cpp.
|
protected |
Build a base buiding.
Definition at line 454 of file AIPlayer.cpp.
|
protected |
Build a base buiding.
Definition at line 515 of file AIPlayer.cpp.
| void AIPlayer::buildUpgrade | ( | const AsciiString & | upgrade | ) |
| Bool AIPlayer::calcClosestConstructionZoneLocation | ( | const ThingTemplate * | constructTemplate, |
| Coord3D * | location ) |
Calculates the closest construction zone location based on a template.
Calculates the closest construction zone location based on a template.
Definition at line 1973 of file AIPlayer.cpp.
Reimplemented in AISkirmishPlayer.
Definition at line 189 of file AIPlayer.h.
|
protected |
See if the building is a supply center, and see how many supply trucks we want.
Definition at line 190 of file AIPlayer.cpp.
|
protectedvirtual |
See if any queued teams have finished building, or have run out of time.
Reimplemented in AISkirmishPlayer.
Definition at line 2834 of file AIPlayer.cpp.
|
protectedvirtual |
See if any ready teams have finished moving to the rally point.
Reimplemented in AISkirmishPlayer.
Definition at line 2753 of file AIPlayer.cpp.
|
protected |
Delete all teams in the build queue.
Clear the current work order
Definition at line 446 of file AIPlayer.cpp.
Find the center of the base and the radius of buildings.
Definition at line 3075 of file AIPlayer.cpp.
|
virtual |
Calculates best pos for weapon given radius.
Find a good spot to fire a superweapon.
Reimplemented in AISkirmishPlayer.
Definition at line 1144 of file AIPlayer.cpp.
|
protectedvirtual |
Implements Snapshot.
Reimplemented in AISkirmishPlayer.
Definition at line 3288 of file AIPlayer.cpp.
|
protectedvirtual |
See if it's time to build another base building.
Reimplemented in AISkirmishPlayer.
Definition at line 2723 of file AIPlayer.cpp.
|
protectedvirtual |
See if it is time to start another ai team building.
Reimplemented in AISkirmishPlayer.
Definition at line 2901 of file AIPlayer.cpp.
|
protectedvirtual |
See if it is time to start another upgrade or skill building.
Definition at line 2932 of file AIPlayer.cpp.
|
protected |
Checks to see if we're building a dozer.
Definition at line 3133 of file AIPlayer.cpp.
Finds a dozer that isn't building or collecting resources.
Reimplemented in AISkirmishPlayer.
Definition at line 3211 of file AIPlayer.cpp.
|
protected |
Find a factory to build a unit. If force is true, may return a busy factory.
Search the computer player's buildings for one that can build the given request. If busyOK is true, it will return a busy factory if there are no idle ones. This is used for script invoked teams "push" to the front of the queue.
Definition at line 1412 of file AIPlayer.cpp.
Find a supply center we haven't built a supply depot near yet.
Definition at line 2180 of file AIPlayer.cpp.
| enum GameDifficulty AIPlayer::getAIDifficulty | ( | void | ) | const |
Difficulty level for this player.
Difficulty level for this player
Definition at line 3201 of file AIPlayer.cpp.
|
inlinevirtual |
Solo AI attacks based on scripting. Only skirmish auto-acquires an enemy at this point. jba.
Reimplemented in AISkirmishPlayer.
Definition at line 188 of file AIPlayer.h.
Definition at line 195 of file AIPlayer.h.
|
staticprotected |
Get the bounds for a player's structure.
Definition at line 3785 of file AIPlayer.cpp.
|
staticprotected |
Get the target value for structures in an area.
Definition at line 1293 of file AIPlayer.cpp.
Have the team guard a supply center.
Guard supply center
Definition at line 891 of file AIPlayer.cpp.
|
protectedvirtual |
return true if team should be built
Check if this team is buildable, doesn't exceed maximum limits, meets conditions, and isn't under construction.
Reimplemented in AISkirmishPlayer.
Definition at line 1495 of file AIPlayer.cpp.
| Bool AIPlayer::isLocationSafe | ( | const Coord3D * | pos, |
| const ThingTemplate * | tthing ) |
Is this location safe for building this thing?
Definition at line 998 of file AIPlayer.cpp.
|
protected |
return true if team can be considered for building
Return true if team can be considered for building
Definition at line 1451 of file AIPlayer.cpp.
|
inlinevirtual |
Reimplemented in AISkirmishPlayer.
Definition at line 187 of file AIPlayer.h.
| Bool AIPlayer::isSupplySourceAttacked | ( | void | ) |
Is a supply source attacked?
Is a supply source attacked?
Definition at line 930 of file AIPlayer.cpp.
Is the nearest supply source safe?
Is the nearest supply source safe?
Definition at line 988 of file AIPlayer.cpp.
|
protectedvirtual |
Load post process
Implements Snapshot.
Reimplemented in AISkirmishPlayer.
Definition at line 3472 of file AIPlayer.cpp.
|
protected |
List of teams being build.
|
protected |
List of teams built, waiting to reach rally point.
|
virtual |
New map loaded call.
Find any things that build stuff & add them to the build list. Then build any initially built buildings.
Reimplemented in AISkirmishPlayer.
Definition at line 3034 of file AIPlayer.cpp.
Invoked when a structure I am building comes into existence.
Invoked when a structure I am building is finished building.
Definition at line 118 of file AIPlayer.cpp.
Invoked when a unit I am training comes into existence.
Invoked when a unit I am training comes into existence
Reimplemented in AISkirmishPlayer.
Definition at line 1048 of file AIPlayer.cpp.
|
protectedvirtual |
do base-building behaviors
Build our base.
Reimplemented in AISkirmishPlayer.
Definition at line 706 of file AIPlayer.cpp.
|
protectedvirtual |
do team-building behaviors
Train our teams.
Reimplemented in AISkirmishPlayer.
Definition at line 2644 of file AIPlayer.cpp.
|
protectedvirtual |
|
protected |
Queue up a supply truck to be built.
Definition at line 225 of file AIPlayer.cpp.
|
protected |
Check the team build list, & queue up units at any idle factories.
Definition at line 2654 of file AIPlayer.cpp.
|
virtual |
Builds this team immediately.
Recruit a specific team, within the specific radius of the home position.
Reimplemented in AISkirmishPlayer.
Definition at line 2540 of file AIPlayer.cpp.
|
virtual |
Repair a bridge or other structure.
Definition at line 2278 of file AIPlayer.cpp.
|
virtual |
select a skillset for the player.
Definition at line 2309 of file AIPlayer.cpp.
|
protectedvirtual |
determine the next team to build
Determine the next team to build. Return true if one was selected.
Reimplemented in AISkirmishPlayer.
Definition at line 1654 of file AIPlayer.cpp.
determine the next team to reinforce
See if any existing teams need reinforcements, and have higher priority.
Reimplemented in AISkirmishPlayer.
Definition at line 1537 of file AIPlayer.cpp.
|
inline |
Definition at line 198 of file AIPlayer.h.
|
inline |
Definition at line 214 of file AIPlayer.h.
|
protectedvirtual |
find a production building that can handle the order, and start building
Search the computer player's buildings for one that can build the given request and start training the unit. If busyOK is true, it will queue a unit even if one is building. This lets script invoked teams "push" to the front of the queue.
Reimplemented in AISkirmishPlayer.
Definition at line 1384 of file AIPlayer.cpp.
|
virtual |
simulates the behavior of a player
Perform computer-controlled player AI
Reimplemented in AISkirmishPlayer.
Definition at line 3011 of file AIPlayer.cpp.
|
protected |
Do per frame work (if any) repairing bridges.
Definition at line 2320 of file AIPlayer.cpp.
|
protectedvirtual |
Xfer method Version Info: 1: Initial version 2: added m_teamSeconds delay. 3: Added m_curWarehouseID. 1: Reset back to 1 with major save file changes.
Implements Snapshot.
Reimplemented in AISkirmishPlayer.
Definition at line 3302 of file AIPlayer.cpp.
|
protected |
Definition at line 296 of file AIPlayer.h.
|
protected |
Definition at line 281 of file AIPlayer.h.
|
protected |
Definition at line 282 of file AIPlayer.h.
|
protected |
Definition at line 283 of file AIPlayer.h.
|
protected |
Definition at line 293 of file AIPlayer.h.
|
protected |
Delay for building in case we are resource or prereq. limited.
Definition at line 272 of file AIPlayer.h.
|
protected |
Definition at line 298 of file AIPlayer.h.
|
protected |
Definition at line 277 of file AIPlayer.h.
|
protected |
the repair dozer is trying to repair the bridge.
Definition at line 292 of file AIPlayer.h.
|
protected |
Definition at line 291 of file AIPlayer.h.
|
protected |
When we built the last building.
Definition at line 275 of file AIPlayer.h.
|
protected |
the Player we represent
Definition at line 264 of file AIPlayer.h.
|
protected |
True if the buildDelay timer has expired.
Definition at line 267 of file AIPlayer.h.
|
protected |
True if the team select timer has expired.
Definition at line 266 of file AIPlayer.h.
|
protected |
Definition at line 288 of file AIPlayer.h.
|
protected |
Definition at line 289 of file AIPlayer.h.
|
protected |
Definition at line 279 of file AIPlayer.h.
|
protected |
Definition at line 290 of file AIPlayer.h.
|
protected |
Definition at line 287 of file AIPlayer.h.
|
protected |
Counts out the time between structures, as specified by ini.
Definition at line 269 of file AIPlayer.h.
|
protected |
Definition at line 295 of file AIPlayer.h.
|
protected |
Delay for teams in case we are resource or factory prereq. limited.
Definition at line 273 of file AIPlayer.h.
|
protected |
How many seconds to delay between teams.
Definition at line 270 of file AIPlayer.h.
|
protected |
Counts out the time between teams, as specified by ini.
Definition at line 268 of file AIPlayer.h.