1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Fix bug introduced in previous bug fixing!

Accidently switched two functions. Small refactor as well.
This commit is contained in:
Duncan Frost
2015-06-04 20:14:50 +01:00
parent 8351e56353
commit 47e41b5d82
2 changed files with 20 additions and 20 deletions

View File

@@ -46,7 +46,7 @@ void research_reset_items()
{
gResearchItems[0].entryIndex = RESEARCHED_ITEMS_SEPERATOR;
gResearchItems[1].entryIndex = RESEARCHED_ITEMS_END;
gResearchItems[2].entryIndex = -3;
gResearchItems[2].entryIndex = RESEARCHED_ITEMS_END_2;
}
/**
@@ -276,10 +276,10 @@ void research_update()
*/
void sub_684AC3(){
rct_research_item* research = gResearchItems;
for (; research->entryIndex != -2; research++);
for (; research->entryIndex != RESEARCHED_ITEMS_END; research++);
research++;
for (; research->entryIndex != -3; research += 2){
for (; research->entryIndex != RESEARCHED_ITEMS_END_2; research += 2){
if (scenario_rand() & 1) continue;
rct_research_item* edx;
@@ -321,7 +321,7 @@ void sub_684AC3(){
}
for (research = gResearchItems; research->entryIndex != -1; research++){
for (research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_SEPERATOR; research++){
research_finish_item(research->entryIndex);
}

View File

@@ -170,14 +170,7 @@ static int research_item_is_always_researched(rct_research_item *researchItem)
*/
static void sub_685901()
{
for (rct_research_item* research = gResearchItems;
research->entryIndex != -3;
research++){
if (research->entryIndex < -3){
research->entryIndex &= 0x00FFFFFF;
}
}
RCT2_CALLPROC_EBPSAFE(0x00685901);
}
/**
@@ -185,8 +178,15 @@ static void sub_685901()
* rct2: 0x00685A79
*/
static void sub_685A79()
{
RCT2_CALLPROC_EBPSAFE(0x00685A79);
{
for (rct_research_item* research = gResearchItems;
research->entryIndex != RESEARCHED_ITEMS_END_2;
research++){
if (research->entryIndex < RESEARCHED_ITEMS_END_2){
research->entryIndex &= 0x00FFFFFF;
}
}
}
/**
@@ -551,7 +551,7 @@ static void window_editor_inventions_list_scrollmousedown()
if (researchItem == NULL)
return;
if (researchItem->entryIndex < (uint32)-3 && research_item_is_always_researched(researchItem))
if (researchItem->entryIndex < (uint32)RESEARCHED_ITEMS_END_2 && research_item_is_always_researched(researchItem))
return;
window_invalidate(w);
@@ -613,7 +613,7 @@ static void window_editor_inventions_list_cursor()
if (researchItem == NULL)
return;
if (researchItem->entryIndex < (uint32)-3 && research_item_is_always_researched(researchItem)) {
if (researchItem->entryIndex < (uint32)RESEARCHED_ITEMS_END_2 && research_item_is_always_researched(researchItem)) {
cursorId = -1;
window_cursor_set_registers(cursorId);
return;
@@ -699,12 +699,12 @@ static void window_editor_inventions_list_paint()
if (eax >= 0x10000)
objectEntryType = 0;
void **entries = RCT2_GLOBAL(0x0098D97C + (objectEntryType * 8), void*);
void *entry = entries[researchItem->entryIndex & 0xFF];
if (entry == NULL || entry == (void*)0xFFFFFFFF)
void *chunk = object_entry_groups[objectEntryType].chunks[researchItem->entryIndex & 0xFF];
if (chunk == NULL || chunk == (void*)0xFFFFFFFF)
return;
object_paint(objectEntryType, 3, objectEntryType, x, y, 0, (int)dpi, (int)entry);
object_paint(objectEntryType, 3, objectEntryType, x, y, 0, (int)dpi, (int)chunk);
// Item name
x = w->x + ((widget->left + widget->right) / 2) + 1;