ASR::TeamBuildings Class Reference

#include <TeamBuildings.h>

List of all members.

Public Member Functions

 TeamBuildings (unsigned int initialBuildings=0)
 ~TeamBuildings ()
BuildingcreateBuilding (String meshName, Vector3 position)
BuildinggetBuilding (size_t index)
size_t getNumBuildings ()

Private Types

typedef vector< Building * > BuildingList

Private Attributes

SceneNode * mTeamNode
BuildingList mBuildings
String mTeamName

Static Private Attributes

static int mNumTeams = 0


Detailed Description

Definition at line 24 of file TeamBuildings.h.


Member Typedef Documentation

typedef vector<Building*> ASR::TeamBuildings::BuildingList [private]

Definition at line 31 of file TeamBuildings.h.


Constructor & Destructor Documentation

ASR::TeamBuildings::TeamBuildings ( unsigned int  initialBuildings = 0  ) 

Definition at line 24 of file TeamBuildings.cpp.

References ASR::Game::getSceneManager(), ASR::Game::getSingletonPtr(), mBuildings, mNumTeams, mTeamName, and mTeamNode.

00025         {
00026                 mNumTeams++;
00027                 mTeamName = "team_buildings_" + StringConverter::toString ( mNumTeams );
00028 
00029                 SceneManager* sceneMgr = Game::getSingletonPtr ()->getSceneManager ();
00030                 mTeamNode = sceneMgr->getRootSceneNode()->createChildSceneNode( mTeamName );
00031 
00032                 mBuildings.reserve ( initialBuildings );
00033         }

ASR::TeamBuildings::~TeamBuildings (  ) 

Definition at line 37 of file TeamBuildings.cpp.

References mBuildings.

00038         {
00039                 BuildingList::iterator iter = mBuildings.begin ();
00040                 while ( iter != mBuildings.end() )
00041                 {
00042                         delete (*iter);
00043                         iter++;
00044                 }
00045         }


Member Function Documentation

Building * ASR::TeamBuildings::createBuilding ( String  meshName,
Vector3  position 
)

Definition at line 49 of file TeamBuildings.cpp.

References mBuildings, and mTeamNode.

Referenced by ASR::Team::createBuilding().

00050         {
00051                 Building* newBuilding = new Building ( mTeamNode, meshName, position );
00052 
00053                 mBuildings.push_back ( newBuilding );
00054 
00055                 return newBuilding;
00056         }

Building * ASR::TeamBuildings::getBuilding ( size_t  index  ) 

Definition at line 60 of file TeamBuildings.cpp.

References mBuildings.

00061         {
00062                 if ( index >= mBuildings.size() )
00063                         throw Exception ( Exception::ERR_ITEM_NOT_FOUND, "Building index to high", "TeamBuildings::getBuilding" );
00064 
00065                 return mBuildings[index];
00066         }

size_t ASR::TeamBuildings::getNumBuildings (  ) 

Definition at line 70 of file TeamBuildings.cpp.

References mBuildings.

00071         {
00072                 return mBuildings.size();
00073         }


Member Data Documentation

BuildingList ASR::TeamBuildings::mBuildings [private]

Definition at line 32 of file TeamBuildings.h.

Referenced by createBuilding(), getBuilding(), getNumBuildings(), TeamBuildings(), and ~TeamBuildings().

int ASR::TeamBuildings::mNumTeams = 0 [static, private]

Definition at line 34 of file TeamBuildings.h.

Referenced by TeamBuildings().

String ASR::TeamBuildings::mTeamName [private]

Definition at line 35 of file TeamBuildings.h.

Referenced by TeamBuildings().

SceneNode* ASR::TeamBuildings::mTeamNode [private]

Definition at line 29 of file TeamBuildings.h.

Referenced by createBuilding(), and TeamBuildings().


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