FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FIFE::Instance Class Reference

An Instance is an "instantiation" of an Object at a Location. More...

#include <instance.h>

+ Inheritance diagram for FIFE::Instance:
+ Collaboration diagram for FIFE::Instance:

Classes

class  InstanceActivity
 InstanceActivity gets allocated in case there is some runtime activity related to the instance. More...
 

Public Member Functions

 Instance (Object *object, const Location &location, const std::string &identifier="")
 Constructor Instances are created by calling addInstance from layer, thus this method should really be called only by layer or test code. More...
 
virtual ~Instance ()
 Destructor. More...
 
const std::string & getId ()
 Get the identifier for this instance; possibly null. More...
 
void setId (const std::string &identifier="")
 Set the identifier for this instance. More...
 
ObjectgetObject ()
 Gets object where this instance is instantiated from. More...
 
void setLocation (const Location &loc)
 Sets location of the instance. More...
 
Location getLocation () const
 Gets current location of instance. More...
 
LocationgetLocationRef ()
 Gets reference of current location of instance. More...
 
Location getTargetLocation () const
 Gets movement target in case instance is moving. More...
 
void setFacingLocation (const Location &loc)
 Sets the direction where instance is heading. More...
 
Location getFacingLocation ()
 Returns the direction where instance is heading. More...
 
LocationgetOldLocationRef ()
 Gets reference of old location of instance. More...
 
void setRotation (int32_t rotation)
 Set the rotation offset of this instance. More...
 
int32_t getRotation () const
 Get the rotation offset of this instance Returns direction where instance is heading. More...
 
int32_t getOldRotation () const
 Get the old rotation offset of this instance Returns direction where instance was heading. More...
 
void setBlocking (bool blocking)
 Sets if instance blocks movement. More...
 
bool isBlocking () const
 Gets if instance blocks movement. More...
 
void setOverrideBlocking (bool overblock)
 Sets if instance blocking can overriden. More...
 
bool isOverrideBlocking () const
 Gets if instance blocking can overriden. More...
 
void callOnActionFrame (Action *action, int32_t frame)
 Auxiliary function to inform ActionListeners about the active ActionFrame. More...
 
void addActionListener (InstanceActionListener *listener)
 Adds new instance action listener. More...
 
void removeActionListener (InstanceActionListener *listener)
 Removes associated instance action listener. More...
 
void addChangeListener (InstanceChangeListener *listener)
 Adds new instance change listener. More...
 
void removeChangeListener (InstanceChangeListener *listener)
 Removes associated instance change listener. More...
 
void addDeleteListener (InstanceDeleteListener *listener)
 Adds new instance delete listener. More...
 
void removeDeleteListener (InstanceDeleteListener *listener)
 Removes associated instance delete listener. More...
 
ActiongetCurrentAction () const
 Gets the currently active action. More...
 
double getMovementSpeed () const
 Gets the speed in case instance is moving otherwise returns 0. More...
 
uint32_t getActionRuntime ()
 Gets the time in milliseconds how long action has been active In case there is no current action, returns -1. More...
 
void setActionRuntime (uint32_t time_offset)
 Sets the time in milliseconds how long an action has been active This was requested in Ticket #373. More...
 
void move (const std::string &actionName, const Location &target, const double speed, const std::string &costId="")
 Performs given named action to the instance. More...
 
void act (const std::string &actionName, const Location &direction, bool repeating=false)
 Performs given named action to the instance. More...
 
void act (const std::string &actionName, int32_t rotation, bool repeating=false)
 Performs given named action to the instance. More...
 
void act (const std::string &actionName, bool repeating=false)
 Performs given named action to the instance. More...
 
void say (const std::string &text, uint32_t duration=0)
 Causes instance to "say" given text (shown on screen next to the instance) More...
 
void follow (const std::string &actionName, Instance *leader, const double speed)
 Performs given named action to the instance. More...
 
void follow (const std::string &actionName, Route *route, const double speed)
 Performs given named action to the instance. More...
 
void cancelMovement (uint32_t length=1)
 Cancel movement after a given length. More...
 
const std::string * getSayText () const
 Returns pointer to currently set saytext. More...
 
InstanceChangeInfo update ()
 Updates the instance related to the current action. More...
 
bool isActive () const
 If this returns true, the instance needs to be updated. More...
 
void setVisual (IVisual *visual)
 Sets visualization to be used. More...
 
template<typename T >
T * getVisual () const
 Gets used visualization. More...
 
void callOnTransparencyChange ()
 
void callOnVisibleChange ()
 
void callOnStackPositionChange ()
 
void setTimeMultiplier (float multip)
 Sets speed for the map. More...
 
float getTimeMultiplier ()
 Gets instance speed. More...
 
float getTotalTimeMultiplier ()
 Gets instance speed, considering also model and map speeds. More...
 
uint32_t getRuntime ()
 Gets the scaled runtime in milliseconds. More...
 
void refresh ()
 Refreshes instance e.g. More...
 
InstanceChangeInfo getChangeInfo ()
 Returns a bitmask of changes of the last update. More...
 
void onInstanceDeleted (Instance *instance)
 callback so other instances we depend on can notify us if they go away More...
 
RoutegetRoute ()
 Returns a pointer to the route, in case there is no, it returns NULL. More...
 
void setVisitor (bool visit)
 Marks this instance as a visitor. More...
 
bool isVisitor ()
 If instance is a visitor it returns true otherwise false. More...
 
void setVisitorShape (VisitorShapeInfo info)
 Sets the shape type for a visitor. More...
 
VisitorShapeInfo getVisitorShape ()
 Gets the shape type for a visitor. More...
 
void setVisitorRadius (uint16_t radius)
 Sets the range for a visitor. More...
 
uint16_t getVisitorRadius ()
 Gets the visitor range. More...
 
void setCellStackPosition (uint8_t stack)
 Sets the cell stack position. More...
 
uint8_t getCellStackPosition ()
 Gets the cell stack position. More...
 
bool isSpecialCost ()
 Returns true if instance or object have special cost otherwise false. More...
 
void setCost (const std::string &id, double cost)
 Sets for the given cost id a cost. More...
 
void resetCost ()
 Resets cost. More...
 
double getCost ()
 Returns cost value. More...
 
const std::string & getCostId ()
 Returns cost id. More...
 
bool isMultiCell ()
 Returns true if it is multi cell otherwise false. More...
 
bool isMultiObject ()
 Returns true if it is multi object otherwise false. More...
 
void updateMultiInstances ()
 Updates the visual positions of all instances in case this is a multi object. More...
 
const std::vector< Instance * > & getMultiInstances ()
 Returns a vector that contains all instances of a multi object. More...
 
- Public Member Functions inherited from FIFE::FifeClass
 FifeClass ()
 
virtual ~FifeClass ()
 
fifeid_t getFifeId ()
 Gets unique id of this instance inside the engine. More...
 
- Public Member Functions inherited from FIFE::InstanceDeleteListener
virtual ~InstanceDeleteListener ()
 

Private Member Functions

 Instance (const Instance &)
 
Instanceoperator= (const Instance &)
 
void finalizeAction ()
 Finalize current action. More...
 
void initializeAction (const std::string &actionName)
 Initialize action for use. More...
 
bool processMovement ()
 Moves instance. Returns true if finished. More...
 
void calcMovement ()
 Calculates movement based current location and speed. More...
 
void bindTimeProvider ()
 rebinds time provider based on new location More...
 
void initializeChanges ()
 called when instance has been changed. Causes instance to create InstanceActivity More...
 

Private Attributes

std::string m_id
 
int32_t m_rotation
 The rotation offset of this instance. More...
 
InstanceActivitym_activity
 
InstanceChangeInfo m_changeInfo
 bitmask stating current changes More...
 
std::vector
< InstanceDeleteListener * > 
m_deleteListeners
 listeners for deletion of the instance More...
 
Objectm_object
 object where instantiated from More...
 
Location m_location
 current location More...
 
IVisualm_visual
 instance visualization More...
 
bool m_blocking
 instance blocking info More...
 
bool m_overrideBlocking
 allow to override the blocking property More...
 
bool m_isVisitor
 is instance a visitor (FoW) More...
 
VisitorShapeInfo m_visitorShape
 visitor shape type More...
 
