- Timestamp:
- Dec 16, 2005, 5:16:00 PM (19 years ago)
- Location:
- branches/objectmanager/src
- Files:
-
- 2 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/objectmanager/src/orxonox.cc
r6079 r6134 43 43 #include "text_engine.h" 44 44 #include "event_handler.h" 45 #include "garbage_collector.h"46 45 47 46 #include "factory.h" … … 96 95 // game-specific 97 96 delete GameLoader::getInstance(); 98 delete GarbageCollector::getInstance();99 97 100 98 // class-less services/factories -
branches/objectmanager/src/story_entities/world.cc
r6126 r6134 38 38 #include "shell.h" 39 39 40 #include "garbage_collector.h"41 40 #include "fast_factory.h" 42 41 #include "animation_player.h" … … 122 121 delete this->shell; 123 122 PRINTF(3)("World::~World() - deleting current world\n"); 124 125 126 // here everything that is alocated by the World is deleted127 delete this->entities;128 State::setWorldEntityList(NULL);129 123 130 124 delete this->localPlayer; … … 181 175 this->music = NULL; 182 176 this->shell = NULL; 183 this->entities = NULL;184 177 this->localPlayer = NULL; 185 178 this->localCamera = NULL; … … 216 209 { 217 210 State::setObjectManager(&this->objectManager); 218 State::setWorldEntityList(this->entities = new tList<WorldEntity>());219 211 this->cycle = 0; 220 212 … … 588 580 589 581 /** 590 * gets the list of entities from the world591 * @returns entity list592 */593 tList<WorldEntity>* World::getEntities()594 {595 return this->entities;596 }597 598 599 /**600 582 * this returns the current game time 601 583 * @returns elapsed game time … … 605 587 return this->gameTime; 606 588 } 607 608 609 /**610 * function to put your own debug stuff into it. it can display informations about611 the current class/procedure612 */613 void World::debug()614 {615 PRINTF(0)("Printing out the List of alive WorldEntities:\n");616 tIterator<WorldEntity>* iterator = this->entities->getIterator();617 WorldEntity* entity = iterator->firstElement();618 while( entity != NULL)619 {620 PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName());621 entity = iterator->nextElement();622 }623 delete iterator;624 }625 626 589 627 590 /** … … 640 603 { 641 604 ++this->cycle; 642 PRINTF(4)("World::mainloop() - number of entities: %i\n", this->entities->getSize());643 605 // Network 644 606 this->synchronize (); … … 685 647 } 686 648 649 void World::tick(std::list<WorldEntity*> entityList, float dt) 650 { 651 std::list<WorldEntity*>::iterator entity; 652 for (entity = entityList.begin(); entity != entityList.end(); entity++) 653 (*entity)->tick(dt); 654 655 } 687 656 688 657 /** … … 721 690 this->gameTime += this->dtS; 722 691 723 724 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 725 WorldEntity* entity = iterator->firstElement(); 726 while( entity != NULL) 727 { 728 entity->tick (this->dtS); 729 entity = iterator->nextElement(); 730 } 731 delete iterator; 692 this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS); 693 this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS); 694 this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS); 695 this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS); 696 this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS); 697 698 // tIterator<WorldEntity>* iterator = this->entities->getIterator(); 699 // WorldEntity* entity = iterator->firstElement(); 700 // while( entity != NULL) 701 // { 702 // entity->tick (this->dtS); 703 // entity = iterator->nextElement(); 704 // } 705 // delete iterator; 732 706 733 707 /* update tick the rest */ … … 739 713 740 714 ParticleEngine::getInstance()->tick(this->dtS); 741 GarbageCollector::getInstance()->tick(this->dtS);742 715 743 716 … … 764 737 void World::update() 765 738 { 766 GarbageCollector::getInstance()->update();767 739 GraphicsEngine::getInstance()->update(this->dtS); 768 740 PNode::getNullParent()->updateNode (this->dtS); … … 813 785 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01)); 814 786 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ)); 815 816 817 /* draw entities */ 818 WorldEntity* entity; 819 glLoadIdentity(); 820 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 821 entity = iterator->firstElement(); 822 while( entity != NULL ) 823 { 824 if( entity->isVisible() ) entity->draw(); 825 if( unlikely( this->showBV)) entity->drawBVTree(3, 226); // to draw the bounding boxes of the objects at level 2 for debug purp 826 entity = iterator->nextElement(); 827 } 828 delete iterator; 787 788 // { 789 // if( entity->isVisible() ) entity->draw(); 790 //FIXME 791 // if( unlikely( this->showBV)) entity->drawBVTree(3, 226); // to draw the bounding boxes of the objects at level 2 for debug purp 792 // entity = iterator->nextElement(); 793 // } 829 794 830 795 glCallList (objectList); … … 845 810 void World::spawn(WorldEntity* entity) 846 811 { 847 this->entities->add (entity);812 // this->entities->add (entity); 848 813 entity->postSpawn (); 849 814 } … … 858 823 void World::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir) 859 824 { 860 this->entities->add (entity);825 // this->entities->add (entity); 861 826 862 827 entity->setAbsCoor (*absCoor); … … 884 849 entity->setRelDir (*relDir); 885 850 886 this->entities->add (entity);851 // this->entities->add (entity); 887 852 888 853 entity->postSpawn (); -
branches/objectmanager/src/story_entities/world.h
r6121 r6134 23 23 class Shell; 24 24 class OggPlayer; 25 26 template<class T> class tList;27 25 28 26 //! The game world … … 61 59 bool command (Command* cmd); 62 60 63 tList<WorldEntity>* getEntities();64 65 61 /* interface to world */ 66 62 void spawn (WorldEntity* entity); … … 84 80 void synchronize (); 85 81 void handleInput (); 82 void tick (std::list<WorldEntity*> worldEntity, float dt); 86 83 void tick (); 87 84 void update (); … … 120 117 121 118 GLuint objectList; //!< temporary: @todo this will be ereased soon 122 tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. 119 123 120 Player* localPlayer; //!< The Player, you fly through the level. 124 121 }; -
branches/objectmanager/src/util/Makefile.am
r5750 r6134 7 7 object_manager.cc \ 8 8 loading/factory.cc \ 9 garbage_collector.cc \10 9 state.cc \ 11 10 user_control.cc \ … … 19 18 track/pilot_node.cc \ 20 19 track/track_manager.cc \ 21 track/track_node.cc 20 track/track_node.cc 22 21 23 22 noinst_HEADERS = fast_factory.h \ 24 23 object_manager.h \ 25 garbage_collector.h \26 24 state.h \ 27 25 user_control.h \ -
branches/objectmanager/src/util/state.cc
r6121 r6134 30 30 31 31 ObjectManager* State::objectManager = NULL; 32 tList<WorldEntity>* State::worldEntityList = NULL;33 32 34 33 /** -
branches/objectmanager/src/util/state.h
r6121 r6134 10 10 class PNode; 11 11 class WorldEntity; 12 template<class T> class tList;13 12 class ObjectManager; 14 13 … … 43 42 /// WORLD_ENTITY_LIST /// 44 43 ///////////////////////// 45 /** @param worldEntityList The World's List of WorldEntities */46 static inline void setWorldEntityList(tList<WorldEntity>* worldEntityList) { State::worldEntityList = worldEntityList; };47 /** @returns the List of WorldEntities */48 static inline tList<WorldEntity>* getWorldEntityList() { return State::worldEntityList; };49 44 50 45 private: … … 56 51 static ObjectManager* objectManager; //!< A referenct to the current ObjectManager 57 52 58 static tList<WorldEntity>* worldEntityList; //!< The List of the worldEntities59 60 //tStack<61 53 }; 62 54 -
branches/objectmanager/src/world_entities/npcs/npc.cc
r6121 r6134 50 50 WorldEntity* powerUp = new TurretPowerUp(); 51 51 powerUp->setAbsCoor(this->getAbsCoor()); 52 State::getWorldEntityList()->add(powerUp);52 powerUp->toList(OM_COMMON); 53 53 } 54 54 else if ((float)rand()/RAND_MAX < .3) … … 56 56 WorldEntity* powerUp = new LaserPowerUp(); 57 57 powerUp->setAbsCoor(this->getAbsCoor()); 58 State::getWorldEntityList()->add(powerUp);58 powerUp->toList(OM_COMMON); 59 59 } 60 State::getWorldEntityList()->remove(this);60 this->toList(OM_DEAD); 61 61 this->removeNode(); 62 62 … … 68 68 { 69 69 this->setVisibiliy(false); 70 State::getWorldEntityList()->remove(this);70 this->toList(OM_DEAD); 71 71 this->removeNode(); 72 72 } -
branches/objectmanager/src/world_entities/power_ups/laser_power_up.cc
r5994 r6134 80 80 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 81 81 if (entity->isA(CL_PLAYABLE)) 82 State::getWorldEntityList()->remove(this);82 this->toList(OM_DEAD); 83 83 } 84 84 -
branches/objectmanager/src/world_entities/power_ups/turret_power_up.cc
r5994 r6134 80 80 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 81 81 if (entity->isA(CL_PLAYABLE)) 82 State::getWorldEntityList()->remove(this);82 this->toList(OM_DEAD); 83 83 } 84 84 -
branches/objectmanager/src/world_entities/test_entity.cc
r6122 r6134 71 71 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 72 72 this->setVisibiliy(false); 73 State::getWorldEntityList()->remove(this);73 this->toList(OM_DEAD); 74 74 } 75 75 } -
branches/objectmanager/src/world_entities/weapons/aim.cc
r6078 r6134 104 104 void Aim::searchTarget(float range) 105 105 { 106 tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 106 //FIXME// 107 /* tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 107 108 WorldEntity* entity = iterator->firstElement(); 108 109 while (likely(entity != NULL)) … … 121 122 } 122 123 123 delete iterator; 124 delete iterator;*/ 124 125 } 125 126 -
branches/objectmanager/src/world_entities/weapons/bomb.cc
r6123 r6134 174 174 void Bomb::activate() 175 175 { 176 State::getWorldEntityList()->add(this);177 176 178 177 } … … 180 179 void Bomb::deactivate() 181 180 { 182 this->toList(OM_NULL); 183 State::getWorldEntityList()->remove(this); 181 this->toList(OM_DEAD); 184 182 this->lifeCycle = 0.0f; 185 183 Bomb::fastFactory->kill(this); -
branches/objectmanager/src/world_entities/weapons/guided_missile.cc
r6126 r6134 85 85 void GuidedMissile::activate() 86 86 { 87 State::getWorldEntityList()->add(this);88 87 if (unlikely(GuidedMissile::trailParticles == NULL)) 89 88 { … … 129 128 this->lifeCycle = 0.0; 130 129 131 this->toList(OM_NULL); 132 // GarbageCollector::getInstance()->collect(this); 133 State::getWorldEntityList()->remove(this); 130 this->toList(OM_DEAD); 134 131 this->removeNode(); 135 132 GuidedMissile::fastFactory->kill(this); -
branches/objectmanager/src/world_entities/weapons/laser.cc
r6123 r6134 77 77 void Laser::activate() 78 78 { 79 State::getWorldEntityList()->add(this);80 79 if (unlikely(Laser::explosionParticles == NULL)) 81 80 { … … 99 98 this->toList(OM_NULL); 100 99 101 State::getWorldEntityList()->remove(this);100 this->toList(OM_DEAD); 102 101 this->removeNode(); 103 102 Laser::fastFactory->kill(this); -
branches/objectmanager/src/world_entities/weapons/projectile.cc
r6078 r6134 22 22 #include "weapon.h" 23 23 #include "model.h" 24 25 #include "garbage_collector.h"26 24 27 25 using namespace std; -
branches/objectmanager/src/world_entities/weapons/rocket.cc
r6123 r6134 82 82 void Rocket::activate() 83 83 { 84 State::getWorldEntityList()->add(this);85 84 if (unlikely(Rocket::trailParticles == NULL)) 86 85 { … … 128 127 129 128 // GarbageCollector::getInstance()->collect(this); 130 State::getWorldEntityList()->remove(this);129 this->toList(OM_DEAD); 131 130 Rocket::fastFactory->kill(this); 132 131 } -
branches/objectmanager/src/world_entities/weapons/test_bullet.cc
r6123 r6134 82 82 void TestBullet::activate() 83 83 { 84 State::getWorldEntityList()->add(this);85 84 if (unlikely(TestBullet::trailParticles == NULL)) 86 85 { … … 121 120 this->toList(OM_NULL); 122 121 123 // GarbageCollector::getInstance()->collect(this);124 State::getWorldEntityList()->remove(this);125 122 TestBullet::fastFactory->kill(this); 126 123 }
Note: See TracChangeset
for help on using the changeset viewer.