Changeset 6142 in orxonox.OLD for trunk/src/story_entities/network_world.cc
- Timestamp:
- Dec 16, 2005, 7:13:57 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/network_world.cc
r6139 r6142 38 38 #include "shell.h" 39 39 40 #include "garbage_collector.h"41 40 #include "fast_factory.h" 42 41 #include "animation_player.h" … … 123 122 PRINTF(3)("NetworkWorld::~NetworkWorld() - deleting current world\n"); 124 123 125 126 // here everything that is alocated by the NetworkWorld is deleted127 delete this->entities;128 State::setWorldEntityList(NULL);129 130 124 delete this->localPlayer; 131 125 … … 141 135 SoundEngine::getInstance()->flushAllSources(); 142 136 143 137 if (State::getObjectManager() == &this->objectManager) 138 State::setObjectManager(NULL); 144 139 // erease everything that is left. 145 140 delete PNode::getNullParent(); … … 180 175 this->music = NULL; 181 176 this->shell = NULL; 182 this->entities = NULL;183 177 this->localPlayer = NULL; 184 178 this->localCamera = NULL; … … 214 208 ErrorMessage NetworkWorld::preLoad() 215 209 { 216 State::set WorldEntityList(this->entities = new tList<WorldEntity>());210 State::setObjectManager(&this->objectManager); 217 211 this->cycle = 0; 218 212 … … 233 227 234 228 GraphicsEngine::getInstance()->displayFPS(true); 235 236 CDEngine::getInstance()->setEntityList( this->entities);237 229 } 238 230 … … 630 622 631 623 /** 632 * gets the list of entities from the world633 * @returns entity list634 */635 tList<WorldEntity>* NetworkWorld::getEntities()636 {637 return this->entities;638 }639 640 641 /**642 624 * this returns the current game time 643 625 * @returns elapsed game time … … 648 630 } 649 631 650 651 632 /** 652 633 * function to put your own debug stuff into it. it can display informations about 653 634 the current class/procedure 654 635 */ 655 void NetworkWorld::debug()656 {657 PRINTF(0)("Printing out the List of alive NetworkWorldEntities:\n");658 tIterator<WorldEntity>* iterator = this->entities->getIterator();659 WorldEntity* entity = iterator->firstElement();660 while( entity != NULL)661 {662 PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName());663 entity = iterator->nextElement();664 }665 delete iterator;666 }636 // void NetworkWorld::debug() 637 // { 638 // PRINTF(0)("Printing out the List of alive NetworkWorldEntities:\n"); 639 // tIterator<WorldEntity>* iterator = this->entities->getIterator(); 640 // WorldEntity* entity = iterator->firstElement(); 641 // while( entity != NULL) 642 // { 643 // PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName()); 644 // entity = iterator->nextElement(); 645 // } 646 // delete iterator; 647 // } 667 648 668 649 … … 682 663 { 683 664 ++this->cycle; 684 PRINTF(4)("NetworkWorld::mainloop() - number of entities: %i\n", this->entities->getSize());665 // PRINTF(4)("NetworkWorld::mainloop() - number of entities: %i\n", this->entities->getSize()); 685 666 // Network 686 667 this->synchronize (); … … 727 708 } 728 709 710 void NetworkWorld::tick(std::list<WorldEntity*> entityList, float dt) 711 { 712 std::list<WorldEntity*>::iterator entity; 713 for (entity = entityList.begin(); entity != entityList.end(); entity++) 714 (*entity)->tick(dt); 715 716 } 729 717 730 718 /** … … 763 751 this->gameTime += this->dtS; 764 752 765 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 766 WorldEntity* entity = iterator->firstElement(); 767 while( entity != NULL) 768 { 769 entity->tick (this->dtS); 770 entity = iterator->nextElement(); 771 } 772 delete iterator; 753 /* this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS); 754 this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS); 755 this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);*/ 756 this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS); 757 this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS); 773 758 774 759 /* update tick the rest */ … … 780 765 781 766 ParticleEngine::getInstance()->tick(this->dtS); 782 GarbageCollector::getInstance()->tick(this->dtS);783 767 784 768 … … 805 789 void NetworkWorld::update() 806 790 { 807 GarbageCollector::getInstance()->update();808 791 GraphicsEngine::getInstance()->update(this->dtS); 809 792 PNode::getNullParent()->updateNode (this->dtS); … … 816 799 void NetworkWorld::collide() 817 800 { 818 CDEngine::getInstance()->checkCollisions(); 801 CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_00), 802 this->objectManager.getObjectList(OM_GROUP_01_PROJ)); 803 CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_01), 804 this->objectManager.getObjectList(OM_COMMON)); 819 805 } 820 806 … … 846 832 void NetworkWorld::draw () 847 833 { 848 /* draw entities */ 849 WorldEntity* entity; 850 glLoadIdentity(); 851 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 852 entity = iterator->firstElement(); 853 while( entity != NULL ) 854 { 855 if( entity->isVisible() ) entity->draw(); 856 if( unlikely( this->showBV)) entity->drawBVTree(3, 226); // to draw the bounding boxes of the objects at level 2 for debug purp 857 entity = iterator->nextElement(); 858 } 859 delete iterator; 834 GraphicsEngine* engine = GraphicsEngine::getInstance(); 835 engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK)); 836 engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON)); 837 engine->draw(State::getObjectManager()->getObjectList(OM_COMMON)); 838 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00)); 839 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01)); 840 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ)); 841 842 // { 843 // if( entity->isVisible() ) entity->draw(); 844 //FIXME 845 // if( unlikely( this->showBV)) entity->drawBVTree(3, 226); // to draw the bounding boxes of the objects at level 2 for debug purp 846 // entity = iterator->nextElement(); 847 // } 860 848 861 849 glCallList (objectList); … … 866 854 PNode::getNullParent()->debugDraw(0); 867 855 868 GraphicsEngine::getInstance()->draw();856 engine->draw(); 869 857 //TextEngine::getInstance()->draw(); 870 858 } … … 876 864 void NetworkWorld::spawn(WorldEntity* entity) 877 865 { 878 this->entities->add (entity);866 // this->entities->add (entity); 879 867 entity->postSpawn (); 880 868 } … … 889 877 void NetworkWorld::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir) 890 878 { 891 this->entities->add (entity);879 // this->entities->add (entity); 892 880 893 881 entity->setAbsCoor (*absCoor); … … 915 903 entity->setRelDir (*relDir); 916 904 917 this->entities->add (entity);905 // this->entities->add (entity); 918 906 919 907 entity->postSpawn ();
Note: See TracChangeset
for help on using the changeset viewer.