#include <TeamBuildings.h>
Public Member Functions | |
TeamBuildings (unsigned int initialBuildings=0) | |
~TeamBuildings () | |
Building * | createBuilding (String meshName, Vector3 position) |
Building * | getBuilding (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 |
Definition at line 24 of file TeamBuildings.h.
typedef vector<Building*> ASR::TeamBuildings::BuildingList [private] |
Definition at line 31 of file TeamBuildings.h.
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 }
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 }
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] |
String ASR::TeamBuildings::mTeamName [private] |
SceneNode* ASR::TeamBuildings::mTeamNode [private] |