#include <PartitionManager.h>
Inherits SubsystemInterface, and Snapshot.
Public Member Functions | |
| PartitionManager (void) | |
| virtual | ~PartitionManager (void) |
| virtual void | init (void) |
| initialize | |
| virtual void | reset (void) |
| system reset | |
| virtual void | update (void) |
| system update | |
| void | crc (Xfer *xfer) |
| void | xfer (Xfer *xfer) |
| void | loadPostProcess (void) |
| Bool | getUpdatedSinceLastReset (void) const |
| void | registerObject (Object *object) |
| add thing to system | |
| void | unRegisterObject (Object *object) |
| remove thing from system | |
| void | registerGhostObject (GhostObject *object) |
| recreate partition data needed to hold object (only used to restore after PM reset). | |
| void | unRegisterGhostObject (GhostObject *object) |
| release partition data held for ghost object. | |
| void | processEntirePendingUndoShroudRevealQueue () |
| process every pending one regardless of timestamp | |
| Int | getCellCountX () |
| return the number of PartitionCells in the x-dimension. | |
| Int | getCellCountY () |
| return the number of PartitionCells in the y-dimension. | |
| PartitionCell * | getCellAt (Int x, Int y) |
| return the PartitionCell located at cell coordinates (x,y). | |
| const PartitionCell * | getCellAt (Int x, Int y) const |
| void | doShroudReveal (Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) |
| A convenience funtion to reveal shroud at some location. | |
| void | undoShroudReveal (Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) |
| void | queueUndoShroudReveal (Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) |
| void | doShroudCover (Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) |
| void | undoShroudCover (Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) |
| void | doThreatAffect (Real centerX, Real centerY, Real radius, UnsignedInt threatVal, PlayerMaskType playerMask) |
| Perform threat map and value map updates. | |
| void | undoThreatAffect (Real centerX, Real centerY, Real radius, UnsignedInt threatVal, PlayerMaskType playerMask) |
| void | doValueAffect (Real centerX, Real centerY, Real radius, UnsignedInt valueVal, PlayerMaskType playerMask) |
| void | undoValueAffect (Real centerX, Real centerY, Real radius, UnsignedInt valueVal, PlayerMaskType playerMask) |
| void | getCellCenterPos (Int x, Int y, Real &xx, Real &yy) |
| void | worldToCell (Real wx, Real wy, Int *cx, Int *cy) |
| Int | worldToCellDist (Real w) |
| Object * | getClosestObject (const Object *obj, Real maxDist, DistanceCalculationType dc, PartitionFilter **filters=NULL, Real *closestDist=NULL, Coord3D *closestDistVec=NULL) |
| Object * | getClosestObject (const Coord3D *pos, Real maxDist, DistanceCalculationType dc, PartitionFilter **filters=NULL, Real *closestDist=NULL, Coord3D *closestDistVec=NULL) |
| Real | getRelativeAngle2D (const Object *obj, const Object *otherObj) |
| Real | getRelativeAngle2D (const Object *obj, const Coord3D *pos) |
| void | getVectorTo (const Object *obj, const Object *otherObj, DistanceCalculationType dc, Coord3D &vec) |
| void | getVectorTo (const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D &vec) |
| Real | getDistanceSquared (const Object *obj, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec=NULL) |
| Real | getDistanceSquared (const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D *vec=NULL) |
| Real | getGoalDistanceSquared (const Object *obj, const Coord3D *goalPos, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec=NULL) |
| Real | getGoalDistanceSquared (const Object *obj, const Coord3D *goalPos, const Coord3D *otherPos, DistanceCalculationType dc, Coord3D *vec=NULL) |
| Bool | estimateTerrainExtremesAlongLine (const Coord3D &startWorld, const Coord3D &endWorld, Real *minZ, Real *maxZ, Coord2D *minZPos, Coord2D *maxZPos) |
| SimpleObjectIterator * | iterateObjectsInRange (const Object *obj, Real maxDist, DistanceCalculationType dc, PartitionFilter **filters=NULL, IterOrderType order=ITER_FASTEST) |
| SimpleObjectIterator * | iterateObjectsInRange (const Coord3D *pos, Real maxDist, DistanceCalculationType dc, PartitionFilter **filters=NULL, IterOrderType order=ITER_FASTEST) |
| SimpleObjectIterator * | iterateAllObjects (PartitionFilter **filters=NULL) |
| SimpleObjectIterator * | iteratePotentialCollisions (const Coord3D *pos, const GeometryInfo &geom, Real angle, Bool use2D=false) |
| Bool | isColliding (const Object *a, const Object *b) const |
| Bool | geomCollidesWithGeom (const Coord3D *pos1, const GeometryInfo &geom1, Real angle1, const Coord3D *pos2, const GeometryInfo &geom2, Real angle2) const |
| Checks a geometry against an arbitrary geometry. | |
| Bool | findPositionAround (const Coord3D *center, const FindPositionOptions *options, Coord3D *result) |
| finding legal positions in the world | |
| Real | getCellSize () |
| return the size of a PartitionCell, in world coords. | |
| Real | getCellSizeInv () |
| return (1.0 / getCellSize); this is used frequently, so we cache it for efficiency | |
| Bool | isClearLineOfSightTerrain (const Object *obj, const Coord3D &objPos, const Object *other, const Coord3D &otherPos) |
| Bool | isInListDirtyModules (PartitionData *o) const |
| void | prependToDirtyModules (PartitionData *o) |
| void | removeFromDirtyModules (PartitionData *o) |
| void | removeAllDirtyModules () |
| void | revealMapForPlayer (Int playerIndex) |
| void | revealMapForPlayerPermanently (Int playerIndex) |
| void | undoRevealMapForPlayerPermanently (Int playerIndex) |
| void | shroudMapForPlayer (Int playerIndex) |
| void | refreshShroudForLocalPlayer () |
| CellShroudStatus | getShroudStatusForPlayer (Int playerIndex, Int x, Int y) const |
| CellShroudStatus | getShroudStatusForPlayer (Int playerIndex, const Coord3D *loc) const |
| ObjectShroudStatus | getPropShroudStatusForPlayer (Int playerIndex, const Coord3D *loc) const |
| Real | getGroundOrStructureHeight (Real posx, Real posy) |
| void | getMostValuableLocation (Int playerIndex, UnsignedInt whichPlayerTypes, ValueOrThreat valType, Coord3D *outLocation) |
| void | getNearestGroupWithValue (Int playerIndex, UnsignedInt whichPlayerTypes, ValueOrThreat valType, const Coord3D *sourceLocation, Int valueRequired, Bool greaterThan, Coord3D *outLocation) |
| void | storeFoggedCells (ShroudStatusStoreRestore &outPartitionStore, Bool storeToFog) const |
| void | restoreFoggedCells (const ShroudStatusStoreRestore &inPartitionStore, Bool restoreToFog) |
Public Member Functions inherited from SubsystemInterface | |
| SubsystemInterface () | |
| virtual | ~SubsystemInterface () |
| virtual void | postProcessLoad () |
| virtual void | draw (void) |
| void | UPDATE (void) |
| void | DRAW (void) |
| AsciiString | getName (void) |
| void | setName (AsciiString name) |
Public Member Functions inherited from Snapshot | |
| Snapshot (void) | |
| ~Snapshot (void) | |
Protected Types | |
| typedef Int(* | CellAlongLineProc) (PartitionCell *cell, void *userData) |
| typedef Int(* | CellBreadthFirstProc) (PartitionCell *cell, void *userData) |
Protected Member Functions | |
| Object * | getClosestObjects (const Object *obj, const Coord3D *pos, Real maxDist, DistanceCalculationType dc, PartitionFilter **filters, SimpleObjectIterator *iter, Real *closestDistArg, Coord3D *closestVecArg) |
| void | shutdown (void) |
| Bool | tryPosition (const Coord3D *center, Real dist, Real angle, const FindPositionOptions *options, Coord3D *result) |
| used to validate the positions for findPositionAround family of methods | |
| Int | iterateCellsAlongLine (const Coord3D &pos, const Coord3D &posOther, CellAlongLineProc proc, void *userData) |
| Int | iterateCellsBreadthFirst (const Coord3D *pos, CellBreadthFirstProc proc, void *userData) |
| Int | calcMinRadius (const ICoord2D &cur) |
| void | calcRadiusVec () |
| void | processPendingUndoShroudRevealQueue (Bool considerTimestamp=TRUE) |
| keep popping and processing untill you get to one that is in the future | |
| void | resetPendingUndoShroudRevealQueue () |
| Just delete everything in the queue without doing anything with them. | |
Friends | |
| void | hLineAddLooker (Int x1, Int x2, Int y, void *playerIndex) |
| void | hLineRemoveLooker (Int x1, Int x2, Int y, void *playerIndex) |
| void | hLineAddShrouder (Int x1, Int x2, Int y, void *playerIndex) |
| void | hLineRemoveShrouder (Int x1, Int x2, Int y, void *playerIndex) |
| void | hLineAddThreat (Int x1, Int x2, Int y, void *threatValueParms) |
| void | hLineRemoveThreat (Int x1, Int x2, Int y, void *threatValueParms) |
| void | hLineAddValue (Int x1, Int x2, Int y, void *threatValueParms) |
| void | hLineRemoveValue (Int x1, Int x2, Int y, void *threatValueParms) |
Additional Inherited Members | |
Protected Attributes inherited from SubsystemInterface | |
| AsciiString | m_name |
PartitionManager is the singleton class that manages the entire partition/collision system. It maintains the set of PartitionCells that correspond to the world system, and updates the PartitionDatas as needed during update phase.
Definition at line 1231 of file PartitionManager.h.
|
protected |
Definition at line 1283 of file PartitionManager.h.
|
protected |
Definition at line 1289 of file PartitionManager.h.
| PartitionManager::PartitionManager | ( | void | ) |
Definition at line 2547 of file PartitionManager.cpp.
|
virtual |
Definition at line 2565 of file PartitionManager.cpp.
|
protected |
|
virtual |
| void PartitionManager::doShroudCover | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4073 of file PartitionManager.cpp.
| void PartitionManager::doShroudReveal | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| PlayerMaskType | playerMask ) |
A convenience funtion to reveal shroud at some location.
Definition at line 3969 of file PartitionManager.cpp.
| void PartitionManager::doThreatAffect | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| UnsignedInt | threatVal, | ||
| PlayerMaskType | playerMask ) |
Perform threat map and value map updates.
Definition at line 4119 of file PartitionManager.cpp.
| void PartitionManager::doValueAffect | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| UnsignedInt | valueVal, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4185 of file PartitionManager.cpp.
| Bool PartitionManager::estimateTerrainExtremesAlongLine | ( | const Coord3D & | startWorld, |
| const Coord3D & | endWorld, | ||
| Real * | minZ, | ||
| Real * | maxZ, | ||
| Coord2D * | minZPos, | ||
| Coord2D * | maxZPos ) |
| Bool PartitionManager::findPositionAround | ( | const Coord3D * | center, |
| const FindPositionOptions * | options, | ||
| Coord3D * | result ) |
finding legal positions in the world
This method will attempt to find a legal postion from the center position specified, at least minRadis away from it, but no more than maxRadius away.
Return TRUE if position is found and that position is returned in 'result' return FALSE no legal position exists or invalid params
Definition at line 3887 of file PartitionManager.cpp.
| Bool PartitionManager::geomCollidesWithGeom | ( | const Coord3D * | pos1, |
| const GeometryInfo & | geom1, | ||
| Real | angle1, | ||
| const Coord3D * | pos2, | ||
| const GeometryInfo & | geom2, | ||
| Real | angle2 ) const |
Checks a geometry against an arbitrary geometry.
Definition at line 1996 of file PartitionManager.cpp.
|
inline |
return the PartitionCell located at cell coordinates (x,y).
Definition at line 1551 of file PartitionManager.h.
|
inline |
Definition at line 1557 of file PartitionManager.h.
Definition at line 4251 of file PartitionManager.cpp.
|
inline |
return the number of PartitionCells in the x-dimension.
Definition at line 1338 of file PartitionManager.h.
|
inline |
return the number of PartitionCells in the y-dimension.
Definition at line 1341 of file PartitionManager.h.
|
inline |
return the size of a PartitionCell, in world coords.
Definition at line 1458 of file PartitionManager.h.
|
inline |
return (1.0 / getCellSize); this is used frequently, so we cache it for efficiency
Definition at line 1461 of file PartitionManager.h.
| Object * PartitionManager::getClosestObject | ( | const Coord3D * | pos, |
| Real | maxDist, | ||
| DistanceCalculationType | dc, | ||
| PartitionFilter ** | filters = NULL, | ||
| Real * | closestDist = NULL, | ||
| Coord3D * | closestDistVec = NULL ) |
Definition at line 3463 of file PartitionManager.cpp.
| Object * PartitionManager::getClosestObject | ( | const Object * | obj, |
| Real | maxDist, | ||
| DistanceCalculationType | dc, | ||
| PartitionFilter ** | filters = NULL, | ||
| Real * | closestDist = NULL, | ||
| Coord3D * | closestDistVec = NULL ) |
Definition at line 3450 of file PartitionManager.cpp.
|
protected |
This is an internal function that is used to implement the public getClosestObject and iterateObjects calls.
Definition at line 3204 of file PartitionManager.cpp.
| Real PartitionManager::getDistanceSquared | ( | const Object * | obj, |
| const Coord3D * | pos, | ||
| DistanceCalculationType | dc, | ||
| Coord3D * | vec = NULL ) |
Definition at line 3504 of file PartitionManager.cpp.
| Real PartitionManager::getDistanceSquared | ( | const Object * | obj, |
| const Object * | otherObj, | ||
| DistanceCalculationType | dc, | ||
| Coord3D * | vec = NULL ) |
Definition at line 3492 of file PartitionManager.cpp.
| Real PartitionManager::getGoalDistanceSquared | ( | const Object * | obj, |
| const Coord3D * | goalPos, | ||
| const Coord3D * | otherPos, | ||
| DistanceCalculationType | dc, | ||
| Coord3D * | vec = NULL ) |
Definition at line 3530 of file PartitionManager.cpp.
| Real PartitionManager::getGoalDistanceSquared | ( | const Object * | obj, |
| const Coord3D * | goalPos, | ||
| const Object * | otherObj, | ||
| DistanceCalculationType | dc, | ||
| Coord3D * | vec = NULL ) |
Definition at line 3517 of file PartitionManager.cpp.
Definition at line 4706 of file PartitionManager.cpp.
| void PartitionManager::getMostValuableLocation | ( | Int | playerIndex, |
| UnsignedInt | whichPlayerTypes, | ||
| ValueOrThreat | valType, | ||
| Coord3D * | outLocation ) |
Definition at line 4737 of file PartitionManager.cpp.
| void PartitionManager::getNearestGroupWithValue | ( | Int | playerIndex, |
| UnsignedInt | whichPlayerTypes, | ||
| ValueOrThreat | valType, | ||
| const Coord3D * | sourceLocation, | ||
| Int | valueRequired, | ||
| Bool | greaterThan, | ||
| Coord3D * | outLocation ) |
Definition at line 4794 of file PartitionManager.cpp.
| ObjectShroudStatus PartitionManager::getPropShroudStatusForPlayer | ( | Int | playerIndex, |
| const Coord3D * | loc ) const |
Definition at line 3070 of file PartitionManager.cpp.
Definition at line 3548 of file PartitionManager.cpp.
Definition at line 3542 of file PartitionManager.cpp.
| CellShroudStatus PartitionManager::getShroudStatusForPlayer | ( | Int | playerIndex, |
| const Coord3D * | loc ) const |
Definition at line 3059 of file PartitionManager.cpp.
| CellShroudStatus PartitionManager::getShroudStatusForPlayer | ( | Int | playerIndex, |
| Int | x, | ||
| Int | y ) const |
Shrouded has no absolute meaning. It only makes sense to say "Shrouded for him".
Definition at line 3049 of file PartitionManager.cpp.
|
inline |
Definition at line 1328 of file PartitionManager.h.
| void PartitionManager::getVectorTo | ( | const Object * | obj, |
| const Coord3D * | pos, | ||
| DistanceCalculationType | dc, | ||
| Coord3D & | vec ) |
Definition at line 3484 of file PartitionManager.cpp.
| void PartitionManager::getVectorTo | ( | const Object * | obj, |
| const Object * | otherObj, | ||
| DistanceCalculationType | dc, | ||
| Coord3D & | vec ) |
Definition at line 3476 of file PartitionManager.cpp.
|
virtual |
| Bool PartitionManager::isClearLineOfSightTerrain | ( | const Object * | obj, |
| const Coord3D & | objPos, | ||
| const Object * | other, | ||
| const Coord3D & | otherPos ) |
return true iff there is clear line-of-sight between the two positions. this only takes terrain into account; it does not consider objects, units, trees, buildings, etc.
Definition at line 4496 of file PartitionManager.cpp.
Definition at line 3661 of file PartitionManager.cpp.
|
inline |
Definition at line 1470 of file PartitionManager.h.
| SimpleObjectIterator * PartitionManager::iterateAllObjects | ( | PartitionFilter ** | filters = NULL | ) |
Definition at line 3684 of file PartitionManager.cpp.
|
protected |
Definition at line 4328 of file PartitionManager.cpp.
|
protected |
Definition at line 4413 of file PartitionManager.cpp.
| SimpleObjectIterator * PartitionManager::iterateObjectsInRange | ( | const Coord3D * | pos, |
| Real | maxDist, | ||
| DistanceCalculationType | dc, | ||
| PartitionFilter ** | filters = NULL, | ||
| IterOrderType | order = ITER_FASTEST ) |
Definition at line 3617 of file PartitionManager.cpp.
| SimpleObjectIterator * PartitionManager::iterateObjectsInRange | ( | const Object * | obj, |
| Real | maxDist, | ||
| DistanceCalculationType | dc, | ||
| PartitionFilter ** | filters = NULL, | ||
| IterOrderType | order = ITER_FASTEST ) |
Definition at line 3597 of file PartitionManager.cpp.
| SimpleObjectIterator * PartitionManager::iteratePotentialCollisions | ( | const Coord3D * | pos, |
| const GeometryInfo & | geom, | ||
| Real | angle, | ||
| Bool | use2D = false ) |
return the Objects that would (or would not) collide with the given geometry.
Definition at line 3637 of file PartitionManager.cpp.
|
virtual |
|
inline |
Definition at line 1474 of file PartitionManager.h.
| void PartitionManager::processEntirePendingUndoShroudRevealQueue | ( | ) |
process every pending one regardless of timestamp
Definition at line 4015 of file PartitionManager.cpp.
|
protected |
keep popping and processing untill you get to one that is in the future
Definition at line 3993 of file PartitionManager.cpp.
| void PartitionManager::queueUndoShroudReveal | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4058 of file PartitionManager.cpp.
| void PartitionManager::refreshShroudForLocalPlayer | ( | ) |
this doesn't change the actual shroud values in logic, just pushes them back out to the display... this should generally only be used when the local player changes.
Definition at line 3030 of file PartitionManager.cpp.
| void PartitionManager::registerGhostObject | ( | GhostObject * | object | ) |
recreate partition data needed to hold object (only used to restore after PM reset).
Definition at line 2913 of file PartitionManager.cpp.
| void PartitionManager::registerObject | ( | Object * | object | ) |
add thing to system
Definition at line 2838 of file PartitionManager.cpp.
|
inline |
Definition at line 1482 of file PartitionManager.h.
|
inline |
Definition at line 1478 of file PartitionManager.h.
|
virtual |
|
protected |
Just delete everything in the queue without doing anything with them.
Definition at line 4025 of file PartitionManager.cpp.
| void PartitionManager::restoreFoggedCells | ( | const ShroudStatusStoreRestore & | inPartitionStore, |
| Bool | restoreToFog ) |
Definition at line 4876 of file PartitionManager.cpp.
| void PartitionManager::revealMapForPlayer | ( | Int | playerIndex | ) |
Reveals the map for the given player, but does not override Shroud generation. (Script)
Definition at line 2972 of file PartitionManager.cpp.
| void PartitionManager::revealMapForPlayerPermanently | ( | Int | playerIndex | ) |
Reveals the map for the given player, AND permanently disables all Shroud generation (Observer Mode).
Definition at line 2986 of file PartitionManager.cpp.
| void PartitionManager::shroudMapForPlayer | ( | Int | playerIndex | ) |
Resets the shroud for the given player with passive shroud (can re-explore).
Definition at line 3016 of file PartitionManager.cpp.
|
protected |
Definition at line 2685 of file PartitionManager.cpp.
| void PartitionManager::storeFoggedCells | ( | ShroudStatusStoreRestore & | outPartitionStore, |
| Bool | storeToFog ) const |
Definition at line 4836 of file PartitionManager.cpp.
|
protected |
used to validate the positions for findPositionAround family of methods
Definition at line 3709 of file PartitionManager.cpp.
| void PartitionManager::undoRevealMapForPlayerPermanently | ( | Int | playerIndex | ) |
Adds a layer of permanent blindness. Used solely to undo the permanent reveal for debugging
Definition at line 3000 of file PartitionManager.cpp.
| void PartitionManager::undoShroudCover | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4097 of file PartitionManager.cpp.
| void PartitionManager::undoShroudReveal | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4036 of file PartitionManager.cpp.
| void PartitionManager::undoThreatAffect | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| UnsignedInt | threatVal, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4152 of file PartitionManager.cpp.
| void PartitionManager::undoValueAffect | ( | Real | centerX, |
| Real | centerY, | ||
| Real | radius, | ||
| UnsignedInt | valueVal, | ||
| PlayerMaskType | playerMask ) |
Definition at line 4218 of file PartitionManager.cpp.
| void PartitionManager::unRegisterGhostObject | ( | GhostObject * | object | ) |
release partition data held for ghost object.
Definition at line 2941 of file PartitionManager.cpp.
| void PartitionManager::unRegisterObject | ( | Object * | object | ) |
remove thing from system
Definition at line 2868 of file PartitionManager.cpp.
|
virtual |
Definition at line 1538 of file PartitionManager.h.
Definition at line 1545 of file PartitionManager.h.
|
virtual |
Xfer Method Version Info: 1: Initial version 2: m_pendingUndoShroudReveals stores Unlooks waiting to happen.
Implements Snapshot.
Definition at line 4590 of file PartitionManager.cpp.
Definition at line 5601 of file PartitionManager.cpp.
Definition at line 5635 of file PartitionManager.cpp.
Definition at line 5669 of file PartitionManager.cpp.
Definition at line 5725 of file PartitionManager.cpp.
Definition at line 5618 of file PartitionManager.cpp.
Definition at line 5652 of file PartitionManager.cpp.
Definition at line 5697 of file PartitionManager.cpp.
Definition at line 5753 of file PartitionManager.cpp.