MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AddList

Method AddList

src/script/api/script_list.cpp:543–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541}
542
543void ScriptList::AddList(ScriptList *list)
544{
545 if (list == this) return;
546
547 if (this->IsEmpty()) {
548 /* If this is empty, we can just take the items of the other list as is. */
549 this->items = list->items;
550 this->values = list->values;
551 this->modifications++;
552 } else {
553 for (const auto &item : list->items) {
554 this->AddItem(item.first);
555 this->SetValue(item.first, item.second);
556 }
557 }
558}
559
560void ScriptList::SwapList(ScriptList *list)
561{

Callers 1

KeepListMethod · 0.80

Calls 3

IsEmptyMethod · 0.95
AddItemMethod · 0.95
SetValueMethod · 0.95

Tested by

no test coverage detected