Task Class Reference

Basic class for all tasks. More...

#include <task.h>

Inherited by Commander, FontManager, MusicManager, TaskApplyClientsInput, TaskApplyServerChanges, TaskManager, TaskRender, TaskSendChanges, TaskSimulation, TaskSimulationServer, and TaskSound.

Inheritance diagram for Task:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Task ()
virtual ~Task ()
virtual void init ()
 Init resources for task.
virtual void clean ()
 Clean resources for task.
virtual void update (int dtime, int atime)
 Update call with difference from last call.
virtual void update (int atime)
 Direct update from TaskManager.
virtual void addedWorldObject (WorldEntity *we)
 Notification for task that new object has been added.
virtual void deletedWorldObject (WorldEntity *we)
 Notification for task that object will be deleted.

Protected Attributes

int mLastTime
 Notification fot task, that current map will be unloaded Notification for task, that new map was loaded. remembers last time of update call. Invalid if == -1.

Detailed Description

Basic class for all tasks.

Definition at line 13 of file task.h.


Constructor & Destructor Documentation

Task::Task  )  [inline]
 

Definition at line 17 of file task.h.

References mLastTime.

virtual Task::~Task  )  [inline, virtual]
 

Definition at line 22 of file task.h.


Member Function Documentation

void Task::addedWorldObject WorldEntity we  )  [virtual]
 

Notification for task that new object has been added.

If the task need some fast structire to hold world entity - this is the notification that new entity is added. The entity is allreardy added in world when this is called. Children doesn't have to call this method when reimplementing.

Parameters:
we pointer to new entity

Reimplemented in TaskManager.

Definition at line 42 of file task.cpp.

void Task::clean  )  [virtual]
 

Clean resources for task.

Update shouldn't be called after resources celanup. Children doesn't have to call this method when reimplementing.

Reimplemented in TaskRender.

Definition at line 9 of file task.cpp.

Referenced by TaskRender::clean().

void Task::deletedWorldObject WorldEntity we  )  [virtual]
 

Notification for task that object will be deleted.

The object is still in World's list of all objects but after this call the object will be deleted so the pointer will be invalid. If task holds world entities in some super structure, this is a good time to remove it. Children doesn't have to call this method when reimplementing.

Reimplemented in TaskManager.

Definition at line 47 of file task.cpp.

virtual void Task::init void   )  [inline, virtual]
 

Init resources for task.

This method is called before update methods. Call this method if you reimplement it. It is important you fou want to "reinit" teinit task.

Reimplemented in TaskRender, and TaskSimulationServer.

Definition at line 33 of file task.h.

References mLastTime.

Referenced by TaskRender::init().

void Task::update int  atime  )  [virtual]
 

Direct update from TaskManager.

Update the task. This method is called directly TaskManager Note that atime will overflow in 20 days and will start from zero. Children doesn't have to call this method when reimplementing but update(int dtime, int atime) won't work any more.

Parameters:
atime absolute time in ms

Reimplemented in MusicManager, TaskRender, TaskSimulation, Commander, and TaskManager.

Definition at line 15 of file task.cpp.

References LOGW, mLastTime, and update().

Here is the call graph for this function:

void Task::update int  dtime,
int  atime
[virtual]
 

Update call with difference from last call.

Update the task. Note that atime will overflow in 20 days. dtime will be allways OK. Children doesn't have to call this method when reimplementing.

Parameters:
dtime time in ms sice last call. May be == 0. Allways is nonnegative. In first call is == 0.
atime absolute time in ms

Reimplemented in FontManager, and TaskSimulationServer.

Definition at line 36 of file task.cpp.

References TVARIABLE2.

Referenced by update().


Member Data Documentation

int Task::mLastTime [protected]
 

Notification fot task, that current map will be unloaded Notification for task, that new map was loaded. remembers last time of update call. Invalid if == -1.

Task may load some aditional info from map or whatever :-)

Definition at line 106 of file task.h.

Referenced by init(), Task(), and update().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:25:47 2006 for bjs by  doxygen 1.4.5