Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
Team Class Reference

#include <Team.h>

Inherits MemoryPoolObject, and Snapshot.

Public Member Functions

 Team (TeamPrototype *proto, TeamID id)
 
const TeamPrototypegetPrototype (void)
 return the prototype used to create this team
 
void setID (TeamID id)
 
TeamID getID () const
 
void setAttackPriorityName (AsciiString name)
 
PlayergetControllingPlayer () const
 
void setControllingPlayer (Player *newController)
 
const AsciiStringgetState (void) const
 
void getTeamAsAIGroup (AIGroup *pAIGroup)
 
const AsciiStringgetName () const
 
Int getTargetableCount () const
 
void setState (const AsciiString &state)
 
void setRecruitable (Bool recruitable)
 
void setTeamTargetObject (const Object *target)
 
ObjectgetTeamTargetObject (void)
 
void setActive (void)
 
Bool isActive (void)
 
Bool isCreated (void)
 
void setEnteredExited (void)
 
Bool didEnterOrExit (void)
 
void updateState (void)
 
void notifyTeamOfObjectDeath (void)
 
Bool didAllEnter (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 All members entered the area.
 
Bool didPartialEnter (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 One member entered the area.
 
Bool didAllExit (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 All members exited the area.
 
Bool didPartialExit (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 One member exited the area.
 
Bool allInside (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 All members are inside the area.
 
Bool someInsideSomeOutside (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 One or more in, one or more out.
 
Bool noneInside (PolygonTrigger *pTrigger, UnsignedInt whichToConsider) const
 No members are in the area.
 
ObjecttryToRecruit (const ThingTemplate *, const Coord3D *teamHome, Real maxDist)
 Try to recruit the closest unit of this thing type. Return true if successful.
 
Relationship getRelationship (const Team *that) const
 
void setOverrideTeamRelationship (TeamID teamID, Relationship r)
 
Bool removeOverrideTeamRelationship (TeamID teamID)
 
void setOverridePlayerRelationship (Int playerIndex, Relationship r)
 
Bool removeOverridePlayerRelationship (Int playerIndex)
 
void countObjectsByThingTemplate (Int numTmplates, const ThingTemplate *const *things, Bool ignoreDead, Int *counts, Bool ignoreUnderConstruction=TRUE) const
 
Int countBuildings (void)
 
Int countObjects (KindOfMaskType setMask, KindOfMaskType clearMask)
 
void healAllObjects ()
 
void iterateObjects (ObjectIterateFunc func, void *userData)
 
Bool hasAnyBuildings (void) const
 
Bool hasAnyBuildings (KindOfMaskType kindOf) const
 
Bool hasAnyUnits (void) const
 
Bool hasAnyObjects (void) const
 
Bool isIdle (void) const
 
Bool unitsEntered (PolygonTrigger *pTrigger) const
 
Bool hasAnyBuildFacility (void) const
 
void moveTeamTo (Coord3D destination)
 
Bool damageTeamMembers (Real amount)
 
void deleteTeam (Bool ignoreDead=FALSE)
 
const Coord3DgetEstimateTeamPosition (void) const
 
void transferUnitsTo (Team *newTeam)
 
void killTeam (void)
 
void evacuateTeam (void)
 
const WaypointgetCurrentWaypoint (void)
 
void setCurrentWaypoint (const Waypoint *way)
 
void updateGenericScripts (void)
 
- Public Member Functions inherited from MemoryPoolObject
void deleteInstance ()
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Protected Member Functions

virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess (void)
 
- Protected Member Functions inherited from MemoryPoolObject
virtual ~MemoryPoolObject ()
 
void * operator new (size_t s)
 
void operator delete (void *p)
 
virtual MemoryPoolgetObjectMemoryPool ()=0
 

Detailed Description

Definition at line 181 of file Team.h.

Constructor & Destructor Documentation

◆ Team()

Team::Team ( TeamPrototype * proto,
TeamID id )

Definition at line 1312 of file Team.cpp.

Member Function Documentation

◆ allInside()

Bool Team::allInside ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

All members are inside the area.

Definition at line 2103 of file Team.cpp.

◆ countBuildings()

Int Team::countBuildings ( void )

returns the number of buildings on this team, by checking each things' template kindof against KINDOF_STRUCTURE

Definition at line 1644 of file Team.cpp.

◆ countObjects()

Int Team::countObjects ( KindOfMaskType setMask,
KindOfMaskType clearMask )

simply returns the number of objects on this team with a specific KindOfMaskType

Definition at line 1660 of file Team.cpp.

◆ countObjectsByThingTemplate()

void Team::countObjectsByThingTemplate ( Int numTmplates,
const ThingTemplate *const * things,
Bool ignoreDead,
Int * counts,
Bool ignoreUnderConstruction = TRUE ) const

a convenience routine to count the number of owned objects that match a set of ThingTemplates. You input the count and an array of ThingTemplate*, and provide an array of Int of the same size. It fills in the array to the correct counts. This is handy because we must traverse the team's list-of-objects only once.

Definition at line 1617 of file Team.cpp.

◆ crc()

void Team::crc ( Xfer * xfer)
protectedvirtual

CRC

Implements Snapshot.

Definition at line 2561 of file Team.cpp.

◆ damageTeamMembers()

Bool Team::damageTeamMembers ( Real amount)

a convenience routine to quickly destroy a team.

Definition at line 2475 of file Team.cpp.

◆ deleteTeam()

void Team::deleteTeam ( Bool ignoreDead = FALSE)

a convenience routine to destroy this team. The team goes through all shutdown stuff. Note that this doesn't actually call deleteInstance, the team will actually be deleted on the next update, if it is a deletable team. IgnoreDead lets you not delete people who are dying anyway. Needed for scripts.

Definition at line 2247 of file Team.cpp.

◆ didAllEnter()

Bool Team::didAllEnter ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

All members entered the area.

Definition at line 1938 of file Team.cpp.

◆ didAllExit()

Bool Team::didAllExit ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

All members exited the area.

Definition at line 2056 of file Team.cpp.

◆ didEnterOrExit()

Bool Team::didEnterOrExit ( void )
inline

Did a team member enter or exit a trigger area.

Definition at line 332 of file Team.h.

◆ didPartialEnter()

Bool Team::didPartialEnter ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

One member entered the area.

Definition at line 1984 of file Team.cpp.

◆ didPartialExit()

Bool Team::didPartialExit ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

One member exited the area.

Definition at line 2020 of file Team.cpp.

◆ evacuateTeam()

void Team::evacuateTeam ( void )

a function to make all containers on a team to dump contents

Definition at line 2403 of file Team.cpp.

◆ getControllingPlayer()

Player * Team::getControllingPlayer ( ) const

return the player currently controlling this team (backtracking up if necessary)

Definition at line 1397 of file Team.cpp.

◆ getCurrentWaypoint()

const Waypoint * Team::getCurrentWaypoint ( void )
inline

the current waypoint for a team following a waypoint path.

Definition at line 497 of file Team.h.

◆ getEstimateTeamPosition()

const Coord3D * Team::getEstimateTeamPosition ( void ) const

a convenience routine used to estimate the team's position by just returning the position of the first member of the team

Definition at line 2230 of file Team.cpp.

◆ getID()

TeamID Team::getID ( ) const
inline

Definition at line 252 of file Team.h.

◆ getName()

const AsciiString & Team::getName ( void ) const
inline

Get the team's state

Definition at line 751 of file Team.h.

◆ getPrototype()

const TeamPrototype * Team::getPrototype ( void )
inline

return the prototype used to create this team

Definition at line 249 of file Team.h.

◆ getRelationship()

Relationship Team::getRelationship ( const Team * that) const

return our relationship with the other team. this is done as follows:

– if there's a TeamRelationship between this team and that team, return it. – otherwise, we use the relationship between our players.

Definition at line 1471 of file Team.cpp.

◆ getState()

const AsciiString & Team::getState ( void ) const
inline

Get the team's state

Definition at line 272 of file Team.h.

◆ getTargetableCount()

Int Team::getTargetableCount ( ) const

Get the count of live things that are either alive or are buildings.

Definition at line 1451 of file Team.cpp.

◆ getTeamAsAIGroup()

void Team::getTeamAsAIGroup ( AIGroup * pAIGroup)

fill pAIGroup (which must be NONNULL) with the members of this team as a Group.

Definition at line 1433 of file Team.cpp.

◆ getTeamTargetObject()

Object * Team::getTeamTargetObject ( void )

Set the team's target object.

Definition at line 1518 of file Team.cpp.

◆ hasAnyBuildFacility()

Bool Team::hasAnyBuildFacility ( void ) const

a convenience routine to quickly check if any buildfacilities are owned.

Definition at line 2517 of file Team.cpp.

◆ hasAnyBuildings() [1/2]

Bool Team::hasAnyBuildings ( KindOfMaskType kindOf) const

a convenience routine to quickly check if any buildings with a specific KindOfType flag are owned.

Definition at line 1711 of file Team.cpp.

◆ hasAnyBuildings() [2/2]

Bool Team::hasAnyBuildings ( void ) const

a convenience routine to quickly check if any buildings are owned.

Definition at line 1694 of file Team.cpp.

◆ hasAnyObjects()

Bool Team::hasAnyObjects ( void ) const

a convenience routine to quickly check if any objects are owned.

Definition at line 1775 of file Team.cpp.

◆ hasAnyUnits()

Bool Team::hasAnyUnits ( void ) const

a convenience routine to quickly check if any units are owned.

Definition at line 1729 of file Team.cpp.

◆ healAllObjects()

void Team::healAllObjects ( void )

This Team will heal all its members

Definition at line 1676 of file Team.cpp.

◆ isActive()

Bool Team::isActive ( void )
inline

Is this team active?

Definition at line 317 of file Team.h.

◆ isCreated()

Bool Team::isCreated ( void )
inline

Is this team just createc? (stays true one logic frame.)

Definition at line 322 of file Team.h.

◆ isIdle()

Bool Team::isIdle ( void ) const

a convenience routine to quickly check if all the units are idle.

Definition at line 1754 of file Team.cpp.

◆ iterateObjects()

void Team::iterateObjects ( ObjectIterateFunc func,
void * userData )

Iterate all members of the team

Definition at line 1685 of file Team.cpp.

◆ killTeam()

void Team::killTeam ( void )

a function to kill all members of a team

Definition at line 2438 of file Team.cpp.

◆ loadPostProcess()

void Team::loadPostProcess ( void )
protectedvirtual

Load post process

Implements Snapshot.

Definition at line 2703 of file Team.cpp.

◆ moveTeamTo()

void Team::moveTeamTo ( Coord3D destination)

Move team to destination.

Todo
This should give a "team move" command, not individual move orders (MSB)

Definition at line 2504 of file Team.cpp.

◆ noneInside()

Bool Team::noneInside ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

No members are in the area.

Definition at line 2147 of file Team.cpp.

◆ notifyTeamOfObjectDeath()

void Team::notifyTeamOfObjectDeath ( void )

Definition at line 1923 of file Team.cpp.

◆ removeOverridePlayerRelationship()

Bool Team::removeOverridePlayerRelationship ( Int playerIndex)

remove the special relation (if any) between this and that. remove all special relations for 'this' if that==null. return true if anything removed.

Definition at line 1594 of file Team.cpp.

◆ removeOverrideTeamRelationship()

Bool Team::removeOverrideTeamRelationship ( TeamID teamID)

remove the special relation (if any) between this and that. remove all special relations for 'this' if that==null. return true if anything removed.

Definition at line 1561 of file Team.cpp.

◆ setActive()

void Team::setActive ( void )
inline

Set the team as active. A team is considered created when set active.

Definition at line 312 of file Team.h.

◆ setAttackPriorityName()

void Team::setAttackPriorityName ( AsciiString name)

Set the attack priority name for a team.

Definition at line 1427 of file Team.cpp.

◆ setControllingPlayer()

void Team::setControllingPlayer ( Player * newController)

set the team's owner. (NULL is not allowed)

Definition at line 1403 of file Team.cpp.

◆ setCurrentWaypoint()

void Team::setCurrentWaypoint ( const Waypoint * way)
inline

Definition at line 498 of file Team.h.

◆ setEnteredExited()

void Team::setEnteredExited ( void )
inline

Note that a team member entered or exited a trigger area.

Definition at line 327 of file Team.h.

◆ setID()

void Team::setID ( TeamID id)
inline

Definition at line 251 of file Team.h.

◆ setOverridePlayerRelationship()

void Team::setOverridePlayerRelationship ( Int playerIndex,
Relationship r )

set a special relationship between this team and that Player, that overrides the one between our Players. (note that this doesn't imply anything about the relation of that to this.) Note that override-team relationships take precedence over override-player relationships.

Definition at line 1584 of file Team.cpp.

◆ setOverrideTeamRelationship()

void Team::setOverrideTeamRelationship ( TeamID teamID,
Relationship r )

set a special relationship between this team and that team, that overrides the one between our Players. (note that this doesn't imply anything about the relation of that to this.)

Definition at line 1551 of file Team.cpp.

◆ setRecruitable()

void Team::setRecruitable ( Bool recruitable)
inline

Set the team's AI recruitablity.

Definition at line 297 of file Team.h.

◆ setState()

void Team::setState ( const AsciiString & state)
inline

Set the team's AI state.

Definition at line 292 of file Team.h.

◆ setTeamTargetObject()

void Team::setTeamTargetObject ( const Object * target)

Set the team's target object.

Definition at line 1502 of file Team.cpp.

◆ someInsideSomeOutside()

Bool Team::someInsideSomeOutside ( PolygonTrigger * pTrigger,
UnsignedInt whichToConsider ) const

One or more in, one or more out.

Definition at line 2187 of file Team.cpp.

◆ transferUnitsTo()

void Team::transferUnitsTo ( Team * newTeam)

a convenience routine to move a team's units to another team.

Definition at line 2308 of file Team.cpp.

◆ tryToRecruit()

Object * Team::tryToRecruit ( const ThingTemplate * tTemplate,
const Coord3D * teamHome,
Real maxDist )

Try to recruit the closest unit of this thing type. Return true if successful.

Definition at line 2336 of file Team.cpp.

◆ unitsEntered()

Bool Team::unitsEntered ( PolygonTrigger * pTrigger) const

a convenience routine to quickly check if any objects are in a trigger area.

◆ updateGenericScripts()

void Team::updateGenericScripts ( void )

Update the generic scripts, allow them to see if they should run, etc.

Definition at line 2530 of file Team.cpp.

◆ updateState()

void Team::updateState ( void )

Clear the flag that a team member entered or exited a trigger area. Also checks and executes any onCreate scripts, and clears the created flag.

Clears m_enteredExited, checks & clears m_created.

Definition at line 1807 of file Team.cpp.

◆ xfer()

void Team::xfer ( Xfer * xfer)
protectedvirtual

Xfer Method Version Info: 1: Initial version

Implements Snapshot.

Definition at line 2571 of file Team.cpp.


The documentation for this class was generated from the following files: