31 #include "table/strings.h" 
   58       FOR_ALL_STORY_PAGES(p) {
 
   59         if (this->IsPageAvailable(p)) {
 
   74     return (*a)->sort_value - (*b)->sort_value;
 
   86         FOR_ALL_STORY_PAGE_ELEMENTS(pe) {
 
  103     return (*a)->sort_value - (*b)->sort_value;
 
  111   bool IsPageAvailable(
const StoryPage *page)
 const 
  135       if (p->
index == this->selected_page_id) {
 
  149     if (!_story_page_pool.
IsValidID(this->selected_page_id)) 
return false;
 
  160     if (!_story_page_pool.
IsValidID(this->selected_page_id)) 
return false;
 
  174     if (page != NULL && page->
title == NULL) {
 
  193     if (!_story_page_pool.
IsValidID(this->selected_page_id)) 
return;
 
  197     last_available = NULL;
 
  200       if (p->
index == this->selected_page_id) {
 
  201         if (last_available == NULL) 
return; 
 
  214     if (!_story_page_pool.
IsValidID(this->selected_page_id)) 
return;
 
  219       if (p->
index == this->selected_page_id) {
 
  241       if (p->
title != NULL) {
 
  247         str_item->SetParam(0, page_num);
 
  256     if (list->
Length() == 0) {
 
  282     if (page == NULL) 
return 0;
 
  304         if (g == NULL) 
return SPR_IMG_GOAL_BROKEN_REF;
 
  305         return g->
completed ? SPR_IMG_GOAL_COMPLETED : SPR_IMG_GOAL;
 
  308         return SPR_IMG_VIEW_LOCATION;
 
  331         return sprite_dim.height;
 
  348     if (page == NULL) 
return 0;
 
  358       height += element_vertical_dist;
 
  379     uint element_height = 
max(sprite_dim.height, (uint)line_height);
 
  381     uint sprite_top = y_offset + (element_height - sprite_dim.height) / 2;
 
  382     uint text_top = y_offset + (element_height - line_height) / 2;
 
  384     DrawSprite(action_sprite, PAL_NONE, 0, sprite_top);
 
  387     y_offset += element_height;
 
  476           SetDParam(0, STR_STORY_BOOK_SPECTATOR_CAPTION);
 
  505     if (page == NULL) 
return;
 
  526       DrawString(0, right - x, y_offset, STR_JUST_DATE_LONG, TC_BLACK);
 
  528     y_offset += line_height;
 
  537       y_offset += line_height; 
 
  547           StringID string_id = g == NULL ? STR_STORY_BOOK_INVALID_GOAL_REF : STR_JUST_RAW_STRING;
 
  558         default: NOT_REACHED();
 
  581           if (s->
title != NULL) {
 
  588           if (title_d.width > d.width) {
 
  589             d.width = title_d.width;
 
  593         d.width += padding.width;
 
  594         d.height += padding.height;
 
  625             if (p->
index == this->selected_page_id) 
break;
 
  648         if (clicked_y < head_height) 
return;
 
  651         uint y = head_height;
 
  656           y += element_vertical_dist; 
 
  659           if (clicked_y >= y && clicked_y < y + content_height) {
 
  687     if (!gui_scope) 
return;
 
  702       if (!_story_page_pool.
IsValidID(this->selected_page_id)) {
 
  726   &PageElementOrderSorter,
 
  729 static const NWidgetPart _nested_story_book_widgets[] = {
 
  758   _nested_story_book_widgets, 
lengthof(_nested_story_book_widgets)
 
  770   StoryBookWindow *w = AllocateWindowDescFront<StoryBookWindow>(&_story_book_desc, company, 
true);