mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move research functions to method; remove unused function (#10609)
This commit is contained in:
parent
d1eb041958
commit
3192bfb7c6
|
@ -431,7 +431,7 @@ static void window_editor_inventions_list_scrollmousedown(rct_window* w, int32_t
|
|||
return;
|
||||
|
||||
// Disallow picking up always-researched items
|
||||
if (research_item_is_always_researched(researchItem))
|
||||
if (researchItem->IsAlwaysResearched())
|
||||
return;
|
||||
|
||||
w->Invalidate();
|
||||
|
@ -453,7 +453,7 @@ static void window_editor_inventions_list_scrollmouseover(rct_window* w, int32_t
|
|||
w->Invalidate();
|
||||
|
||||
// Prevent always-researched items from being highlighted when hovered over
|
||||
if (researchItem != nullptr && research_item_is_always_researched(researchItem))
|
||||
if (researchItem != nullptr && researchItem->IsAlwaysResearched())
|
||||
{
|
||||
w->research_item = nullptr;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ static void window_editor_inventions_list_cursor(
|
|||
|
||||
// Use the open hand as cursor for items that can be picked up
|
||||
researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, screenCoords.y);
|
||||
if (researchItem != nullptr && !research_item_is_always_researched(researchItem))
|
||||
if (researchItem != nullptr && !researchItem->IsAlwaysResearched())
|
||||
{
|
||||
*cursorId = CURSOR_HAND_OPEN;
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
|||
utf8* vehicleNamePtr = vehicleNameBuffer;
|
||||
|
||||
uint8_t colour;
|
||||
if (research_item_is_always_researched(&researchItem))
|
||||
if (researchItem.IsAlwaysResearched())
|
||||
{
|
||||
if (w->research_item == &researchItem && _editorInventionsListDraggedItem.IsInventedEndMarker())
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK;
|
||||
|
@ -687,7 +687,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
|||
vehicleNamePtr = utf8_write_codepoint(vehicleNamePtr, colour);
|
||||
}
|
||||
|
||||
rct_string_id itemNameId = research_item_get_name(&researchItem);
|
||||
rct_string_id itemNameId = researchItem.GetName();
|
||||
|
||||
if (researchItem.type == RESEARCH_ENTRY_TYPE_RIDE
|
||||
&& !RideGroupManager::RideTypeIsIndependent(researchItem.baseRideType))
|
||||
|
@ -731,7 +731,7 @@ static void window_editor_inventions_list_drag_open(ResearchItem* researchItem)
|
|||
|
||||
window_close_by_class(WC_EDITOR_INVENTION_LIST_DRAG);
|
||||
_editorInventionsListDraggedItem = *researchItem;
|
||||
rct_string_id stringId = research_item_get_name(researchItem);
|
||||
rct_string_id stringId = researchItem->GetName();
|
||||
|
||||
ptr = buffer;
|
||||
if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE && !RideGroupManager::RideTypeIsIndependent(researchItem->baseRideType))
|
||||
|
@ -796,7 +796,7 @@ static void window_editor_inventions_list_drag_moved(rct_window* w, ScreenCoords
|
|||
{
|
||||
researchItem = get_research_item_at(screenCoords, &scrollId);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
} while (researchItem != nullptr && research_item_is_always_researched(researchItem));
|
||||
} while (researchItem != nullptr && researchItem->IsAlwaysResearched());
|
||||
|
||||
if (scrollId != -1)
|
||||
{
|
||||
|
@ -826,7 +826,7 @@ static void window_editor_inventions_list_drag_paint(rct_window* w, rct_drawpixe
|
|||
static rct_string_id window_editor_inventions_list_prepare_name(const ResearchItem* researchItem, bool withGap)
|
||||
{
|
||||
rct_string_id drawString;
|
||||
rct_string_id stringId = research_item_get_name(researchItem);
|
||||
rct_string_id stringId = researchItem->GetName();
|
||||
|
||||
if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE && !RideGroupManager::RideTypeIsIndependent(researchItem->baseRideType))
|
||||
{
|
||||
|
|
|
@ -365,7 +365,7 @@ void window_research_development_page_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
stringId = ResearchCategoryNames[gResearchNextItem.category];
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_DESIGNING)
|
||||
{
|
||||
stringId = research_item_get_name(&gResearchNextItem);
|
||||
stringId = gResearchNextItem.GetName();
|
||||
}
|
||||
}
|
||||
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 296, STR_RESEARCH_TYPE_LABEL, COLOUR_BLACK);
|
||||
|
@ -399,7 +399,7 @@ void window_research_development_page_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
rct_string_id lastDevelopmentFormat;
|
||||
if (gResearchLastItem.rawValue != RESEARCHED_ITEMS_SEPARATOR)
|
||||
{
|
||||
stringId = research_item_get_name(&gResearchLastItem);
|
||||
stringId = gResearchLastItem.GetName();
|
||||
uint8_t type = gResearchLastItem.type;
|
||||
lastDevelopmentFormat = (type == RESEARCH_ENTRY_TYPE_RIDE) ? STR_RESEARCH_RIDE_LABEL : STR_RESEARCH_SCENERY_LABEL;
|
||||
|
||||
|
|
|
@ -692,11 +692,11 @@ void set_every_ride_entry_not_invented()
|
|||
*
|
||||
* rct2: 0x0068563D
|
||||
*/
|
||||
rct_string_id research_item_get_name(const ResearchItem* researchItem)
|
||||
rct_string_id ResearchItem::GetName() const
|
||||
{
|
||||
if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE)
|
||||
if (type == RESEARCH_ENTRY_TYPE_RIDE)
|
||||
{
|
||||
rct_ride_entry* rideEntry = get_ride_entry(researchItem->entryIndex);
|
||||
rct_ride_entry* rideEntry = get_ride_entry(entryIndex);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
return STR_EMPTY;
|
||||
|
@ -708,7 +708,7 @@ rct_string_id research_item_get_name(const ResearchItem* researchItem)
|
|||
}
|
||||
else
|
||||
{
|
||||
rct_scenery_group_entry* sceneryEntry = get_scenery_group_entry(researchItem->entryIndex);
|
||||
rct_scenery_group_entry* sceneryEntry = get_scenery_group_entry(entryIndex);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return STR_EMPTY;
|
||||
|
@ -720,22 +720,6 @@ rct_string_id research_item_get_name(const ResearchItem* researchItem)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return the name of the base ride type or ride group, as seen in the research window.
|
||||
*/
|
||||
rct_string_id research_get_friendly_base_ride_type_name(uint8_t trackType, rct_ride_entry* rideEntry)
|
||||
{
|
||||
if (RideGroupManager::RideTypeHasRideGroups(trackType))
|
||||
{
|
||||
const RideGroup* rideGroup = RideGroupManager::GetRideGroup(trackType, rideEntry);
|
||||
return rideGroup->Naming.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RideNaming[trackType].name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00685A79
|
||||
|
@ -878,11 +862,9 @@ void research_items_shuffle()
|
|||
std::shuffle(std::begin(gResearchItemsUninvented), std::end(gResearchItemsUninvented), std::default_random_engine{});
|
||||
}
|
||||
|
||||
bool research_item_is_always_researched(const ResearchItem* researchItem)
|
||||
bool ResearchItem::IsAlwaysResearched() const
|
||||
{
|
||||
return (researchItem->flags
|
||||
& (RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED | RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED))
|
||||
!= 0;
|
||||
return (flags & (RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED | RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED)) != 0;
|
||||
}
|
||||
|
||||
bool ResearchItem::IsInventedEndMarker() const
|
||||
|
|
|
@ -34,6 +34,8 @@ struct ResearchItem
|
|||
bool IsInventedEndMarker() const;
|
||||
bool Equals(const ResearchItem* otherItem) const;
|
||||
bool Exists() const;
|
||||
bool IsAlwaysResearched() const;
|
||||
rct_string_id GetName() const;
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -136,12 +138,9 @@ void set_every_ride_type_invented();
|
|||
void set_every_ride_type_not_invented();
|
||||
void set_every_ride_entry_invented();
|
||||
void set_every_ride_entry_not_invented();
|
||||
rct_string_id research_item_get_name(const ResearchItem* researchItem);
|
||||
rct_string_id research_get_friendly_base_ride_type_name(uint8_t trackType, rct_ride_entry* rideEntry);
|
||||
void research_remove_flags();
|
||||
void research_fix();
|
||||
|
||||
void research_items_make_all_unresearched();
|
||||
void research_items_make_all_researched();
|
||||
void research_items_shuffle();
|
||||
bool research_item_is_always_researched(const ResearchItem* researchItem);
|
||||
|
|
Loading…
Reference in New Issue