Changeset 7368 in orxonox.OLD for trunk/src/util
- Timestamp:
- Apr 25, 2006, 11:37:59 PM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/object_manager.cc
r7221 r7368 105 105 106 106 /** 107 * returns a new List with a list of WorldEntities of distance Radius from center108 */ 109 std::list<WorldEntity*>* ObjectManager::distanceFromObject(const PNode& center, float radius, ClassID classID)107 * @returns a new List with a list of WorldEntities of distance Radius from center 108 */ 109 void ObjectManager::distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID) 110 110 { 111 111 const std::list<BaseObject*>* objectList = ClassList::getList(classID); 112 112 if (objectList != NULL) 113 113 { 114 std::list<WorldEntity*>* newList = new std::list<WorldEntity*>;115 114 116 115 list<BaseObject*>::const_iterator node; 117 116 for (node = objectList->begin(); node != objectList->end(); node++) 118 117 if ((dynamic_cast<PNode*>(*node)->getAbsCoor() - center.getAbsCoor()).len() < radius) 119 newList->push_back(dynamic_cast<WorldEntity*>(*node)); 120 return newList; 121 } 122 return NULL; 118 entities.push_back(dynamic_cast<WorldEntity*>(*node)); 119 } 123 120 } 124 121 -
trunk/src/util/object_manager.h
r7221 r7368 67 67 68 68 //! A powerfull handler for the Object (WorldEntities) in the World. 69 class ObjectManager : public BaseObject { 69 class ObjectManager : public BaseObject 70 { 71 public: 72 typedef std::list<WorldEntity*> EntityList; //!< A type definition to make it easy to use EntityLists. 70 73 71 public: 72 ObjectManager(); 73 virtual ~ObjectManager(); 74 ObjectManager(); 75 virtual ~ObjectManager(); 74 76 75 77 void flush(); … … 79 81 80 82 81 std::list<WorldEntity*>& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; } 82 const std::list<WorldEntity*>& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; } 83 /** @returns the List (listnumber) of objects. @param listNumber the List to get. */ 84 EntityList& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; } 85 /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */ 86 const EntityList& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; } 83 87 84 static std::list<WorldEntity*>* distanceFromObject(const PNode& center, float radius, ClassID classID);88 static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID); 85 89 86 90 void debug(OM_LIST omList, unsigned int level = 0) const; … … 90 94 static const char* OMListToString(OM_LIST omList); 91 95 92 93 const std::list<BaseObject>* pNodeList; 96 private: 97 const std::list<BaseObject>* pNodeList; //!< The List of PNodes. 94 98 95 96 std::list<WorldEntity*> objectLists[OM_SIZE]; 99 EntityList objectLists[OM_SIZE]; //!< The ObjectLists. 97 100 98 101 static const char* objectManagerListNames[]; //!< Names of all the lists
Note: See TracChangeset
for help on using the changeset viewer.