1 //////////////////////////////////////////////////////////////////////////////// 2 // Scorched3D (c) 2000-2011 3 // 4 // This file is part of Scorched3D. 5 // 6 // Scorched3D is free software; you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation; either version 2 of the License, or 9 // (at your option) any later version. 10 // 11 // Scorched3D is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License along 17 // with this program; if not, write to the Free Software Foundation, Inc., 18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 //////////////////////////////////////////////////////////////////////////////// 20 21 #if !defined(__INCLUDE_TargetContainerh_INCLUDE__) 22 #define __INCLUDE_TargetContainerh_INCLUDE__ 23 24 #include <map> 25 #include <lang/LangString.h> 26 27 class Tank; 28 class Target; 29 class Tanket; 30 class TargetContainer 31 { 32 public: 33 TargetContainer(); 34 virtual ~TargetContainer(); 35 36 void addTarget(Target *target); 37 Target *removeTarget(unsigned int playerId); 38 Target *getTargetById(unsigned int id); 39 Tanket *getTanketById(unsigned int id); 40 Tank *getTankById(unsigned int id); 41 Tank *getTankByName(const LangString &name); 42 getTargets()43 std::map<unsigned int, Target *> &getTargets() { return targets_; } getTankets()44 std::map<unsigned int, Tanket *> &getTankets() { return tankets_; } getTanks()45 std::map<unsigned int, Tank *> &getTanks() { return tanks_; } 46 getCurrentTank()47 Tank *getCurrentTank() { return currentPlayer_; } getCurrentDestinationId()48 unsigned int getCurrentDestinationId() { return destinationId_; } setCurrentDestinationId(unsigned int did)49 void setCurrentDestinationId(unsigned int did) { destinationId_ = did; } getCurrentPlayerId()50 unsigned int getCurrentPlayerId() { return playerId_; } 51 void setCurrentPlayerId(unsigned int pid); getCurrentRoundId()52 unsigned int getCurrentRoundId() { return roundId_; } setCurrentRoundId(unsigned int rid)53 void setCurrentRoundId(unsigned int rid) { roundId_ = rid; } 54 55 int aliveCount(); 56 int teamCount(); 57 getNoOfTanks()58 int getNoOfTanks() { return tanks_.size(); } 59 int getNoOfNonSpectatorTanks(); 60 61 protected: 62 std::map<unsigned int, Target *> targets_; 63 std::map<unsigned int, Tanket *> tankets_; 64 std::map<unsigned int, Tank *> tanks_; 65 unsigned int playerId_; 66 unsigned int destinationId_; 67 unsigned int roundId_; 68 Tank *currentPlayer_; 69 }; 70 71 #endif // __INCLUDE_TargetContainerh_INCLUDE__ 72