mirror of https://github.com/OpenRCT2/OpenRCT2.git
Convert rawValue to uint32
This commit is contained in:
parent
63fddee603
commit
e6c32230bc
|
@ -312,7 +312,7 @@ rct_window* window_editor_inventions_list_open()
|
|||
w->var_4AE = 0;
|
||||
w->selected_tab = 0;
|
||||
w->research_item = nullptr;
|
||||
_editorInventionsListDraggedItem.rawValue = -1;
|
||||
_editorInventionsListDraggedItem.rawValue = RESEARCH_ITEM_NULL;
|
||||
|
||||
w->min_width = WW;
|
||||
w->min_height = WH;
|
||||
|
@ -391,13 +391,13 @@ static void window_editor_inventions_list_update(rct_window* w)
|
|||
window_event_invalidate_call(w);
|
||||
widget_invalidate(w, WIDX_TAB_1);
|
||||
|
||||
if (_editorInventionsListDraggedItem.IsInventedEndMarker())
|
||||
if (_editorInventionsListDraggedItem.IsNull())
|
||||
return;
|
||||
|
||||
if (window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG) != nullptr)
|
||||
return;
|
||||
|
||||
_editorInventionsListDraggedItem.rawValue = -1;
|
||||
_editorInventionsListDraggedItem.rawValue = RESEARCH_ITEM_NULL;
|
||||
w->Invalidate();
|
||||
}
|
||||
|
||||
|
@ -572,10 +572,10 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
|
|||
ColourMapA[w->colours[1]].darkest);
|
||||
|
||||
researchItem = &_editorInventionsListDraggedItem;
|
||||
if (researchItem->IsInventedEndMarker())
|
||||
if (researchItem->IsNull())
|
||||
researchItem = w->research_item;
|
||||
// If the research item is null or a list separator.
|
||||
if (researchItem == nullptr || researchItem->rawValue < 0)
|
||||
if (researchItem == nullptr || researchItem->IsNull())
|
||||
return;
|
||||
|
||||
// Preview image
|
||||
|
@ -645,7 +645,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
|||
if (w->research_item == &researchItem)
|
||||
{
|
||||
int32_t top, bottom;
|
||||
if (_editorInventionsListDraggedItem.IsInventedEndMarker())
|
||||
if (_editorInventionsListDraggedItem.IsNull())
|
||||
{
|
||||
// Highlight
|
||||
top = itemY;
|
||||
|
@ -671,7 +671,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
|||
uint8_t colour;
|
||||
if (researchItem.IsAlwaysResearched())
|
||||
{
|
||||
if (w->research_item == &researchItem && _editorInventionsListDraggedItem.IsInventedEndMarker())
|
||||
if (w->research_item == &researchItem && _editorInventionsListDraggedItem.IsNull())
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK;
|
||||
else
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
|
||||
|
@ -804,7 +804,7 @@ static void window_editor_inventions_list_drag_moved(rct_window* w, ScreenCoords
|
|||
}
|
||||
|
||||
window_close(w);
|
||||
_editorInventionsListDraggedItem.rawValue = -1;
|
||||
_editorInventionsListDraggedItem.rawValue = RESEARCH_ITEM_NULL;
|
||||
window_invalidate_by_class(WC_EDITOR_INVENTION_LIST);
|
||||
}
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ void research_reset_current_item()
|
|||
*
|
||||
* rct2: 0x006857FA
|
||||
*/
|
||||
static void research_insert_unresearched(int32_t rawValue, uint8_t category)
|
||||
static void research_insert_unresearched(uint32_t rawValue, uint8_t category)
|
||||
{
|
||||
gResearchItemsUninvented.push_back({ rawValue, category });
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ static void research_insert_unresearched(int32_t rawValue, uint8_t category)
|
|||
*
|
||||
* rct2: 0x00685826
|
||||
*/
|
||||
static void research_insert_researched(int32_t rawValue, uint8_t category)
|
||||
static void research_insert_researched(uint32_t rawValue, uint8_t category)
|
||||
{
|
||||
// First check to make sure that entry is not already accounted for
|
||||
ResearchItem item = { rawValue, category };
|
||||
|
@ -867,9 +867,9 @@ bool ResearchItem::IsAlwaysResearched() const
|
|||
return (flags & (RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED | RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED)) != 0;
|
||||
}
|
||||
|
||||
bool ResearchItem::IsInventedEndMarker() const
|
||||
bool ResearchItem::IsNull() const
|
||||
{
|
||||
return rawValue == RESEARCHED_ITEMS_SEPARATOR;
|
||||
return rawValue == RESEARCH_ITEM_NULL;
|
||||
}
|
||||
|
||||
bool ResearchItem::Equals(const ResearchItem* otherItem) const
|
||||
|
|
|
@ -21,7 +21,7 @@ struct ResearchItem
|
|||
// Bit 16 (0: scenery entry, 1: ride entry)
|
||||
union
|
||||
{
|
||||
int32_t rawValue;
|
||||
uint32_t rawValue;
|
||||
struct
|
||||
{
|
||||
uint8_t entryIndex;
|
||||
|
@ -32,7 +32,7 @@ struct ResearchItem
|
|||
};
|
||||
uint8_t category;
|
||||
|
||||
bool IsInventedEndMarker() const;
|
||||
bool IsNull() const;
|
||||
bool Equals(const ResearchItem* otherItem) const;
|
||||
bool Exists() const;
|
||||
bool IsAlwaysResearched() const;
|
||||
|
@ -51,12 +51,8 @@ enum
|
|||
RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED = (1 << 6),
|
||||
};
|
||||
|
||||
// Everything before this point has been researched
|
||||
#define RESEARCHED_ITEMS_SEPARATOR (-1)
|
||||
// Everything before this point and after separator still requires research
|
||||
#define RESEARCHED_ITEMS_END (-2)
|
||||
// Extra end of list entry. Leftover from RCT1.
|
||||
#define RESEARCHED_ITEMS_END_2 (-3)
|
||||
// Only used to mark as null nowadays. Deprecated. TODO: remove.
|
||||
#define RESEARCH_ITEM_NULL 0xFFFFFFFF
|
||||
|
||||
#define MAX_RESEARCH_ITEMS 500
|
||||
#define MAX_RESEARCHED_TRACK_TYPES 128
|
||||
|
|
|
@ -2564,7 +2564,7 @@ private:
|
|||
|
||||
void ConvertResearchEntry(ResearchItem* dst, uint8_t srcItem, uint8_t srcType)
|
||||
{
|
||||
dst->rawValue = RESEARCHED_ITEMS_SEPARATOR;
|
||||
dst->rawValue = RESEARCH_ITEM_NULL;
|
||||
if (srcType == RCT1_RESEARCH_TYPE_RIDE)
|
||||
{
|
||||
uint8_t entryIndex = _rideTypeToRideEntryMap[srcItem];
|
||||
|
|
|
@ -84,11 +84,11 @@ enum
|
|||
};
|
||||
|
||||
// Everything before this point has been researched
|
||||
#define RCT12_RESEARCHED_ITEMS_SEPARATOR (-1)
|
||||
#define RCT12_RESEARCHED_ITEMS_SEPARATOR 0xFFFFFFFF
|
||||
// Everything before this point and after separator still requires research
|
||||
#define RCT12_RESEARCHED_ITEMS_END (-2)
|
||||
#define RCT12_RESEARCHED_ITEMS_END 0xFFFFFFFE
|
||||
// Extra end of list entry. Leftover from RCT1.
|
||||
#define RCT12_RESEARCHED_ITEMS_END_2 (-3)
|
||||
#define RCT12_RESEARCHED_ITEMS_END_2 0xFFFFFFFD
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
@ -696,7 +696,7 @@ struct RCT12ResearchItem
|
|||
// Bit 16 (0: scenery entry, 1: ride entry)
|
||||
union
|
||||
{
|
||||
int32_t rawValue;
|
||||
uint32_t rawValue;
|
||||
struct
|
||||
{
|
||||
uint8_t entryIndex;
|
||||
|
|
|
@ -244,7 +244,7 @@ void S6Exporter::Export()
|
|||
if (gResearchLastItem.has_value())
|
||||
_s6.last_researched_item_subject = gResearchLastItem->rawValue;
|
||||
else
|
||||
_s6.last_researched_item_subject = -1;
|
||||
_s6.last_researched_item_subject = RCT12_RESEARCHED_ITEMS_SEPARATOR;
|
||||
// pad_01357CF8
|
||||
_s6.research_progress = gResearchProgress;
|
||||
|
||||
|
@ -255,7 +255,7 @@ void S6Exporter::Export()
|
|||
}
|
||||
else
|
||||
{
|
||||
_s6.next_research_item = -1;
|
||||
_s6.next_research_item = RCT12_RESEARCHED_ITEMS_SEPARATOR;
|
||||
_s6.next_research_category = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -162,9 +162,9 @@ struct rct_s6_data
|
|||
// SC6[10]
|
||||
uint8_t active_research_types;
|
||||
uint8_t research_progress_stage;
|
||||
int32_t last_researched_item_subject;
|
||||
uint32_t last_researched_item_subject;
|
||||
uint8_t pad_01357CF8[1000];
|
||||
int32_t next_research_item;
|
||||
uint32_t next_research_item;
|
||||
uint16_t research_progress;
|
||||
uint8_t next_research_category;
|
||||
uint8_t next_research_expected_day;
|
||||
|
|
Loading…
Reference in New Issue