(svn r26303) -Add: [nogo] ScriptStoryPageList() - a list of all story pages

This commit is contained in:
zuu
2014-02-06 19:25:39 +00:00
parent 0317163f1b
commit a6e0f162ed
10 changed files with 47 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ void SQGSStoryPage_Register(Squirrel *engine)
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::New, "New", 3, ".i.");
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::NewElement, "NewElement", 5, ".iii.");
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::UpdateElement, "UpdateElement", 4, ".ii.");
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::GetPageSort, "GetPageSort", 2, ".i");
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::SetTitle, "SetTitle", 3, ".i.");
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::Show, "Show", 2, ".i");
SQGSStoryPage.DefSQStaticMethod(engine, &ScriptStoryPage::Remove, "Remove", 2, ".i");

View File

@@ -28,6 +28,7 @@
* \li GSGoal::SetText
* \li GSStation::HasCargoRating
* \li GSStoryPage
* \li GSStoryPageList
* \li GSTile::GetTerrainType
* \li GSTown::FoundTown
* \li GSTown::GetFundBuildingsDuration

View File

@@ -98,6 +98,13 @@
type == ::SPET_TEXT || type == ::SPET_LOCATION ? text->GetEncodedText() : NULL);
}
/* static */ uint32 ScriptStoryPage::GetPageSort(StoryPageID story_page_id)
{
EnforcePrecondition(false, IsValidStoryPage(story_page_id));
return StoryPage::Get(story_page_id)->sort_value;
}
/* static */ bool ScriptStoryPage::SetTitle(StoryPageID story_page_id, Text *title)
{
CCountedPtr<Text> counter(title);

View File

@@ -118,6 +118,16 @@ public:
*/
static bool UpdateElement(StoryPageElementID story_page_element_id, uint32 reference, Text *text);
/**
* Get story page sort value. Each page has a sort value that is internally assigned and used
* to sort the pages in the story book. OpenTTD maintains this number so that the sort order
* is perceived. This API exist only so that you can sort ScriptStoryPageList the same order
* as in GUI. You should not use this number for anything else.
* @param story_page_id The story page to get the sort value of.
* @return Page sort value.
*/
static uint32 GetPageSort(StoryPageID story_page_id);
/**
* Update title of a story page. The title is shown in the page selector drop down.
* @param story_page_id The story page to update.