summaryrefslogtreecommitdiff
path: root/src/goal_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/goal_gui.cpp')
-rw-r--r--src/goal_gui.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp
index e7112ba20..caa04e544 100644
--- a/src/goal_gui.cpp
+++ b/src/goal_gui.cpp
@@ -21,6 +21,7 @@
#include "core/geometry_func.hpp"
#include "company_func.h"
#include "company_base.h"
+#include "story_base.h"
#include "command_func.h"
#include "widgets/goal_widget.h"
@@ -122,6 +123,21 @@ struct GoalListWindow : public Window {
xy = Town::Get(s->dst)->xy;
break;
+ case GT_STORY_PAGE: {
+ if (!StoryPage::IsValidID(s->dst)) return;
+
+ /* Verify that:
+ * - if global goal: story page must be global.
+ * - if company goal: story page must be global or of the same company.
+ */
+ CompanyID goal_company = s->company;
+ CompanyID story_company = StoryPage::Get(s->dst)->company;
+ if (goal_company == INVALID_COMPANY ? story_company != INVALID_COMPANY : story_company != INVALID_COMPANY && story_company != goal_company) return;
+
+ ShowStoryBook((CompanyID)this->window_number, s->dst);
+ return;
+ }
+
default: NOT_REACHED();
}