Changeset 8307 for code/branches/kicklib2/src/orxonox/PawnManager.cc
- Timestamp:
- Apr 22, 2011, 10:23:04 PM (14 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.