Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7368 in orxonox.OLD for trunk/src/util


Ignore:
Timestamp:
Apr 25, 2006, 11:37:59 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some renamings, and GameWorldData now has lists for what EntityLists should be drawed/ticked/collided(not yet implemented).

Location:
trunk/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/object_manager.cc

    r7221 r7368  
    105105
    106106/**
    107  * returns a new List with a list of WorldEntities of distance Radius from center
    108  */
    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 */
     109void ObjectManager::distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID)
    110110{
    111111  const std::list<BaseObject*>* objectList = ClassList::getList(classID);
    112112  if (objectList != NULL)
    113113  {
    114     std::list<WorldEntity*>* newList = new std::list<WorldEntity*>;
    115114
    116115    list<BaseObject*>::const_iterator node;
    117116    for (node = objectList->begin(); node != objectList->end(); node++)
    118117      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  }
    123120}
    124121
  • trunk/src/util/object_manager.h

    r7221 r7368  
    6767
    6868//! A powerfull handler for the Object (WorldEntities) in the World.
    69 class ObjectManager : public BaseObject {
     69class ObjectManager : public BaseObject
     70{
     71public:
     72  typedef std::list<WorldEntity*> EntityList;      //!< A type definition to make it easy to use EntityLists.
    7073
    71  public:
    72    ObjectManager();
    73    virtual ~ObjectManager();
     74  ObjectManager();
     75  virtual ~ObjectManager();
    7476
    7577  void flush();
     
    7981
    8082
    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]; }
    8387
    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);
    8589
    8690  void debug(OM_LIST omList, unsigned int level = 0) const;
     
    9094  static const char* OMListToString(OM_LIST omList);
    9195
    92  private:
    93   const std::list<BaseObject>*            pNodeList;
     96private:
     97  const std::list<BaseObject>*            pNodeList;                //!< The List of PNodes.
    9498
    95 
    96   std::list<WorldEntity*>                 objectLists[OM_SIZE];
     99  EntityList                              objectLists[OM_SIZE];     //!< The ObjectLists.
    97100
    98101  static const char*                      objectManagerListNames[]; //!< Names of all the lists
Note: See TracChangeset for help on using the changeset viewer.