Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Nov 27, 2005, 4:04:52 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/worldEntities back to the trunk svn merge -r5750:HEAD branches/world_entities/ trunk/

Location:
trunk/src/util
Files:
2 edited

Legend:

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

    r5750 r5795  
    1717
    1818#include "object_manager.h"
     19#include "class_list.h"
     20
     21#include "p_node.h"
     22#include "world_entity.h"
     23#include "list.h"
    1924
    2025using namespace std;
     
    2833   this->setClassID(CL_OBJECT_MANAGER, "ObjectManager");
    2934   this->setName("ObjectManager");
     35
     36   pNodeList = NULL;
    3037}
    3138
     
    4249  ObjectManager::singletonRef = NULL;
    4350}
     51
     52/**
     53 * returns a new List with a list of WorldEntities of distance Radius from center
     54 */
     55std::list<WorldEntity*>* ObjectManager::distanceFromObject(const PNode& center, float radius, ClassID classID)
     56{
     57  const std::list<BaseObject*>* objectList = ClassList::getList(classID);
     58  if (objectList != NULL)
     59  {
     60    std::list<WorldEntity*>* newList = new std::list<WorldEntity*>;
     61
     62    list<BaseObject*>::const_iterator node;
     63    for (node = objectList->begin(); node != objectList->end(); node++)
     64    {
     65      printf("1:::%s\n", (*node)->getName());
     66      if ((dynamic_cast<PNode*>(*node)->getAbsCoor() - center.getAbsCoor()).len() < radius)
     67      {
     68        newList->push_back(dynamic_cast<WorldEntity*>(*node));
     69        printf("%s\n",(*node)->getName());
     70      }
     71    }
     72    return newList;
     73  }
     74  return NULL;
     75}
  • trunk/src/util/object_manager.h

    r5750 r5795  
    1111
    1212// FORWARD DECLARATION
    13 
     13class PNode;
     14class WorldEntity;
    1415
    1516class ObjectGroupList
     
    3031
    3132
     33  static std::list<WorldEntity*>* distanceFromObject(const PNode& center, float radius, ClassID classID);
     34
    3235  ObjectGroupList* getGroupList( );
    3336
     
    3841  std::list<ObjectGroupList>           groupList;
    3942
     43  const std::list<BaseObject>*         pNodeList;
     44
    4045
    4146};
Note: See TracChangeset for help on using the changeset viewer.