Advanced Strategic Command
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
ChangeUnitProperty Class Reference

Changes the properties of a unit. More...

#include <changeunitproperty.h>

Inheritance diagram for ChangeUnitProperty:
Inheritance graph
[legend]

Public Types

enum  Property {
  ExperienceOffensive, Movement, AttackedFlag, Height,
  Direction, ReactionFire, PowerGeneration, ExperienceDefensive,
  ExperienceOffensive_Raw, ExperienceDefensive_Raw
}
 

Public Member Functions

 ChangeUnitProperty (Vehicle *vehicle, Property property, int value, bool valueIsAbsolute=true)
 
ASCString getDescription () const
 
- Public Member Functions inherited from GameAction
ActionResult execute (const Context &context)
 
ActionResult undo (const Context &context)
 
void read (tnstream &stream)
 
void write (tnstream &stream) const
 
void write (tnstream &stream, bool persistChildren) const
 
virtual ~GameAction ()
 

Protected Member Functions

virtual GameActionID getID () const
 
virtual ActionResult runAction (const Context &context)
 
virtual ActionResult undoAction (const Context &context)
 
virtual ActionResult preCheck ()
 preCheck is called before an action is redone and should check the preconditions for the action. More...
 
virtual ActionResult postCheck ()
 postCheck is called after an action has been redone and should check that the state of the map is exactly the same as it was after the action has been executed the first time. More...
 
virtual void readData (tnstream &stream)
 
virtual void writeData (tnstream &stream) const
 
- Protected Member Functions inherited from UnitAction
VehiclegetUnit (bool dontThrow=false)
 
const VehiclegetUnit (bool dontThrow=false) const
 
void readData (tnstream &stream)
 
void writeData (tnstream &stream) const
 
 UnitAction (GameMap *gamemap, int vehicleID)
 
 UnitAction (Vehicle *unit)
 
 UnitAction (GameMap *gamemap)
 
- Protected Member Functions inherited from GameAction
void deleteChildren ()
 
 GameAction (GameMap *map)
 
void addChild (GameAction *action)
 adds a child action. Ownership of the child action is passed to THIS More...
 
virtual bool undoOrderChildFirst () const
 determines the order in which the child actions are undone. More...
 
GameMapgetMap ()
 
const GameMapgetMap () const
 

Friends

template<class Child >
GameActionGameActionCreator (GameMap *map)
 

Additional Inherited Members

- Static Public Member Functions inherited from GameAction
static GameActionreadFromStream (tnstream &stream, GameMap *map)
 

Detailed Description

Changes the properties of a unit.

This is done none-recursively, so the cargo of a unit is not affected

Definition at line 31 of file changeunitproperty.h.

Member Enumeration Documentation

Enumerator
ExperienceOffensive 
Movement 
AttackedFlag 
Height 
Direction 
ReactionFire 
PowerGeneration 
ExperienceDefensive 
ExperienceOffensive_Raw 
ExperienceDefensive_Raw 

Definition at line 33 of file changeunitproperty.h.

Constructor & Destructor Documentation

ChangeUnitProperty::ChangeUnitProperty ( Vehicle vehicle,
Property  property,
int  value,
bool  valueIsAbsolute = true 
)

Definition at line 28 of file changeunitproperty.cpp.

Member Function Documentation

ASCString ChangeUnitProperty::getDescription ( ) const
virtual

Implements GameAction.

Definition at line 54 of file changeunitproperty.cpp.

References Vehicle::getName(), UnitAction::getUnit(), and ASCString::toString().

GameActionID ChangeUnitProperty::getID ( ) const
protectedvirtual

Implements GameAction.

Definition at line 97 of file changeunitproperty.cpp.

References ActionRegistry::ChangeUnitProperty.

ActionResult ChangeUnitProperty::postCheck ( )
protectedvirtual

postCheck is called after an action has been redone and should check that the state of the map is exactly the same as it was after the action has been executed the first time.

The cheat detection of Replays heavily relies on this mechanism.

Reimplemented from GameAction.

Definition at line 187 of file changeunitproperty.cpp.

References UnitAction::getUnit().

ActionResult ChangeUnitProperty::preCheck ( )
protectedvirtual

preCheck is called before an action is redone and should check the preconditions for the action.

The map should be in exactly the same state as it was when the action was first run. This method should check various key indicators to insurce the unmodifiedness of the map. The cheat detection of Replays heavily relies on this mechanism.

Reimplemented from GameAction.

Definition at line 179 of file changeunitproperty.cpp.

References UnitAction::getUnit().

void ChangeUnitProperty::readData ( tnstream stream)
protectedvirtual

Implements GameAction.

Definition at line 69 of file changeunitproperty.cpp.

References UnitAction::readData(), and tnstream::readInt().

ActionResult ChangeUnitProperty::runAction ( const Context context)
protectedvirtual

Implements GameAction.

Definition at line 158 of file changeunitproperty.cpp.

ActionResult ChangeUnitProperty::undoAction ( const Context context)
protectedvirtual

Implements GameAction.

Definition at line 172 of file changeunitproperty.cpp.

void ChangeUnitProperty::writeData ( tnstream stream) const
protectedvirtual

Implements GameAction.

Definition at line 85 of file changeunitproperty.cpp.

References UnitAction::writeData(), and tnstream::writeInt().

Friends And Related Function Documentation

template<class Child >
GameAction* GameActionCreator ( GameMap map)
friend

Definition at line 114 of file action.h.


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