Index: src/script/api/script_list.cpp =================================================================== --- src/script/api/script_list.cpp (revision 27256) +++ src/script/api/script_list.cpp (working copy) @@ -556,6 +556,8 @@ void ScriptList::AddList(ScriptList *list) { + if (list == this) return; + ScriptListMap *list_items = &list->items; for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) { this->AddItem((*iter).first); @@ -565,6 +567,8 @@ void ScriptList::SwapList(ScriptList *list) { + if (list == this) return; + this->items.swap(list->items); this->buckets.swap(list->buckets); Swap(this->sorter, list->sorter); @@ -694,9 +698,13 @@ { this->modifications++; - ScriptListMap *list_items = &list->items; - for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) { - this->RemoveItem((*iter).first); + if (list == this) { + Clear(); + } else { + ScriptListMap *list_items = &list->items; + for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) { + this->RemoveItem((*iter).first); + } } } @@ -756,14 +764,12 @@ void ScriptList::KeepList(ScriptList *list) { + if (list == this) return; + this->modifications++; ScriptList tmp; - for (ScriptListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { - tmp.AddItem((*iter).first); - tmp.SetValue((*iter).first, (*iter).second); - } - + tmp.AddList(this); tmp.RemoveList(list); this->RemoveList(&tmp); }