mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move category names and invention strings to ResearchItem class
This commit is contained in:
parent
19ab8f1211
commit
7d96dc9958
|
@ -113,15 +113,6 @@ static rct_window_event_list window_editor_inventions_list_drag_events([](auto&
|
|||
|
||||
static ResearchItem _editorInventionsListDraggedItem;
|
||||
|
||||
static constexpr const rct_string_id EditorInventionsResearchCategories[] = {
|
||||
STR_RESEARCH_NEW_TRANSPORT_RIDES,
|
||||
STR_RESEARCH_NEW_GENTLE_RIDES,
|
||||
STR_RESEARCH_NEW_ROLLER_COASTERS,
|
||||
STR_RESEARCH_NEW_THRILL_RIDES,
|
||||
STR_RESEARCH_NEW_WATER_RIDES,
|
||||
STR_RESEARCH_NEW_SHOPS_AND_STALLS,
|
||||
STR_RESEARCH_NEW_SCENERY_AND_THEMING,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void window_editor_inventions_list_drag_open(ResearchItem* researchItem);
|
||||
|
@ -576,7 +567,7 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
|
|||
|
||||
// Item category
|
||||
screenPos.x = w->windowPos.x + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right + 4;
|
||||
stringId = EditorInventionsResearchCategories[EnumValue(researchItem->category)];
|
||||
stringId = researchItem->GetCategoryInventionString();
|
||||
gfx_draw_string_left(dpi, STR_INVENTION_RESEARCH_GROUP, &stringId, COLOUR_BLACK, screenPos);
|
||||
}
|
||||
|
||||
|
|
|
@ -164,16 +164,6 @@ static uint32_t window_research_page_enabled_widgets[] = {
|
|||
|
||||
const int32_t window_research_tab_animation_loops[] = { 16, 16 };
|
||||
|
||||
static constexpr const rct_string_id ResearchCategoryNames[] = {
|
||||
STR_RESEARCH_CATEGORY_TRANSPORT,
|
||||
STR_RESEARCH_CATEGORY_GENTLE,
|
||||
STR_RESEARCH_CATEGORY_ROLLERCOASTER,
|
||||
STR_RESEARCH_CATEGORY_THRILL,
|
||||
STR_RESEARCH_CATEGORY_WATER,
|
||||
STR_RESEARCH_CATEGORY_SHOP,
|
||||
STR_RESEARCH_CATEGORY_SCENERY_GROUP,
|
||||
};
|
||||
|
||||
static constexpr const rct_string_id ResearchStageNames[] = {
|
||||
STR_RESEARCH_STAGE_INITIAL_RESEARCH,
|
||||
STR_RESEARCH_STAGE_DESIGNING,
|
||||
|
@ -329,7 +319,7 @@ void window_research_development_page_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
rct_string_id label = STR_RESEARCH_TYPE_LABEL;
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH)
|
||||
{
|
||||
strings[0] = ResearchCategoryNames[EnumValue(gResearchNextItem->category)];
|
||||
strings[0] = gResearchNextItem->GetCategoryName();
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_DESIGNING)
|
||||
{
|
||||
strings[0] = gResearchNextItem->GetName();
|
||||
|
|
|
@ -890,6 +890,52 @@ bool ResearchItem::Exists() const
|
|||
return false;
|
||||
}
|
||||
|
||||
rct_string_id ResearchItem::GetCategoryInventionString() const
|
||||
{
|
||||
switch (category)
|
||||
{
|
||||
case ResearchCategory::Transport:
|
||||
return STR_RESEARCH_NEW_TRANSPORT_RIDES;
|
||||
case ResearchCategory::Gentle:
|
||||
return STR_RESEARCH_NEW_GENTLE_RIDES;
|
||||
case ResearchCategory::Rollercoaster:
|
||||
return STR_RESEARCH_NEW_ROLLER_COASTERS;
|
||||
case ResearchCategory::Thrill:
|
||||
return STR_RESEARCH_NEW_THRILL_RIDES;
|
||||
case ResearchCategory::Water:
|
||||
return STR_RESEARCH_NEW_WATER_RIDES;
|
||||
case ResearchCategory::Shop:
|
||||
return STR_RESEARCH_NEW_SHOPS_AND_STALLS;
|
||||
case ResearchCategory::SceneryGroup:
|
||||
return STR_RESEARCH_NEW_SCENERY_AND_THEMING;
|
||||
}
|
||||
log_error("Unsupported category invention string");
|
||||
return STR_NONE;
|
||||
}
|
||||
|
||||
rct_string_id ResearchItem::GetCategoryName() const
|
||||
{
|
||||
switch (category)
|
||||
{
|
||||
case ResearchCategory::Transport:
|
||||
return STR_RESEARCH_CATEGORY_TRANSPORT;
|
||||
case ResearchCategory::Gentle:
|
||||
return STR_RESEARCH_CATEGORY_GENTLE;
|
||||
case ResearchCategory::Rollercoaster:
|
||||
return STR_RESEARCH_CATEGORY_ROLLERCOASTER;
|
||||
case ResearchCategory::Thrill:
|
||||
return STR_RESEARCH_CATEGORY_THRILL;
|
||||
case ResearchCategory::Water:
|
||||
return STR_RESEARCH_CATEGORY_WATER;
|
||||
case ResearchCategory::Shop:
|
||||
return STR_RESEARCH_CATEGORY_SHOP;
|
||||
case ResearchCategory::SceneryGroup:
|
||||
return STR_RESEARCH_CATEGORY_SCENERY_GROUP;
|
||||
}
|
||||
log_error("Unsupported category name");
|
||||
return STR_NONE;
|
||||
}
|
||||
|
||||
static std::bitset<RIDE_TYPE_COUNT> _seenRideType = {};
|
||||
|
||||
static void research_update_first_of_type(ResearchItem* researchItem)
|
||||
|
|
|
@ -66,6 +66,8 @@ struct ResearchItem
|
|||
bool Exists() const;
|
||||
bool IsAlwaysResearched() const;
|
||||
rct_string_id GetName() const;
|
||||
rct_string_id GetCategoryInventionString() const;
|
||||
rct_string_id GetCategoryName() const;
|
||||
|
||||
ResearchItem() = default;
|
||||
constexpr ResearchItem(uint32_t _rawValue, ResearchCategory _category, uint8_t _flags)
|
||||
|
|
Loading…
Reference in New Issue