Last change
on this file since 273 was
270,
checked in by rgrieder, 17 years ago
|
- added old version of class hierarchy in order to make things work (is not actually needed, but will be later anyway)
- added the hud wrapper and the media files required
|
File size:
1.7 KB
|
Line | |
---|
1 | #include "ObjectList.h" |
---|
2 | |
---|
3 | namespace orxonox |
---|
4 | { |
---|
5 | // ############################### |
---|
6 | // ### ObjectList ### |
---|
7 | // ############################### |
---|
8 | ObjectList::ObjectList() |
---|
9 | { |
---|
10 | this->first_ = 0; |
---|
11 | } |
---|
12 | |
---|
13 | ObjectList::~ObjectList() |
---|
14 | { |
---|
15 | ObjectListElement* temp; |
---|
16 | while (this->first_) |
---|
17 | { |
---|
18 | temp = this->first_->next_; |
---|
19 | delete this->first_; |
---|
20 | this->first_ = temp; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | void ObjectList::add(OrxonoxClass* object) |
---|
25 | { |
---|
26 | ObjectListElement* temp = this->first_; |
---|
27 | this->first_ = new ObjectListElement(object); |
---|
28 | this->first_->next_ = temp; |
---|
29 | } |
---|
30 | |
---|
31 | void ObjectList::remove(OrxonoxClass* object) |
---|
32 | { |
---|
33 | if (!object) |
---|
34 | return; |
---|
35 | |
---|
36 | if (this->first_->object_ == object) |
---|
37 | { |
---|
38 | ObjectListElement* temp = this->first_->next_; |
---|
39 | delete this->first_; |
---|
40 | this->first_ = temp; |
---|
41 | |
---|
42 | return; |
---|
43 | } |
---|
44 | |
---|
45 | ObjectListElement* temp = this->first_; |
---|
46 | while (temp->next_) |
---|
47 | { |
---|
48 | if (temp->next_->object_ == object) |
---|
49 | { |
---|
50 | ObjectListElement* temp2 = temp->next_->next_; |
---|
51 | delete temp->next_; |
---|
52 | temp->next_ = temp2; |
---|
53 | |
---|
54 | return; |
---|
55 | } |
---|
56 | |
---|
57 | temp = temp->next_; |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | // ############################### |
---|
63 | // ### ObjectListElement ### |
---|
64 | // ############################### |
---|
65 | ObjectListElement::ObjectListElement(OrxonoxClass* object) |
---|
66 | { |
---|
67 | this->object_ = object; |
---|
68 | this->next_ = 0; |
---|
69 | } |
---|
70 | |
---|
71 | ObjectListElement::~ObjectListElement() |
---|
72 | { |
---|
73 | } |
---|
74 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.