![]() |
VR-Forces Developer's Guide
|
Classes | |
| struct | DerivedOffsets |
Protected Types | |
| typedef boost::shared_ptr < const DtFormationRecord > | SharedFormationRecord |
Protected Member Functions | |
| virtual const DtFormationRecord * | lookupFormationRecord (int promotionId) const |
| virtual DtVector | lookupFollowOffset (const DtUUID &subordinate) const |
| virtual DtUUID | lookupLeaderOfEntity (const DtUUID &subordinate) const |
| virtual void | rebuildEntityToPositionInUnitMap () |
| virtual const DtFormationRecord * | generateAdditionalFormationRecord (int promotionId) const |
| void | emptyFormationIndexToFormationRecordMap () |
| virtual void | createFormationRecords (const DtFormation &formation) |
| virtual void | resetFormationMap () |
Protected Attributes | |
| DtFormation | myFormation |
| double | myCurrentFormationSpacing |
| std::vector < DtFormationStateCallbackInfo > | myFormationStateChangedCallbackList |
| bool | myCallbacksAreEnabled |
| bool | myModified = false |
Formation Data Indexed by Formation Promotion ID. | |
"FormPromId" is the promotion ID for the formation, i.e. from the data in the formation parameters (not necessarily the subordinate entity's rank in the unit, although for the default unit configuration these are the same). | |
| std::map< int, SharedFormationRecord > | myFormPromIdToFormationRecordMap |
| std::map< DtUUID, DerivedOffsets > | myEntityToDerivedOffsetsMap |
| std::map< int, DtUUID > | myFormPromIdToEntityMap |
| std::map< DtUUID, int > | myEntityToFormPromIdMap |
|
protected |
| DtFormationState::DtFormationState | ( | ) |
| DtFormationState::DtFormationState | ( | const DtFormationState & | orig | ) |
|
virtual |
| DtFormationState& DtFormationState::operator= | ( | const DtFormationState & | orig | ) |
|
virtual |
Sets a new formation in the formation state. This sets myFormation and calls resetFormationMap so that all of the offset data for the current set of subordinates are recomputed. The promotion IDs assignment to subordinates remains the same.
|
virtual |
Sets the entity-to-promotion ID maps. If the biggest promotion ID is > the size of myFormation, then myFormation is expanded using default offsets. The intent is for the caller to also set the formation, with the right number of entries. Returns true if all goes well, and false if the data was invalid.
| entityList | is a list of subordinates, in any order. |
| promotionIds | is a list of promotion IDs that correspond to the entities in entityList. The two lists must be the same size. |
|
virtual |
Sets the entire formation state.
| entityList | is a list of the subordinates that can currently be moved in formation, i.e. pass the DtFormationableSubordinatePredicate filter. |
| formationIndices | is a list of indices corresponding to the entities in the entityList – the two vectors must be the same size. formationPosition[i] indicates the "unit index" of the subordinate, i.e. the rank order of the subordinate in the unit definition. For a unit that has not been reorganized, this will be the same as the "designator" - 1. (See subordinateManager.) The values in formationPosition do not have to be consecutive, and may skip values if subordinates are missing because of destruction, external tasking, etc. |
| doAutoPromote,if | true, causes the n entities in the list to use the formation slots that have the first n formation promotion IDs. |
|
virtual |
Get the formation query data for a single entity.
|
virtual |
|
virtual |
Returns formation state associated with each entity in formation. It is up to the caller to delete the memory associated with each DtFormationQueryResult item returned in the vector.
|
virtual |
Provides a list of the entities currently in the formation.
|
virtual |
Returns the entity with the lowest formation promotion ID among the current subordinates.
|
virtual |
Returns the half-length of the formation.
|
virtual |
Returns an extent in the body coordinates of the unit, centered on the unit center of mass.
|
virtual |
For debugging.
|
virtual |
Registers callback for notification of any change to the formation state.
|
virtual |
Removes callback for notification of any change to the formation state.
|
virtual |
Control whether or not formation callbacks are invoked. By default, they are enabled. Only the DtFormationController should ever call these functions.
|
virtual |
|
virtual |
Clears all information out of the state except myFormation. Thus a new state can be built be calling assign... without setting the formation.
| void DtFormationState::markModified | ( | ) |
| void DtFormationState::clearModified | ( | ) |
|
inline |
|
virtual |
Call the registered callbacks.
|
protectedvirtual |
Looks up the record for this promotion ID. If not found, returns NULL.
|
protectedvirtual |
Gets the offset relative to the entity's leader entity. If this entity is not in the formation, returns (0,0,0).
|
protectedvirtual |
Returns the leader of the given subordinate. If either is not found int the formation, returns a nullUUID.
|
protectedvirtual |
Computes the positions of the subordinate entities relative to the unit center (instead of relative to their immediate leader) and current formation leader. Saved in myEntityToDerivedOffsetsMap and myFormationLeader. This information is returned as part of a DtFormationQueryResult.
|
protectedvirtual |
Gets the formationRecord associated with the given formation order index. Returns a new instance of a DtFormationRecord. It is up to the caller to delete the memory associated with the record. //! TODO – remove.
|
protected |
Deletes all DtFormationRecord entries in myPositionIndexToFormationRecordMap and clears out all entries from map.
|
protectedvirtual |
Rebuilds myFormPromIdToFormationRecordMap to include the formation info corresponding to the formationEntries with promotion IDs in the myEntityToFormPromIdMap. Computes unit center given the entries in myEntityToFormPromIdMap; then for each record computes the formation leader offset and the unit offset.
|
protectedvirtual |
Calls createFormationRecords with myFormation as the argument.
|
protected |
This is the current formation definition for the formation state. This is a copy of a formation obtained from entity params. It may be expanded for additional subordinates if there are more than the number of formation positions defined in the params. Having a DtFormation allows the FormationState to get information using the DtFormation member functions.
|
mutableprotected |
Formation records hold the definition of the formation slots. The map key, FormPromId, is the promotion index in the formation defintion; 0 is the formation leader. This information is a duplicate of what is in myFormation, but it is organized in a map for easy access by promotion ID rather than being in a list. Mutable: to allow change in lookupFormationRecord.
|
protected |
Formation records hold the definition of the formation slots. The map key, FormPromId, is the promotion index in the formation defintion; 0 is the formation leader. This information is a duplicate of what is in myFormation, but it is organized in a map for easy access by promotion ID rather than being in a list. Mutable: to allow change in lookupFormationRecord.
Maps between the subordinate entity and its formation promotion ID in the current formation.
Formation records hold the definition of the formation slots. The map key, FormPromId, is the promotion index in the formation defintion; 0 is the formation leader. This information is a duplicate of what is in myFormation, but it is organized in a map for easy access by promotion ID rather than being in a list. Mutable: to allow change in lookupFormationRecord.
|
protected |
The current spacing of the formation. This is the space between the positions of promotion ID 0 and its closest follower. 0.0 means to use the default formation spacing. Otherwise the minimum value in 1.0.
|
protected |
List of DtFormationStateCallbackFcns. Clients register callback functions on this list for notification when the formation state has changed for some reason.
|
protected |
|
protected |