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

Method SelectPrevPage

src/story_gui.cpp:205–220  ·  view source on GitHub ↗

* Selects the previous available page before the currently selected page. */

Source from the content-addressed store, hash-verified

203 * Selects the previous available page before the currently selected page.
204 */
205 void SelectPrevPage()
206 {
207 if (!StoryPage::IsValidID(this->selected_page_id)) return;
208
209 /* Find the last available page which is previous to the current selected page. */
210 const StoryPage *last_available;
211 last_available = nullptr;
212 for (const StoryPage *p : this->story_pages) {
213 if (p->index == this->selected_page_id) {
214 if (last_available == nullptr) return; // No previous page available.
215 this->SetSelectedPage(last_available->index);
216 return;
217 }
218 last_available = p;
219 }
220 }
221
222 /**
223 * Selects the next available page after the currently selected page.

Callers 1

OnClickMethod · 0.95

Calls 1

SetSelectedPageMethod · 0.95

Tested by

no test coverage detected