summaryrefslogtreecommitdiff
path: root/src/story.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.cpp
parenta49a4eec6e9b9fd7a9520af882a38697dd3a0ed3 (diff)
downloadopenttd-33ad9774fb7c51f1ec706851c7a96a7ced5ff622.tar.xz
(svn r25352) -Feature: GameScript API for selecting a story page to view
Diffstat (limited to 'src/story.cpp')
-rw-r--r--src/story.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/story.cpp b/src/story.cpp
index e492ded4d..74cdd1d5c 100644
--- a/src/story.cpp
+++ b/src/story.cpp
@@ -21,6 +21,7 @@
#include "goal_type.h"
#include "goal_base.h"
#include "window_func.h"
+#include "gui.h"
StoryPageElementID _new_story_page_element_id;
@@ -247,6 +248,28 @@ CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1,
}
/**
+ * Display a story page for all clients that are allowed to
+ * view the story page.
+ * @param tile unused.
+ * @param flags type of operation
+ * @param p1 StoryPageID to show.
+ * @param p2 unused
+ * @param text unused
+ * @return the cost of this operation or an error
+ */
+CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+{
+ if (_current_company != OWNER_DEITY) return CMD_ERROR;
+ if (!StoryPage::IsValidID(p1)) return CMD_ERROR;
+
+ if (flags & DC_EXEC) {
+ StoryPage *g = StoryPage::Get(p1);
+ if ((g->company != INVALID_COMPANY && g->company == _local_company) || (g->company == INVALID_COMPANY && Company::IsValidID(_local_company))) ShowStoryBook(p1);
+ }
+
+ return CommandCost();
+}
+/**
* Remove a story page and associated story page elements.
* @param tile unused.
* @param flags type of operation