Changeset 6134 in orxonox.OLD for branches/objectmanager/src/story_entities
- Timestamp:
- Dec 16, 2005, 5:16:00 PM (19 years ago)
- Location:
- branches/objectmanager/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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 };
Note: See TracChangeset
for help on using the changeset viewer.