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

Method BuildStoryPageElementList

src/story_gui.cpp:93–112  ·  view source on GitHub ↗

(Re)Build story page element list. */

Source from the content-addressed store, hash-verified

91
92 /** (Re)Build story page element list. */
93 void BuildStoryPageElementList()
94 {
95 if (this->story_page_elements.NeedRebuild()) {
96 this->story_page_elements.clear();
97
98 const StoryPage *p = GetSelPage();
99 if (p != nullptr) {
100 for (const StoryPageElement *pe : StoryPageElement::Iterate()) {
101 if (pe->page == p->index) {
102 this->story_page_elements.push_back(pe);
103 }
104 }
105 }
106
107 this->story_page_elements.RebuildDone();
108 }
109
110 this->story_page_elements.Sort();
111 this->InvalidateStoryPageElementLayout();
112 }
113
114 /** Sort story page elements by order value. */
115 static bool PageElementOrderSorter(const StoryPageElement * const &a, const StoryPageElement * const &b)

Callers 1

RefreshSelectedPageMethod · 0.95

Calls 6

NeedRebuildMethod · 0.80
push_backMethod · 0.80
RebuildDoneMethod · 0.80
clearMethod · 0.45
SortMethod · 0.45

Tested by

no test coverage detected