mirror of https://github.com/OpenRCT2/OpenRCT2.git
prevent infinite loop while fixing invalid research items
research_remove() does not expect any items between RESEARCHED_ITEMS_END & RESEARCHED_ITEMS_END_2, so make sure, the next item is RESEARCHED_ITEMS_END_2 fix infinite loop while loading the save file RR_60glitch.zip from #5311
This commit is contained in:
parent
84eebb19aa
commit
a5df985a05
|
@ -1072,7 +1072,12 @@ void game_fix_save_vars()
|
|||
for (sint32 i = 0; i < MAX_RESEARCH_ITEMS; i++) {
|
||||
rct_research_item *researchItem = &gResearchItems[i];
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR) continue;
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_END) continue;
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_END)
|
||||
{
|
||||
assert(i < (MAX_RESEARCH_ITEMS - 1));
|
||||
(researchItem+1)->entryIndex = RESEARCHED_ITEMS_END_2;
|
||||
continue;
|
||||
}
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_END_2) break;
|
||||
if (researchItem->entryIndex & 0x10000) {
|
||||
uint8 entryIndex = researchItem->entryIndex & 0xFF;
|
||||
|
@ -1096,7 +1101,6 @@ void game_fix_save_vars()
|
|||
|
||||
// Fix invalid vehicle sprite sizes, thus preventing visual corruption of sprites
|
||||
fix_invalid_vehicle_sprite_sizes();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue