summaryrefslogtreecommitdiff
path: root/src/story_gui.cpp
diff options
context:
space:
mode:
authorzuu <zuu@openttd.org>2013-06-09 12:57:22 +0000
committerzuu <zuu@openttd.org>2013-06-09 12:57:22 +0000
commit33ad9774fb7c51f1ec706851c7a96a7ced5ff622 (patch)
treeaf64b06f63d6168eef04bf09172732f6af896027 /src/story_gui.cpp
parenta49a4eec6e9b9fd7a9520af882a38697dd3a0ed3 (diff)
downloadopenttd-33ad9774fb7c51f1ec706851c7a96a7ced5ff622.tar.xz
(svn r25352) -Feature: GameScript API for selecting a story page to view
Diffstat (limited to 'src/story_gui.cpp')
-rw-r--r--src/story_gui.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/story_gui.cpp b/src/story_gui.cpp
index 62ec3606a..64782b90e 100644
--- a/src/story_gui.cpp
+++ b/src/story_gui.cpp
@@ -23,6 +23,7 @@
#include "sortlist_type.h"
#include "goal_base.h"
#include "viewport_func.h"
+#include "window_func.h"
#include "widgets/story_widget.h"
@@ -725,7 +726,11 @@ static WindowDesc _story_book_desc(
_nested_story_book_widgets, lengthof(_nested_story_book_widgets)
);
-void ShowStoryBook()
+void ShowStoryBook(uint16 page_id)
{
- AllocateWindowDescFront<StoryBookWindow>(&_story_book_desc, 0);
+ StoryBookWindow *w = AllocateWindowDescFront<StoryBookWindow>(&_story_book_desc, 0);
+ if (page_id != INVALID_STORY_PAGE) {
+ if (w == NULL) w = (StoryBookWindow *)FindWindowById(WC_STORY_BOOK, 0);
+ w->SetSelectedPage(page_id);
+ }
}