uint16_t m_visitorRadius
 visitor radius (FoW) More...
 
uint8_t m_cellStackPos
 position on cell stack More...
 
bool m_specialCost
 indicates special cost More...
 
double m_cost
 holds cost value More...
 
std::string m_costId
 holds cost id More...
 
std::vector< Instance * > m_multiInstances
 vector that holds all multi instances More...
 

Detailed Description

An Instance is an "instantiation" of an Object at a Location.

Definition at line 97 of file instance.h.

Constructor & Destructor Documentation

FIFE::Instance::Instance ( Object object,
const Location location,
const std::string &  identifier = "" 
)

Constructor Instances are created by calling addInstance from layer, thus this method should really be called only by layer or test code.

Definition at line 198 of file instance.cpp.

References addDeleteListener(), FIFE::InstanceVisual::create(), FIFE::Layer::createInstance(), FIFE::Location::getExactLayerCoordinatesRef(), FIFE::Location::getLayer(), FIFE::Object::isMultiObject(), m_location, m_multiInstances, m_object, m_rotation, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.

FIFE::Instance::Instance ( const Instance )
private

Member Function Documentation

void FIFE::Instance::act ( const std::string &  actionName,
const Location direction,
bool  repeating = false 
)

Performs given named action to the instance.

Performs no movement

Parameters
actionNamename of the action
directioncoordinates for cell towards instance is heading to when performing the action
repeatingin case true, keeps repeating this action

Definition at line 573 of file instance.cpp.

