Last change
on this file since 5992 was
5968,
checked in by patrick, 19 years ago
|
network: merged the trunk into the network with the command svn merge -r5824:HEAD ../trunk network, changes changed… bla bla..
|
File size:
1.6 KB
|
Rev | Line | |
---|
[4744] | 1 | /* |
---|
[3655] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: ... |
---|
| 13 | co-programmer: ... |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
| 17 | |
---|
[5629] | 18 | #include "object_manager.h" |
---|
[5795] | 19 | #include "class_list.h" |
---|
[3655] | 20 | |
---|
[5795] | 21 | #include "p_node.h" |
---|
| 22 | #include "world_entity.h" |
---|
| 23 | #include "list.h" |
---|
| 24 | |
---|
[3655] | 25 | using namespace std; |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | /** |
---|
[4838] | 29 | * standard constructor |
---|
| 30 | */ |
---|
[5629] | 31 | ObjectManager::ObjectManager () |
---|
[3655] | 32 | { |
---|
[5629] | 33 | this->setClassID(CL_OBJECT_MANAGER, "ObjectManager"); |
---|
| 34 | this->setName("ObjectManager"); |
---|
[5795] | 35 | |
---|
| 36 | pNodeList = NULL; |
---|
[3655] | 37 | } |
---|
| 38 | |
---|
| 39 | /** |
---|
[4838] | 40 | * the singleton reference to this class |
---|
| 41 | */ |
---|
[5629] | 42 | ObjectManager* ObjectManager::singletonRef = NULL; |
---|
[3655] | 43 | |
---|
| 44 | /** |
---|
[4838] | 45 | @brief standard deconstructor |
---|
| 46 | */ |
---|
[5629] | 47 | ObjectManager::~ObjectManager () |
---|
[3655] | 48 | { |
---|
[5629] | 49 | ObjectManager::singletonRef = NULL; |
---|
[3655] | 50 | } |
---|
[5795] | 51 | |
---|
| 52 | /** |
---|
| 53 | * returns a new List with a list of WorldEntities of distance Radius from center |
---|
| 54 | */ |
---|
| 55 | std::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 | if ((dynamic_cast<PNode*>(*node)->getAbsCoor() - center.getAbsCoor()).len() < radius) |
---|
| 65 | newList->push_back(dynamic_cast<WorldEntity*>(*node)); |
---|
| 66 | return newList; |
---|
| 67 | } |
---|
| 68 | return NULL; |
---|
| 69 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.