![]() |
VR-Forces Developer's Guide
|
This class keeps track of which forces are hostile to which other forces in the simulation. It maintains state for each force type, and which other forces types are considered hostile by that force. It can be queried for this data any time during the simulation. Supports force enumerations from 0 to 255.
Public Member Functions | |
| DtHostilityManager (DtSimulationServices *simManager) | |
| virtual | ~DtHostilityManager () |
| virtual bool | init () |
| virtual void | setDefaultHostility () |
| virtual void | merge (const DtHostilityManager &) |
| virtual bool | addForce (DtString forceName, DtVector forceColor, bool includeInDialogs, int forceType=-1, const DtString &country="") |
| virtual bool | removeForce (DtU8 force) |
| virtual bool | hasForceNamed (const DtString &) const |
| virtual int | forceTypeForForceNamed (const DtString &) const |
| virtual DtString | countryTypeForForceNamed (const DtString &) const |
| virtual void | setHostility (DtU8 force, DtU8 targetForce, bool hostile) |
| virtual bool | hostile (DtU8 force, DtU8 targetForce) const |
| virtual std::vector< DtU8 > | forcesUsed (bool alsoInDialogs=false) const |
| virtual void | hostileForces (DtU8 force, std::list< DtU8 > &forceList) const |
| virtual void | hostileForces (DtU8 force, std::set< DtU8 > &forceList) const |
| virtual int | forceHostileTo (DtU8 force) const |
| virtual void | friendlyForces (DtU8 force, std::list< DtU8 > &forceList) const |
| virtual int | numForces () const |
| virtual DtU8 | nextAvailableForceId () |
| virtual void | getForceDescriptionList (DtRwForceDescriptionList &output) const |
| virtual bool | readHostilityFile (const DtString &filename, bool clear=true) |
| virtual bool | readHostilityFileFromZipFile (const DtFilename &scenarioZipFile, const DtString &filename, bool clear=true) |
| virtual bool | processHostilityFile (DtlInputStream *, bool clear) |
| virtual void | setDataFromDescriptionList (const DtRwForceDescriptionList &l, bool clear=true) |
| virtual void | addForceDescription (const DtRwForceDescription &) |
| virtual void | sendHostilityMatrix () |
| virtual void | sendForces () |
| virtual void | addHostilityChangedCallback (DtHostitliyChangedCallbackFcn fcn, void *usr) |
| virtual void | removeHostilityChangedCallback (DtHostitliyChangedCallbackFcn fcn, void *usr) |
| virtual void | setName (DtU8 force, DtString forceName) |
| virtual DtString | name (DtU8 force) const |
| virtual void | setCountry (DtU8 force, DtString forceName) |
| virtual DtString | country (DtU8 force) const |
| virtual void | setIncludeInDialogs (DtU8 force, bool includeInDialogs) |
| virtual bool | includeInDialogs (DtU8 force) const |
| virtual void | setColor (DtU8 force, DtVector forceColor) |
| virtual DtVector | color (DtU8 force) const |
| virtual void | setForceIsUsed (DtU8 force, bool forceIsUsed) |
| virtual bool | forceIsUsed (DtU8 force) |
Protected Types | |
| typedef DtCallbackList< DtU8 > ::DtCallbackFunctionType | DtHostitliyChangedCallbackFcn |
| typedef std::vector< bool > | DtBoolVector |
| typedef std::vector< DtBoolVector > | DtBoolVectorVector |
| typedef std::vector< DtString > | DtNameVector |
| typedef std::vector< DtVector > | DtVectorVector |
Protected Member Functions | |
| virtual void | registerInterfaceMessageCallbacks () |
| virtual void | clearMatrix () |
Private Member Functions | |
| DtHostilityManager (const DtHostilityManager &orig) | |
| DtHostilityManager & | operator= (const DtHostilityManager &orig) |
| virtual void | processRequestHostilityMatrix (DtSimMessage *msg) |
| static void | requestHostilityMatrixCallback (DtSimMessage *msg, void *usr) |
| virtual void | processRequestForces (DtSimMessage *msg) |
| static void | requestForcesCallback (DtSimMessage *msg, void *usr) |
| virtual void | processSetHostilityMatrix (DtSimMessage *msg) |
| static void | setHostilityMatrixCallback (DtSimMessage *msg, void *usr) |
| virtual void | processRequestForceHostility (DtSimMessage *msg) |
| static void | requestForceHostilityCallback (DtSimMessage *msg, void *usr) |
| virtual void | processSetForceHostility (DtSimMessage *msg) |
| static void | setForceHostilityCallback (DtSimMessage *msg, void *usr) |
|
protected |
|
protected |
Typedefs to make list definitions easier.
|
protected |
|
protected |
|
protected |
| DtHostilityManager::DtHostilityManager | ( | DtSimulationServices * | simManager | ) |
|
virtual |
|
private |
Not implemented.
|
private |
Not implemented.
|
virtual |
Initializes the hostility manager defaults. Registers messages to listen for changes to hostility. Registers with cgf for a post-scenario load callback.
|
virtual |
Sets the default starting hostility setup. This sets DtForceFriendly as hostile toward DtForceOpposing and DtForceOppising as hostile toward DtForceFriendly. All other relationships are friendly.
|
virtual |
Merge data from hostility manager. The merge will only add newly discovered forces. It will not replace or delete existing forces.
|
virtual |
Add a force to the force manager. If forceType is not -1 will add that force name and type, else will add force with the next available id. If the force type would make "holes" in the force list, create forces with no names to fill. The country is the two letter country code if affiliated with a force.
|
virtual |
Remove a force from the force manager.
Returns true if there is a force with the given name (case insensitive)
Returns the force type for the force with the given name or 0 if name not found. Case insensitive search.
Returns the country type for the force with the given name or "" if name not found. Case insensitive search.
|
virtual |
Invokes hostility changed callbacks if the set actually results in a change.
|
virtual |
Whether force is hostile to targetForce.
|
virtual |
Forces used.
|
virtual |
Adds all force types that are hostile to force to forceList.
|
virtual |
|
virtual |
Returns the first force that is hostile to the given force. If no force is available then DtForceOther is returned.
|
virtual |
Adds all force types that are friendly to force to forceList.
|
virtual |
Callbacks that are called any time the hostility matrix changes. The parameter provided indicates for which force this change is for. i.e. If Force 1 changes to be hostile to force 2, the callback is made with 1 as the parameter.
|
virtual |
Callbacks that are called any time the hostility matrix changes. The parameter provided indicates for which force this change is for. i.e. If Force 1 changes to be hostile to force 2, the callback is made with 1 as the parameter.
|
virtual |
Name for a specific force.
|
virtual |
Name for a specific force.
|
virtual |
Country for a specific force.
|
virtual |
Country for a specific force.
|
virtual |
Whether or not a specific force is included in VRF dialogs.
|
virtual |
Whether or not a specific force is included in VRF dialogs.
|
virtual |
Color for a specific force.
|
virtual |
Color for a specific force.
|
virtual |
Whether force at index is used.
|
virtual |
Whether force at index is used.
|
virtual |
Returns the number of forces currently in use (named)
|
virtual |
Returns the next available index for a new force.
|
virtual |
Saves the force hostility info into a force-hostility list. Used when saving a scenario, prior to writing out the .xtr file; the info is used to update the data in the scenario extras manager.
|
virtual |
Reads the Hostility matrix file to the specified name and adds all current hostility from the file. This does not replace force names, colors or the state of includeInDialogs. Currently used only for old scenarios, when there is an .hst file but no .xtr file, or when there is neither and the .mtl file in the SMS is read.
|
virtual |
Read the contents of the hostility file from the given stream.
|
virtual |
Loads all of the force-hostility data from a force-hostility list. Used to load the data from info read by the scenario extras manager in scenarios with .xtr files. Takes data from a force-hostility list and saves it in local members.
|
virtual |
|
virtual |
Sends the hostility matrix out.
|
virtual |
Sends out the current forces in this matrix.
|
protectedvirtual |
Message handlers.
Registers for any interface messages that the manager listens to.
|
staticprotected |
Handles request for hostility matrix.
|
protectedvirtual |
Handles request for hostility matrix.
|
staticprotected |
Handles request for current forces.
|
protectedvirtual |
Handles request for current forces.
|
staticprotected |
Sets the updated hostility matrix.
|
protectedvirtual |
Sets the updated hostility matrix.
|
staticprotected |
Handles request for hostility for specific force.
|
protectedvirtual |
Handles request for hostility for specific force.
|
staticprotected |
Sets updated hostility for a specific force.
|
protectedvirtual |
Sets updated hostility for a specific force.
|
protectedvirtual |
Utility functions to use while reading data.
Clears the hostility matrix; done before setting hostility relations from data read from a scenario or SMS file.
|
protected |
Local members.
|
protected |
Tracks which forces are hostile to which other forces. Each force has a vector which contains a boolean for each other force. The bool is set to true for any force that the first force is hostile to.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |