Changeset 8307 for code/branches/kicklib2/src
- Timestamp:
- Apr 22, 2011, 10:23:04 PM (14 years ago)
- Location:
- code/branches/kicklib2/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2/src/orxonox/PawnManager.cc
r5929 r8307 29 29 #include "PawnManager.h" 30 30 31 #include "util/ScopedSingletonManager.h" 31 32 #include "core/CoreIncludes.h" 32 33 #include "worldentities/pawns/Pawn.h" … … 34 35 namespace orxonox 35 36 { 36 PawnManager* PawnManager::singletonPtr_s = 0;37 ManageScopedSingleton(PawnManager, ScopeID::Root, false); 37 38 38 39 PawnManager::PawnManager() … … 43 44 PawnManager::~PawnManager() 44 45 { 46 // Be sure to delete all the pawns 47 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ) 48 (it++)->destroy(); 45 49 } 46 50 47 void PawnManager:: touch()51 void PawnManager::preUpdate(const Clock& time) 48 52 { 49 if (!PawnManager::singletonPtr_s) 50 new PawnManager(); 51 } 52 53 void PawnManager::tick(float dt) 54 { 55 unsigned int count = 0; 56 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++count) 53 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ) 57 54 { 58 55 if (!it->isAlive()) … … 61 58 ++it; 62 59 } 63 64 if (count == 0)65 this->destroy();66 60 } 67 61 } -
code/branches/kicklib2/src/orxonox/PawnManager.h
r5781 r8307 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport PawnManager : p rotectedSingleton<PawnManager>, public Tickable39 class _OrxonoxExport PawnManager : public Singleton<PawnManager>, public Tickable 40 40 { 41 41 friend class Singleton<PawnManager>; 42 42 public: 43 static void touch(); 43 PawnManager(); 44 virtual ~PawnManager(); 44 45 45 virtual void tick(float dt);46 virtual void preUpdate(const Clock& time); 46 47 47 48 private: 48 PawnManager();49 virtual ~PawnManager();50 49 51 50 static PawnManager* singletonPtr_s; -
code/branches/kicklib2/src/orxonox/worldentities/pawns/Pawn.cc
r7889 r8307 36 36 #include "network/NetworkFunction.h" 37 37 38 #include "PawnManager.h"39 38 #include "infos/PlayerInfo.h" 40 39 #include "controllers/Controller.h" … … 59 58 RegisterObject(Pawn); 60 59 61 PawnManager::touch();62 60 this->bAlive_ = true; 63 61 this->bReload_ = false;
Note: See TracChangeset
for help on using the changeset viewer.