@@ -24,29 +24,29 @@ class ScriptListSorter;
* @api ai game
*/
class ScriptList : public ScriptObject {
public:
/** Type of sorter */
enum SorterType {
SORT_BY_VALUE, ///< Sort the list based on the value of the item.
SORT_BY_ITEM, ///< Sort the list based on the item itself.
};
/** Sort ascending */
static const bool SORT_ASCENDING = true;
/** Sort descnding */
/** Sort descending */
static const bool SORT_DESCENDING = false;
private:
ScriptListSorter *sorter; ///< Sorting algorithm
SorterType sorter_type; ///< Sorting type
bool sort_ascending; ///< Whether to sort ascending or descending
bool initialized; ///< Whether an iteration has been started
int modifications; ///< Number of modification that has been done. To prevent changing data while valuating.
typedef std::set<int32> ScriptItemList; ///< The list of items inside the bucket
typedef std::map<int32, ScriptItemList> ScriptListBucket; ///< The bucket list per value
typedef std::map<int32, int32> ScriptListMap; ///< List per item
ScriptListMap items; ///< The items in the list
ScriptListBucket buckets; ///< The items in the list, sorted by value
@@ -54,25 +54,25 @@ public:
ScriptList();
~ScriptList();
#ifdef DOXYGEN_API
/**
* Add a single item to the list.
* @param item the item to add. Should be unique, otherwise it is ignored.
* @param value the value to assign.
void AddItem(int32 item, int32 value);
#else
void AddItem(int32 item, int32 value = 0);
#endif
#endif /* DOXYGEN_API */
* Remove a single item from the list.
* @param item the item to remove. If not existing, it is ignored.
void RemoveItem(int32 item);
* Clear the list, making Count() returning 0 and IsEmpty() returning true.
void Clear();
Status change: