* Selects the previous available page before the currently selected page. */
| 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. |
no test coverage detected