author | truelight |
Thu, 12 Apr 2007 12:11:46 +0000 | |
branch | noai |
changeset 9580 | 53bf5a5dda46 |
parent 9579 | 632263c0cf5a |
child 9581 | 398688c1a07a |
permissions | -rw-r--r-- |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
2 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
3 |
/** @file ai_list.cpp Implementation of AIList */ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
4 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
5 |
#include "ai_list.hpp" |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
6 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
7 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
8 |
* Base class for any AIList sorter. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
9 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
10 |
class AIListSorter { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
11 |
protected: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
12 |
AIList *list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
13 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
14 |
public: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
15 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
16 |
* Virtual dtor, needed to mute warnings. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
17 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
18 |
virtual ~AIListSorter() { } |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
19 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
20 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
21 |
* Get the first item of the sorter. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
22 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
23 |
virtual int32 Begin() = 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
24 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
25 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
26 |
* Get the next item of the sorter. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
27 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
28 |
virtual int32 Next() = 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
29 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
30 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
31 |
* See if there is a next item of the sorter. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
32 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
33 |
virtual bool HasNext() = 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
34 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
35 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
36 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
37 |
* Sort by value, ascending. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
38 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
39 |
class AIListSorterValueAscending : public AIListSorter { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
40 |
private: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
41 |
AIList::AIListBucket::iterator bucket_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
42 |
AIList::AIItemList *bucket_list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
43 |
AIList::AIItemList::iterator bucket_list_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
44 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
45 |
public: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
46 |
AIListSorterValueAscending(AIList *list) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
47 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
48 |
this->list = list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
49 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
50 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
51 |
int32 Begin() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
52 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
53 |
this->bucket_iter = this->list->buckets.begin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
54 |
this->bucket_list = &(*this->bucket_iter).second; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
55 |
this->bucket_list_iter = this->bucket_list->begin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
56 |
return *bucket_list_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
57 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
58 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
59 |
int32 Next() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
60 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
61 |
this->bucket_list_iter++; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
62 |
if (this->bucket_list_iter == this->bucket_list->end()) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
63 |
this->bucket_iter++; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
64 |
if (this->bucket_iter == this->list->buckets.end()) return 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
65 |
this->bucket_list = &(*this->bucket_iter).second; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
66 |
this->bucket_list_iter = this->bucket_list->begin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
67 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
68 |
return *bucket_list_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
69 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
70 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
71 |
bool HasNext() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
72 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
73 |
return this->bucket_iter != this->list->buckets.end() && this->bucket_list_iter != this->bucket_list->end(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
74 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
75 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
76 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
77 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
78 |
* Sort by value, descending. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
79 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
80 |
class AIListSorterValueDescending : public AIListSorter { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
81 |
private: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
82 |
AIList::AIListBucket::reverse_iterator bucket_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
83 |
AIList::AIItemList *bucket_list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
84 |
AIList::AIItemList::reverse_iterator bucket_list_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
85 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
86 |
public: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
87 |
AIListSorterValueDescending(AIList *list) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
88 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
89 |
this->list = list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
90 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
91 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
92 |
int32 Begin() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
93 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
94 |
this->bucket_iter = this->list->buckets.rbegin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
95 |
this->bucket_list = &(*this->bucket_iter).second; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
96 |
this->bucket_list_iter = this->bucket_list->rbegin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
97 |
return *bucket_list_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
98 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
99 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
100 |
int32 Next() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
101 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
102 |
this->bucket_list_iter++; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
103 |
if (this->bucket_list_iter == this->bucket_list->rend()) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
104 |
this->bucket_iter++; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
105 |
if (this->bucket_iter == this->list->buckets.rend()) return 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
106 |
this->bucket_list = &(*this->bucket_iter).second; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
107 |
this->bucket_list_iter = this->bucket_list->rbegin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
108 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
109 |
return *bucket_list_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
110 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
111 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
112 |
bool HasNext() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
113 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
114 |
return this->bucket_iter != this->list->buckets.rend() && this->bucket_list_iter != this->bucket_list->rend(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
115 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
116 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
117 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
118 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
119 |
* Sort by item, ascending. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
120 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
121 |
class AIListSorterItemAscending : public AIListSorter { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
122 |
private: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
123 |
AIList::AIListMap::iterator item_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
124 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
125 |
public: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
126 |
AIListSorterItemAscending(AIList *list) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
127 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
128 |
this->list = list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
129 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
130 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
131 |
int32 Begin() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
132 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
133 |
this->item_iter = this->list->items.begin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
134 |
return (*this->item_iter).first; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
135 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
136 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
137 |
int32 Next() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
138 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
139 |
this->item_iter++; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
140 |
return (*this->item_iter).first; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
141 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
142 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
143 |
bool HasNext() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
144 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
145 |
return this->item_iter != this->list->items.end(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
146 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
147 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
148 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
149 |
/** |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
150 |
* Sort by item, descending. |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
151 |
*/ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
152 |
class AIListSorterItemDescending : public AIListSorter { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
153 |
private: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
154 |
AIList::AIListMap::reverse_iterator item_iter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
155 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
156 |
public: |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
157 |
AIListSorterItemDescending(AIList *list) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
158 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
159 |
this->list = list; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
160 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
161 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
162 |
int32 Begin() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
163 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
164 |
this->item_iter = this->list->items.rbegin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
165 |
return (*this->item_iter).first; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
166 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
167 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
168 |
int32 Next() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
169 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
170 |
this->item_iter++; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
171 |
return (*this->item_iter).first; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
172 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
173 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
174 |
bool HasNext() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
175 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
176 |
return this->item_iter != this->list->items.rend(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
177 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
178 |
}; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
179 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
180 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
181 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
182 |
AIList::AIList() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
183 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
184 |
/* Default sorter */ |
9580
53bf5a5dda46
(svn r9604) [NoAI] -Fix: set default sort order to value-descending for AIList(), as that most likely will be the most used
truelight
parents:
9579
diff
changeset
|
185 |
this->sorter = new AIListSorterValueDescending(this); |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
186 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
187 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
188 |
AIList::~AIList() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
189 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
190 |
delete this->sorter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
191 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
192 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
193 |
bool AIList::HasItem(int32 item) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
194 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
195 |
return this->items.count(item) == 1; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
196 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
197 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
198 |
void AIList::Clear() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
199 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
200 |
this->items.clear(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
201 |
this->buckets.clear(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
202 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
203 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
204 |
void AIList::AddItem(int32 item) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
205 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
206 |
if (this->HasItem(item)) return; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
207 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
208 |
this->items[item] = 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
209 |
this->buckets[0].insert(item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
210 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
211 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
212 |
void AIList::RemoveItem(int32 item) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
213 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
214 |
if (!this->HasItem(item)) return; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
215 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
216 |
this->buckets[this->GetValue(item)].erase(item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
217 |
this->items.erase(item); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
218 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
219 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
220 |
int32 AIList::Begin() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
221 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
222 |
return this->sorter->Begin(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
223 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
224 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
225 |
int32 AIList::Next() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
226 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
227 |
return this->sorter->Next(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
228 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
229 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
230 |
bool AIList::IsEmpty() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
231 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
232 |
return this->items.empty(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
233 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
234 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
235 |
bool AIList::HasNext() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
236 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
237 |
return this->sorter->HasNext(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
238 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
239 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
240 |
int32 AIList::Count() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
241 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
242 |
return this->items.size(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
243 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
244 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
245 |
int32 AIList::GetValue(int32 item) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
246 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
247 |
if (!this->HasItem(item)) return 0; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
248 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
249 |
return this->items[item]; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
250 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
251 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
252 |
void AIList::SortByItem(bool ascending) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
253 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
254 |
delete this->sorter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
255 |
if (ascending) this->sorter = new AIListSorterItemAscending(this); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
256 |
else this->sorter = new AIListSorterItemDescending(this); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
257 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
258 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
259 |
void AIList::SortByValue(bool ascending) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
260 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
261 |
delete this->sorter; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
262 |
if (ascending) this->sorter = new AIListSorterValueAscending(this); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
263 |
else this->sorter = new AIListSorterValueDescending(this); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
264 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
265 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
266 |
void AIList::RemoveAboveValue(int32 value) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
267 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
268 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
269 |
if ((*iter).second > value) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
270 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
271 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
272 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
273 |
if ((*iter).first > value) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
274 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
275 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
276 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
277 |
void AIList::RemoveBelowValue(int32 value) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
278 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
279 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
280 |
if ((*iter).second < value) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
281 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
282 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
283 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
284 |
if ((*iter).first < value) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
285 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
286 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
287 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
288 |
void AIList::RemoveBetweenValue(int32 start, int32 end) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
289 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
290 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
291 |
if ((*iter).second > start && (*iter).second < end) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
292 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
293 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
294 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
295 |
if ((*iter).first > start && (*iter).first < end) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
296 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
297 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
298 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
299 |
void AIList::RemoveValue(int32 value) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
300 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
301 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
302 |
if ((*iter).second == value) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
303 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
304 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
305 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
306 |
if ((*iter).first == value) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
307 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
308 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
309 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
310 |
void AIList::KeepAboveValue(int32 value) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
311 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
312 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
313 |
if ((*iter).second <= value) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
314 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
315 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
316 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
317 |
if ((*iter).first <= value) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
318 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
319 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
320 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
321 |
void AIList::KeepBelowValue(int32 value) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
322 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
323 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
324 |
if ((*iter).second >= value) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
325 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
326 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
327 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
328 |
if ((*iter).first >= value) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
329 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
330 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
331 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
332 |
void AIList::KeepBetweenValue(int32 start, int32 end) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
333 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
334 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
335 |
if ((*iter).second <= start || (*iter).second >= end) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
336 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
337 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
338 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
339 |
if ((*iter).first <= start || (*iter).first >= end) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
340 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
341 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
342 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
343 |
void AIList::KeepValue(int32 value) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
344 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
345 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
346 |
if ((*iter).second != value) this->items.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
347 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
348 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
349 |
for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
350 |
if ((*iter).first != value) this->buckets.erase(iter); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
351 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
352 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
353 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
354 |
void AIList::Valuate(AIList::Valuator *proc) |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
355 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
356 |
this->buckets.clear(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
357 |
for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
358 |
int32 value = proc->Valuate((*iter).first); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
359 |
(*iter).second = value; |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
360 |
this->buckets[value].insert((*iter).first); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
361 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
diff
changeset
|
362 |
} |