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

Method SetValue

src/script/api/script_list.cpp:491–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491bool ScriptList::SetValue(SQInteger item, SQInteger value)
492{
493 this->modifications++;
494
495 auto item_iter = this->items.find(item);
496 if (item_iter == this->items.end()) return false;
497
498 SQInteger value_old = item_iter->second;
499 if (value_old == value) return true;
500
501 this->sorter->Remove(item);
502 auto value_iter = this->values.find({value_old, item});
503 assert(value_iter != this->values.end());
504 item_iter->second = value;
505 auto node_handle = this->values.extract(value_iter);
506 node_handle.value().first = value;
507 this->values.insert(std::move(node_handle));
508
509 return true;
510}
511
512void ScriptList::Sort(SorterType sorter, bool ascending)
513{

Callers 3

AddListMethod · 0.95
_setMethod · 0.95
ValuateMethod · 0.95

Calls 5

findMethod · 0.45
endMethod · 0.45
RemoveMethod · 0.45
valueMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected