(svn r26012) -Add: new goal type that show a story page when clicked

This commit is contained in:
zuu
2013-11-16 17:41:57 +00:00
parent f10d2417d8
commit 6fc653d2d7
7 changed files with 41 additions and 1 deletions

View File

@@ -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();
}