Changeset 8801 in orxonox.OLD for branches/network/src/world_entities
- Timestamp:
- Jun 26, 2006, 4:30:31 PM (19 years ago)
- Location:
- branches/network/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/spawning_point.cc
r8798 r8801 24 24 #include "compiler.h" 25 25 26 #include <map> 26 #include "state.h" 27 #include "game_rules.h" 27 28 28 29 … … 107 108 void SpawningPoint::pushEntity(WorldEntity* entity, float delay) 108 109 { 109 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 ); 110 116 } 111 117 … … 119 125 120 126 121 //BaseObject* spawningEntity = Factory::fabricate(this->classID); 122 // if( likely(this->world != NULL)) 123 // this->world->spawn(dynamic_cast<WorldEntity*>(spawningEntity)); 127 entity->setAbsCoor( this->getAbsCoor() ); 128 entity->setAbsDir( this->getAbsDir() ); 129 130 //TODO set camera (not smooth) 124 131 } 125 132 … … 135 142 this->localTimer += dt; 136 143 137 std:: map<WorldEntity*, float>::iterator it = this->queue.begin();138 for( ; it != this->queue.end(); it++)144 std::list<QueueEntry>::iterator it = this->queue.begin(); 145 for( ; it != this->queue.end(); ) 139 146 { 140 //141 if( it-> second<= this->localTimer)147 148 if( it->respawnTime <= this->localTimer) 142 149 { 143 150 //spawn the player 144 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; 145 166 } 167 168 it++; 146 169 } 147 170 -
branches/network/src/world_entities/spawning_point.h
r8798 r8801 8 8 #define _SPAWNING_POINT 9 9 10 #include " world_entity.h"10 #include "playable.h" 11 11 12 #include < map>12 #include <list> 13 13 14 14 class World; 15 15 class TiXmlElement; 16 16 17 struct QueueEntry 18 { 19 float respawnTime; 20 WorldEntity * entity; 21 OM_LIST list; 22 }; 17 23 18 24 //!< used to indicate what type of objects are spawned by this spawning point … … 78 84 ClassID classid; //!< the classid of the entity to spawn 79 85 SpawningPointMode mode; //!< the mode of the spawning point 80 std:: map<WorldEntity*, float>queue; //!< queue of waiting WorldEntities to be spawned86 std::list<QueueEntry> queue; //!< queue of waiting WorldEntities to be spawned 81 87 bool bSpawning; //!< flag to indicate if this spawning point is active or not 82 88 };
Note: See TracChangeset
for help on using the changeset viewer.