ASR::ClientUpdater Class Reference

#include <ClientUpdater.h>

Inheritance diagram for ASR::ClientUpdater:

Inheritance graph
[legend]
Collaboration diagram for ASR::ClientUpdater:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ClientUpdater (Client *parentClient)
 ~ClientUpdater ()
bool updateBeforeFrame (const FrameEvent &e, const InputReader *inputDevice)
 Called each frame to perform the "update".
bool updateAfterFrame (const FrameEvent &e, const InputReader *inputDevice)

Private Member Functions

void _findVisibleObjects () const
void _showUnit (Unit *unit) const
void _hideUnit (Unit *unit) const

Private Attributes

ClientmClient

Detailed Description

Definition at line 13 of file ClientUpdater.h.


Constructor & Destructor Documentation

ASR::ClientUpdater::ClientUpdater ( Client parentClient  ) 

Definition at line 17 of file ClientUpdater.cpp.

00018                 : mClient ( parentClient )
00019         {
00020         }

ASR::ClientUpdater::~ClientUpdater (  ) 

Definition at line 24 of file ClientUpdater.cpp.

00025         {
00026 
00027         }


Member Function Documentation

void ASR::ClientUpdater::_findVisibleObjects (  )  const [private]

Definition at line 47 of file ClientUpdater.cpp.

References _hideUnit(), _showUnit(), ASR::Level::getEnemyTeams(), ASR::Team::getFogOfWar(), ASR::Level::getSingleton(), ASR::FogOfWar::isUnitVisible(), mClient, and ASR::Client::mTeam.

Referenced by updateBeforeFrame().

00048         {
00049                 FogOfWar* fog = mClient->mTeam->getFogOfWar ();
00050 
00051                 Level::TeamList enemyList = Level::getSingleton ().getEnemyTeams ( mClient->mTeam );
00052                 Level::TeamIterator iter ( enemyList.begin(), enemyList.end() );
00053 
00054                 while ( iter.hasMoreElements () )
00055                 {
00056                         Team* enemyTeam = iter.getNext ();
00057                         TeamUnits::UnitIterator unitIter = enemyTeam->getUnitIterator ();
00058                         while ( unitIter.hasMoreElements () )
00059                         {
00060                                 Unit* enemyUnit = unitIter.getNext ();
00061 
00062                                 // HACK
00063                                 //              Dead units should still be visible as long as they are dying
00064                                 if ( !enemyUnit->isDead() && fog->isUnitVisible ( enemyUnit ) )
00065                                 {
00066                                         _showUnit ( enemyUnit );
00067                                 }
00068                                 else
00069                                 {
00070                                         _hideUnit ( enemyUnit );
00071                                 }
00072                         }
00073                 }
00074         }

void ASR::ClientUpdater::_hideUnit ( Unit unit  )  const [private]

Definition at line 91 of file ClientUpdater.cpp.

Referenced by _findVisibleObjects().

00092         {
00093                 unit->getEntity ()->getParentSceneNode ()->setVisible ( false );
00094                 Entity::ChildObjectListIterator iter = unit->getEntity ()->getAttachedObjectIterator ();
00095                 while ( iter.hasMoreElements () )
00096                 {
00097                         MovableObject* obj = iter.getNext ();
00098                         obj->setVisible ( false );
00099                 }
00100         }

void ASR::ClientUpdater::_showUnit ( Unit unit  )  const [private]

Definition at line 78 of file ClientUpdater.cpp.

Referenced by _findVisibleObjects().

00079         {
00080                 unit->getEntity ()->getParentSceneNode ()->setVisible ( true );
00081                 Entity::ChildObjectListIterator iter = unit->getEntity ()->getAttachedObjectIterator ();
00082                 while ( iter.hasMoreElements () )
00083                 {
00084                         MovableObject* obj = iter.getNext ();
00085                         obj->setVisible ( true );
00086                 }
00087         }

bool ASR::ClientUpdater::updateAfterFrame ( const FrameEvent &  e,
const InputReader *  inputDevice 
) [virtual]

Implements ASR::Updater.

Definition at line 40 of file ClientUpdater.cpp.

00041         {
00042                 return true;
00043         }

bool ASR::ClientUpdater::updateBeforeFrame ( const FrameEvent &  e,
const InputReader *  inputDevice 
) [virtual]

Called each frame to perform the "update".

Return true if rendering should continue, false otherwise.

Implements ASR::Updater.

Definition at line 31 of file ClientUpdater.cpp.

References _findVisibleObjects().

00032         {
00033                 _findVisibleObjects ();
00034 
00035                 return true;
00036         }


Member Data Documentation

Client* ASR::ClientUpdater::mClient [private]

Definition at line 18 of file ClientUpdater.h.

Referenced by _findVisibleObjects().


The documentation for this class was generated from the following files:
Generated on Sun Jun 25 19:23:44 2006 for Valors End by  doxygen 1.4.7