1
0
Fork 0

Codechange: use StoryPageID instead of uint16_t

pull/13350/head
Rubidium 2025-01-20 22:03:49 +01:00 committed by rubidium42
parent 7b091000b0
commit c74e385145
4 changed files with 6 additions and 6 deletions

View File

@ -136,7 +136,7 @@ struct GoalListWindow : public Window {
CompanyID story_company = StoryPage::Get(s->dst)->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; 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); ShowStoryBook(static_cast<CompanyID>(this->window_number), static_cast<StoryPageID>(s->dst));
return; return;
} }

View File

@ -65,7 +65,7 @@ void ShowGoalsList(CompanyID company);
void ShowGoalQuestion(uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question); void ShowGoalQuestion(uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question);
/* story_gui.cpp */ /* story_gui.cpp */
void ShowStoryBook(CompanyID company, uint16_t page_id = INVALID_STORY_PAGE, bool centered = false); void ShowStoryBook(CompanyID company, StoryPageID page_id = INVALID_STORY_PAGE, bool centered = false);
/* viewport_gui.cpp */ /* viewport_gui.cpp */
void ShowExtraViewportWindow(TileIndex tile = INVALID_TILE); void ShowExtraViewportWindow(TileIndex tile = INVALID_TILE);

View File

@ -240,7 +240,7 @@ static void HandleLinkClick(Link link)
case LT_STORY_PAGE: { case LT_STORY_PAGE: {
if (!StoryPage::IsValidID(link.target)) return; if (!StoryPage::IsValidID(link.target)) return;
CompanyID story_company = StoryPage::Get(link.target)->company; CompanyID story_company = StoryPage::Get(link.target)->company;
ShowStoryBook(story_company, link.target); ShowStoryBook(story_company, static_cast<StoryPageID>(link.target));
return; return;
} }

View File

@ -630,7 +630,7 @@ public:
* Sets the selected page. * Sets the selected page.
* @param page_index pool index of the page to select. * @param page_index pool index of the page to select.
*/ */
void SetSelectedPage(uint16_t page_index) void SetSelectedPage(StoryPageID page_index)
{ {
if (this->selected_page_id != page_index) { if (this->selected_page_id != page_index) {
if (this->active_button_id) ResetObjectToPlace(); if (this->active_button_id) ResetObjectToPlace();
@ -845,7 +845,7 @@ public:
if (widget != WID_SB_SEL_PAGE) return; if (widget != WID_SB_SEL_PAGE) return;
/* index (which is set in BuildDropDownList) is the page id. */ /* index (which is set in BuildDropDownList) is the page id. */
this->SetSelectedPage(index); this->SetSelectedPage(static_cast<StoryPageID>(index));
} }
/** /**
@ -1048,7 +1048,7 @@ static CursorID TranslateStoryPageButtonCursor(StoryPageButtonCursor cursor)
* @param page_id Page to open, may be #INVALID_STORY_PAGE. * @param page_id Page to open, may be #INVALID_STORY_PAGE.
* @param centered Whether to open the window centered. * @param centered Whether to open the window centered.
*/ */
void ShowStoryBook(CompanyID company, uint16_t page_id, bool centered) void ShowStoryBook(CompanyID company, StoryPageID page_id, bool centered)
{ {
if (!Company::IsValidID(company)) company = (CompanyID)INVALID_COMPANY; if (!Company::IsValidID(company)) company = (CompanyID)INVALID_COMPANY;