References initializeAction(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, FIFE::ActionInfo::m_repeating, and setFacingLocation().

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

void FIFE::Instance::act ( const std::string &  actionName,
int32_t  rotation,
bool  repeating = false 
)

Performs given named action to the instance.

Performs no movement

Parameters
actionNamename of the action
rotationrotation which the instance use when performing the action
repeatingin case true, keeps repeating this action

Definition at line 579 of file instance.cpp.

References initializeAction(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, FIFE::ActionInfo::m_repeating, and setRotation().

void FIFE::Instance::act ( const std::string &  actionName,
bool  repeating = false 
)

Performs given named action to the instance.

Performs no movement and use current rotation

Parameters
actionNamename of the action
repeatingin case true, keeps repeating this action

Definition at line 585 of file instance.cpp.

References initializeAction(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, and FIFE::ActionInfo::m_repeating.

void FIFE::Instance::addActionListener ( InstanceActionListener listener)

Adds new instance action listener.

Parameters
listenerto add

Definition at line 362 of file instance.cpp.

References initializeChanges(), FIFE::Instance::InstanceActivity::m_actionListeners, and m_activity.

void FIFE::Instance::addChangeListener ( InstanceChangeListener listener)

Adds new instance change listener.

Parameters
listenerto add

Definition at line 382 of file instance.cpp.

References initializeChanges(), m_activity, and FIFE::Instance::InstanceActivity::m_changeListeners.

void FIFE::Instance::addDeleteListener ( InstanceDeleteListener listener)

Adds new instance delete listener.

Parameters
listenerto add

Definition at line 1031 of file instance.cpp.

References m_deleteListeners.

Referenced by FIFE::InstanceRenderer::addColored(), FIFE::RendererNode::addInstance(), FIFE::InstanceRenderer::addOutlined(), FIFE::InstanceRenderer::addTransparentArea(), FIFE::RendererNode::changeInstance(), follow(), and Instance().

+ Here is the caller graph for this function:

void FIFE::Instance::bindTimeProvider ( )
private
void FIFE::Instance::calcMovement ( )
private

Calculates movement based current location and speed.

void FIFE::Instance::callOnActionFrame ( Action action,
int32_t  frame 
)

Auxiliary function to inform ActionListeners about the active ActionFrame.

Parameters
actionpointer to the action
frameframe index number of the animation

Definition at line 387 of file instance.cpp.

References FIFE::Instance::InstanceActivity::m_actionListeners, and m_activity.

Referenced by FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

void FIFE::Instance::callOnStackPositionChange ( )

Definition at line 916 of file instance.cpp.

References FIFE::ICHANGE_STACKPOS, initializeChanges(), isActive(), m_activity, FIFE::Instance::InstanceActivity::m_additional, and refresh().

Referenced by FIFE::InstanceVisual::setStackPosition().

+ Here is the caller graph for this function:

void FIFE::Instance::callOnTransparencyChange ( )

Definition at line 898 of file instance.cpp.

References FIFE::ICHANGE_TRANSPARENCY, initializeChanges(), isActive(), m_activity, FIFE::Instance::InstanceActivity::m_additional, and refresh().

Referenced by FIFE::InstanceVisual::setTransparency().

+ Here is the caller graph for this function:

void FIFE::Instance::callOnVisibleChange ( )

Definition at line 907 of file instance.cpp.

References FIFE::ICHANGE_VISIBLE, initializeChanges(), isActive(), m_activity, FIFE::Instance::InstanceActivity::m_additional, and refresh().

Referenced by FIFE::InstanceVisual::setVisible().

+ Here is the caller graph for this function:

void FIFE::Instance::cancelMovement ( uint32_t  length = 1)

Cancel movement after a given length.

If no lenght is set then 1 is used. This mean that the instance stops at the center of the next cell (can be the same as the current).

Definition at line 511 of file instance.cpp.

References FIFE::Route::cutPath(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, and FIFE::ActionInfo::m_route.

void FIFE::Instance::finalizeAction ( )
private
void FIFE::Instance::follow ( const std::string &  actionName,
Instance leader,
const double  speed 
)

Performs given named action to the instance.

While performing the action follows given instance with given speed

Parameters
actionNamename of the action
leaderfollowed instance
speedspeed used for movement. Units = distance 1 in layer coordinates per second

Definition at line 486 of file instance.cpp.

References FIFE::_log, addDeleteListener(), FL_DBG, getLocationRef(), initializeAction(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, FIFE::ActionInfo::m_leader, m_location, FIFE::ActionInfo::m_speed, and FIFE::ActionInfo::m_target.

void FIFE::Instance::follow ( const std::string &  actionName,
Route route,
const double  speed 
)

Performs given named action to the instance.

While performing the action follows given route with given speed. Note: In this case route isn't delete at the end.

Parameters
actionNamename of the action
routefollowed route
speedspeed used for movement. Units = distance 1 in layer coordinates per second

Definition at line 495 of file instance.cpp.

References FIFE::_log, FL_DBG, FIFE::Layer::getCellGrid(), FIFE::Route::getEndNode(), FIFE::Location::getLayer(), FIFE::Location::getLayerCoordinates(), FIFE::Object::getMultiObjectCoordinates(), FIFE::Object::getWalkableAreas(), FIFE::Object::getZStepRange(), initializeAction(), isMultiCell(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, FIFE::ActionInfo::m_delete_route, m_location, m_object, m_rotation, FIFE::ActionInfo::m_route, FIFE::ActionInfo::m_speed, FIFE::ActionInfo::m_target, FIFE::Route::setObject(), and FIFE::Route::setOccupiedArea().

uint32_t FIFE::Instance::getActionRuntime ( )

Gets the time in milliseconds how long action has been active In case there is no current action, returns -1.

Returns
action runtime

Definition at line 853 of file instance.cpp.

References bindTimeProvider(), FIFE::TimeProvider::getGameTime(), getRuntime(), FIFE::ActionInfo::m_action_offset_time, FIFE::ActionInfo::m_action_start_time, FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, and FIFE::Instance::InstanceActivity::m_timeProvider.

Referenced by FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

uint8_t FIFE::Instance::getCellStackPosition ( )

Gets the cell stack position.

Definition at line 561 of file instance.cpp.

References m_cellStackPos.

InstanceChangeInfo FIFE::Instance::getChangeInfo ( )

Returns a bitmask of changes of the last update.

Definition at line 891 of file instance.cpp.

References FIFE::ICHANGE_NO_CHANGES, m_activity, and m_changeInfo.

Referenced by FIFE::LayerCache::updateInstance().

+ Here is the caller graph for this function:

double FIFE::Instance::getCost ( )

Returns cost value.

In case there is no it returns the object cost.

Definition at line 978 of file instance.cpp.

References FIFE::Object::getCost(), m_cost, m_object, and m_specialCost.

Referenced by FIFE::Cell::addInstance().

+ Here is the caller graph for this function:

const std::string & FIFE::Instance::getCostId ( )

Returns cost id.

In case there is no it returns the object cost id.

Definition at line 985 of file instance.cpp.

References FIFE::Object::getCostId(), m_costId, m_object, and m_specialCost.

Referenced by FIFE::Cell::addInstance(), and FIFE::Cell::removeInstance().

+ Here is the caller graph for this function:

Action * FIFE::Instance::getCurrentAction ( ) const

Gets the currently active action.

This is owned by the instance's object, so don't delete it!

Returns
current action, NULL in case there is none

Definition at line 810 of file instance.cpp.

References FIFE::ActionInfo::m_action, FIFE::Instance::InstanceActivity::m_actionInfo, and m_activity.

Referenced by FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

Location FIFE::Instance::getFacingLocation ( )

Returns the direction where instance is heading.

Note
does not return const Location&, since swig wont be const correct
Returns
the direction of instance.

Definition at line 835 of file instance.cpp.

References FIFE::getFacing(), m_location, and m_rotation.

const std::string & FIFE::Instance::getId ( )

Get the identifier for this instance; possibly null.

Definition at line 335 of file instance.cpp.

References m_id.

Location FIFE::Instance::getLocation ( ) const

Gets current location of instance.

Note
does not return const Location&, since swig wont be const correct
Returns
current location

Definition at line 303 of file instance.cpp.

References m_location.

Referenced by FIFE::Camera::attach(), and FIFE::InstanceRenderer::renderAlreadySorted().

+ Here is the caller graph for this function:

double FIFE::Instance::getMovementSpeed ( ) const

Gets the speed in case instance is moving otherwise returns 0.

Returns
instance speed. Value 1 means distance 1 in layer coordinates / second

Definition at line 824 of file instance.cpp.

References FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, and FIFE::ActionInfo::m_speed.

const std::vector< Instance * > & FIFE::Instance::getMultiInstances ( )

Returns a vector that contains all instances of a multi object.

Definition at line 569 of file instance.cpp.

References m_multiInstances.

Referenced by FIFE::CellCacheChangeListener::onInstanceCreate(), and FIFE::CellCacheChangeListener::onInstanceDelete().

+ Here is the caller graph for this function:

Object * FIFE::Instance::getObject ( )
Location & FIFE::Instance::getOldLocationRef ( )

Gets reference of old location of instance.

Returns
reference to old location

Definition at line 839 of file instance.cpp.

References m_activity, m_location, and FIFE::Instance::InstanceActivity::m_oldLocation.

Referenced by FIFE::Map::update().

+ Here is the caller graph for this function:

int32_t FIFE::Instance::getOldRotation ( ) const

Get the old rotation offset of this instance Returns direction where instance was heading.

Definition at line 846 of file instance.cpp.

References m_activity, FIFE::Instance::InstanceActivity::m_oldRotation, and m_rotation.

int32_t FIFE::Instance::getRotation ( ) const

Get the rotation offset of this instance Returns direction where instance is heading.

Definition at line 327 of file instance.cpp.

References m_rotation.

Referenced by move(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), processMovement(), and FIFE::LayerCache::updateVisual().

+ Here is the caller graph for this function:

Route * FIFE::Instance::getRoute ( )

Returns a pointer to the route, in case there is no, it returns NULL.

Definition at line 523 of file instance.cpp.

References FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, and FIFE::ActionInfo::m_route.

uint32_t FIFE::Instance::getRuntime ( )
const std::string * FIFE::Instance::getSayText ( ) const

Returns pointer to currently set saytext.

In case no text is set, returns NULL

Definition at line 601 of file instance.cpp.

References m_activity, FIFE::Instance::InstanceActivity::m_sayInfo, and FIFE::SayInfo::m_txt.

Referenced by FIFE::FloatingTextRenderer::render().

+ Here is the caller graph for this function:

Location FIFE::Instance::getTargetLocation ( ) const

Gets movement target in case instance is moving.

In case not, returns current location To move target location, call move-method

See Also
move
Note
does not return const Location&, since swig wont be const correct
Returns
Movement target location

Definition at line 817 of file instance.cpp.

References FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, m_location, and FIFE::ActionInfo::m_target.

float FIFE::Instance::getTimeMultiplier ( )
float FIFE::Instance::getTotalTimeMultiplier ( )
uint16_t FIFE::Instance::getVisitorRadius ( )

Gets the visitor range.

Definition at line 553 of file instance.cpp.

References m_visitorRadius.

Referenced by FIFE::Cell::addInstance(), and FIFE::Cell::removeInstance().

+ Here is the caller graph for this function:

VisitorShapeInfo FIFE::Instance::getVisitorShape ( )

Gets the shape type for a visitor.

Definition at line 545 of file instance.cpp.

References m_visitorShape.

Referenced by FIFE::Cell::addInstance(), and FIFE::Cell::removeInstance().

+ Here is the caller graph for this function:

template<typename T >
T* FIFE::Instance::getVisual ( ) const
inline
void FIFE::Instance::initializeAction ( const std::string &  actionName)
private
void FIFE::Instance::initializeChanges ( )
private
bool FIFE::Instance::isActive ( ) const

If this returns true, the instance needs to be updated.

Definition at line 276 of file instance.cpp.

References m_activity.

Referenced by FIFE::Layer::addInstance(), callOnStackPositionChange(), callOnTransparencyChange(), callOnVisibleChange(), FIFE::Layer::createInstance(), FIFE::Layer::deleteInstance(), FIFE::Layer::removeInstance(), setBlocking(), setLocation(), and setRotation().

+ Here is the caller graph for this function:

bool FIFE::Instance::isBlocking ( ) const

Gets if instance blocks movement.

Definition at line 350 of file instance.cpp.

References m_blocking.

Referenced by FIFE::BlockingInfoRenderer::render().

+ Here is the caller graph for this function:

bool FIFE::Instance::isMultiCell ( )

Returns true if it is multi cell otherwise false.

Definition at line 992 of file instance.cpp.

References FIFE::Object::isMultiObject(), and m_object.

Referenced by follow(), move(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), and processMovement().

+ Here is the caller graph for this function:

bool FIFE::Instance::isMultiObject ( )

Returns true if it is multi object otherwise false.

Definition at line 996 of file instance.cpp.

References m_multiInstances.

Referenced by finalizeAction(), initializeAction(), and onInstanceDeleted().

+ Here is the caller graph for this function:

bool FIFE::Instance::isOverrideBlocking ( ) const

Gets if instance blocking can overriden.

Definition at line 358 of file instance.cpp.

References m_overrideBlocking.

bool FIFE::Instance::isSpecialCost ( )

Returns true if instance or object have special cost otherwise false.

Definition at line 565 of file instance.cpp.

References m_specialCost.

Referenced by FIFE::Cell::addInstance(), and FIFE::Cell::removeInstance().

+ Here is the caller graph for this function:

bool FIFE::Instance::isVisitor ( )

If instance is a visitor it returns true otherwise false.

Definition at line 537 of file instance.cpp.

References m_isVisitor.

Referenced by FIFE::Cell::addInstance(), and FIFE::Cell::removeInstance().

+ Here is the caller graph for this function:

void FIFE::Instance::move ( const std::string &  actionName,
const Location target,
const double  speed,
const std::string &  costId = "" 
)
void FIFE::Instance::onInstanceDeleted ( Instance instance)
virtual

callback so other instances we depend on can notify us if they go away

Implements FIFE::InstanceDeleteListener.

Definition at line 1050 of file instance.cpp.

References isMultiObject(), FIFE::Instance::InstanceActivity::m_actionInfo, m_activity, FIFE::ActionInfo::m_leader, and m_multiInstances.

Instance& FIFE::Instance::operator= ( const Instance )
private
bool FIFE::Instance::processMovement ( )
private
void FIFE::Instance::refresh ( )

Refreshes instance e.g.

in case location is updated directly (not via setLocation) In this case e.g. instance's master time provider is changed, so it needs to be updated

Definition at line 886 of file instance.cpp.

References bindTimeProvider(), and initializeChanges().

Referenced by callOnStackPositionChange(), callOnTransparencyChange(), callOnVisibleChange(), setBlocking(), setLocation(), and setRotation().

+ Here is the caller graph for this function:

void FIFE::Instance::removeActionListener ( InstanceActionListener listener)

Removes associated instance action listener.

Parameters
listenerto remove

Definition at line 367 of file instance.cpp.

References FIFE::_log, FL_WARN, FIFE::Instance::InstanceActivity::m_actionListeners, and m_activity.

void FIFE::Instance::removeChangeListener ( InstanceChangeListener listener)

Removes associated instance change listener.

Parameters
listenerto remove

Definition at line 401 of file instance.cpp.

References FIFE::_log, FL_WARN, m_activity, and FIFE::Instance::InstanceActivity::m_changeListeners.

void FIFE::Instance::removeDeleteListener ( InstanceDeleteListener listener)
void FIFE::Instance::resetCost ( )

Resets cost.

Definition at line 974 of file instance.cpp.

References m_specialCost.

void FIFE::Instance::say ( const std::string &  text,
uint32_t  duration = 0 
)

Causes instance to "say" given text (shown on screen next to the instance)

Parameters
texttext to say. If "" given, clear the text
durationduration to show the text (in ms). If 0, shows forever

Definition at line 590 of file instance.cpp.

References getRuntime(), initializeChanges(), m_activity, FIFE::Instance::InstanceActivity::m_sayInfo, and FIFE::SayInfo::m_start_time.

Referenced by update().

+ Here is the caller graph for this function:

void FIFE::Instance::setActionRuntime ( uint32_t  time_offset)

Sets the time in milliseconds how long an action has been active This was requested in Ticket #373.

This way the state of the action can be saved and restored at a later time

Parameters
time_offsetThe action time offset that should be applied

Definition at line 862 of file instance.cpp.

References FIFE::ActionInfo::m_action_offset_time, FIFE::Instance::InstanceActivity::m_actionInfo, and m_activity.

void FIFE::Instance::setBlocking ( bool  blocking)

Sets if instance blocks movement.

Definition at line 339 of file instance.cpp.

References initializeChanges(), isActive(), m_blocking, m_overrideBlocking, and refresh().

void FIFE::Instance::setCellStackPosition ( uint8_t  stack)

Sets the cell stack position.

Definition at line 557 of file instance.cpp.

References m_cellStackPos.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

void FIFE::Instance::setCost ( const std::string &  id,
double  cost 
)

Sets for the given cost id a cost.

Parameters
idname of the cost id
costvalue for the cost

Definition at line 968 of file instance.cpp.

References m_cost, m_costId, and m_specialCost.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

void FIFE::Instance::setFacingLocation ( const Location loc)

Sets the direction where instance is heading.

Useful e.g. with static instances which don't "move" or "act"

Definition at line 831 of file instance.cpp.

References FIFE::getAngleBetween(), m_location, and setRotation().

Referenced by act(), move(), and processMovement().

+ Here is the caller graph for this function:

void FIFE::Instance::setId ( const std::string &  identifier = "")

Set the identifier for this instance.

Definition at line 331 of file instance.cpp.

References m_id.

void FIFE::Instance::setLocation ( const Location loc)

Sets location of the instance.

Parameters
locnew location

Definition at line 284 of file instance.cpp.

References FIFE::InstanceTree::addInstance(), FIFE::Layer::getInstanceTree(), FIFE::Location::getLayer(), FIFE::Location::getLayerCoordinates(), initializeChanges(), isActive(), m_location, refresh(), and FIFE::InstanceTree::removeInstance().

Referenced by processMovement().

+ Here is the caller graph for this function:

void FIFE::Instance::setOverrideBlocking ( bool  overblock)

Sets if instance blocking can overriden.

Definition at line 354 of file instance.cpp.

References m_overrideBlocking.

void FIFE::Instance::setRotation ( int32_t  rotation)

Set the rotation offset of this instance.

Definition at line 311 of file instance.cpp.

References initializeChanges(), isActive(), m_rotation, and refresh().

Referenced by act(), FIFE::MapLoader::load(), processMovement(), and setFacingLocation().

+ Here is the caller graph for this function:

void FIFE::Instance::setTimeMultiplier ( float  multip)
void FIFE::Instance::setVisitor ( bool  visit)

Marks this instance as a visitor.

Definition at line 533 of file instance.cpp.

References m_isVisitor.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

void FIFE::Instance::setVisitorRadius ( uint16_t  radius)

Sets the range for a visitor.

Definition at line 549 of file instance.cpp.

References m_visitorRadius.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

void FIFE::Instance::setVisitorShape ( VisitorShapeInfo  info)

Sets the shape type for a visitor.

Definition at line 541 of file instance.cpp.

References m_visitorShape.

Referenced by FIFE::MapLoader::load().

+ Here is the caller graph for this function:

void FIFE::Instance::setVisual ( IVisual visual)
inline

Sets visualization to be used.

Transfers ownership.

Definition at line 327 of file instance.h.

References m_visual.

Referenced by FIFE::InstanceVisual::create().

+ Here is the caller graph for this function:

Member Data Documentation

bool FIFE::Instance::m_blocking
private

instance blocking info

Definition at line 510 of file instance.h.

Referenced by isBlocking(), setBlocking(), and FIFE::Instance::InstanceActivity::update().

uint8_t FIFE::Instance::m_cellStackPos
private

position on cell stack

Definition at line 520 of file instance.h.

Referenced by getCellStackPosition(), and setCellStackPosition().

InstanceChangeInfo FIFE::Instance::m_changeInfo
private

bitmask stating current changes

Definition at line 499 of file instance.h.

Referenced by getChangeInfo(), update(), and FIFE::Instance::InstanceActivity::update().

double FIFE::Instance::m_cost
private

holds cost value

Definition at line 524 of file instance.h.

Referenced by getCost(), and setCost().

std::string FIFE::Instance::m_costId
private

holds cost id

Definition at line 526 of file instance.h.

Referenced by getCostId(), and setCost().

std::vector<InstanceDeleteListener*> FIFE::Instance::m_deleteListeners
private

listeners for deletion of the instance

Definition at line 501 of file instance.h.

Referenced by addDeleteListener(), removeDeleteListener(), update(), and ~Instance().

std::string FIFE::Instance::m_id
private

Definition at line 442 of file instance.h.

Referenced by getId(), and setId().

bool FIFE::Instance::m_isVisitor
private

is instance a visitor (FoW)

Definition at line 514 of file instance.h.

Referenced by isVisitor(), and setVisitor().

std::vector<Instance*> FIFE::Instance::m_multiInstances
private
Object* FIFE::Instance::m_object
private

object where instantiated from

Definition at line 504 of file instance.h.

Referenced by follow(), getCost(), getCostId(), getObject(), initializeAction(), Instance(), isMultiCell(), move(), processMovement(), update(), and updateMultiInstances().

bool FIFE::Instance::m_overrideBlocking
private

allow to override the blocking property

Definition at line 512 of file instance.h.

Referenced by isOverrideBlocking(), setBlocking(), and setOverrideBlocking().

int32_t FIFE::Instance::m_rotation
private

The rotation offset of this instance.

This is in addition to possible camera rotation and intended for setting, for example, a rotation of a tile.

Definition at line 446 of file instance.h.

Referenced by follow(), getFacingLocation(), getOldRotation(), getRotation(), Instance(), move(), processMovement(), setRotation(), FIFE::Instance::InstanceActivity::update(), and updateMultiInstances().

bool FIFE::Instance::m_specialCost
private

indicates special cost

Definition at line 522 of file instance.h.

Referenced by getCost(), getCostId(), isSpecialCost(), resetCost(), and setCost().

uint16_t FIFE::Instance::m_visitorRadius
private

visitor radius (FoW)

Definition at line 518 of file instance.h.

Referenced by getVisitorRadius(), and setVisitorRadius().

VisitorShapeInfo FIFE::Instance::m_visitorShape
private

visitor shape type

Definition at line 516 of file instance.h.

Referenced by getVisitorShape(), and setVisitorShape().

IVisual* FIFE::Instance::m_visual
private

instance visualization

Definition at line 508 of file instance.h.

Referenced by getVisual(), setVisual(), and ~Instance().


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