(svn r26306) -Add: [nogo] More story APIs: RemovePageElement, GetCompany, GetDate, SetDate
This commit is contained in:
@@ -98,14 +98,14 @@
|
||||
type == ::SPET_TEXT || type == ::SPET_LOCATION ? text->GetEncodedText() : NULL);
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptStoryPage::GetPageSort(StoryPageID story_page_id)
|
||||
/* static */ uint32 ScriptStoryPage::GetPageSortValue(StoryPageID story_page_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
|
||||
|
||||
return StoryPage::Get(story_page_id)->sort_value;
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptStoryPage::GetPageElementSort(StoryPageElementID story_page_element_id)
|
||||
/* static */ uint32 ScriptStoryPage::GetPageElementSortValue(StoryPageElementID story_page_element_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidStoryPageElement(story_page_element_id));
|
||||
|
||||
@@ -122,6 +122,32 @@
|
||||
return ScriptObject::DoCommand(0, story_page_id, 0, CMD_SET_STORY_PAGE_TITLE, title != NULL? title->GetEncodedText() : NULL);
|
||||
}
|
||||
|
||||
/* static */ ScriptCompany::CompanyID ScriptStoryPage::GetCompany(StoryPageID story_page_id)
|
||||
{
|
||||
EnforcePrecondition(ScriptCompany::COMPANY_INVALID, IsValidStoryPage(story_page_id));
|
||||
|
||||
CompanyID c = StoryPage::Get(story_page_id)->company;
|
||||
ScriptCompany::CompanyID company = c == INVALID_COMPANY ? ScriptCompany::COMPANY_INVALID : (ScriptCompany::CompanyID)c;
|
||||
|
||||
return company;
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStoryPage::GetDate(StoryPageID story_page_id)
|
||||
{
|
||||
EnforcePrecondition(-1, IsValidStoryPage(story_page_id));
|
||||
|
||||
return StoryPage::Get(story_page_id)->date;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptStoryPage::SetDate(StoryPageID story_page_id, int32 date)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
|
||||
return ScriptObject::DoCommand(0, story_page_id, date, CMD_SET_STORY_PAGE_DATE, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* static */ bool ScriptStoryPage::Show(StoryPageID story_page_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
|
||||
@@ -138,3 +164,11 @@
|
||||
return ScriptObject::DoCommand(0, story_page_id, 0, CMD_REMOVE_STORY_PAGE);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptStoryPage::RemoveElement(StoryPageElementID story_page_element_id)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidStoryPageElement(story_page_element_id));
|
||||
|
||||
return ScriptObject::DoCommand(0, story_page_element_id, 0, CMD_REMOVE_STORY_PAGE_ELEMENT);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user