Changeset 8802 in orxonox.OLD for trunk/src/world_entities/spawning_point.cc
- Timestamp:
- Jun 26, 2006, 4:46:25 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/spawning_point.cc
r8068 r8802 24 24 #include "compiler.h" 25 25 26 #include <map> 26 #include "state.h" 27 #include "game_rules.h" 27 28 28 29 … … 59 60 { 60 61 this->setClassID(CL_SPAWNING_POINT, "SpawningPoint"); 62 63 this->teamId = -1; 61 64 } 62 65 … … 81 84 LoadParam(root, "delay", this, SpawningPoint, setSpawningDelay) 82 85 .describe("sets the delay of the spawning point"); 86 87 /* load teamId */ 88 LoadParam(root, "teamId", this, SpawningPoint, setTeamId) 89 .describe("sets teamId"); 83 90 84 91 … … 101 108 void SpawningPoint::pushEntity(WorldEntity* entity, float delay) 102 109 { 103 this->queue[entity] = this->localTimer + delay; 110 QueueEntry qe; 111 qe.entity = entity; 112 qe.list = entity->getOMListNumber(); 113 qe.respawnTime = this->localTimer + delay; 114 115 queue.push_back( qe ); 104 116 } 105 117 … … 113 125 114 126 115 //BaseObject* spawningEntity = Factory::fabricate(this->classID); 116 // if( likely(this->world != NULL)) 117 // this->world->spawn(dynamic_cast<WorldEntity*>(spawningEntity)); 127 entity->setAbsCoor( this->getAbsCoor() ); 128 entity->setAbsDir( this->getAbsDir() ); 129 130 //TODO set camera (not smooth) 118 131 } 119 132 … … 129 142 this->localTimer += dt; 130 143 131 std:: map<WorldEntity*, float>::iterator it = this->queue.begin();132 for( ; it != this->queue.end(); it++)144 std::list<QueueEntry>::iterator it = this->queue.begin(); 145 for( ; it != this->queue.end(); ) 133 146 { 134 //135 if( it-> second<= this->localTimer)147 148 if( it->respawnTime <= this->localTimer) 136 149 { 137 150 //spawn the player 138 this->spawn(it->first); 151 this->spawn(it->entity); 152 153 it->entity->toList( it->list ); 154 155 if ( State::getGameRules() ) 156 { 157 (State::getGameRules())->registerSpawn( it->entity ); 158 } 159 160 std::list<QueueEntry>::iterator delit = it; 161 it++; 162 163 queue.erase( delit ); 164 165 continue; 139 166 } 167 168 it++; 140 169 } 141 170
Note: See TracChangeset
for help on using the changeset viewer.