00001 //----------------------------------------------------------------------------------- 00002 // 00003 // Pro-Vocation Light Engine (PVLE) 00004 // Copyright (C) 2007-2009 Sukender, KinoX & Buzib 00005 // For more information, contact us : sukender@free.fr 00006 // 00007 // This program is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // For any use that is not compatible with the terms of the GNU 00013 // General Public License, please contact the authors for alternative 00014 // licensing options. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License along 00022 // with this program; if not, write to the Free Software Foundation, Inc., 00023 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00024 // 00025 //----------------------------------------------------------------------------------- 00026 00027 #ifndef GAME_PVLE_TEAM_H 00028 #define GAME_PVLE_TEAM_H 00029 00030 #include <PVLE/Export.h> 00031 #include <osg/Referenced> 00032 #include <osg/ref_ptr> 00033 #include <vector> 00034 #include <PVLE/Game/PVLEPlayer.h> 00035 00038 class PVLE_EXPORT PVLETeam : public osg::Referenced { 00039 public: 00040 void addPlayer(PVLEPlayer * pPlayer) { pPlayer->setTeam(this); vPlayersList.push_back(pPlayer); } 00041 void removePlayer(PVLEPlayer * pPlayer); 00042 PVLEPlayer * getPlayer(UINT index) { return vPlayersList[index].get(); } 00043 const PVLEPlayer * getPlayer(UINT index) const { return vPlayersList[index].get(); } 00044 UINT getNbPlayers() { return vPlayersList.size(); } 00045 00046 protected: 00047 friend class PVLEPlayer; 00048 std::vector<osg::ref_ptr<PVLEPlayer> > vPlayersList; 00049 00050 friend class PVLEGame; 00051 PVLEGame * pGame; // Game that holds this team (could be a osg::observer_ptr<PVLEGame>) 00052 00055 virtual ~PVLETeam() {} 00056 }; 00057 00058 #endif // GAME_PVLE_TEAM_H