Fix scenery group set research status import

There were a lot of small issues that compounded into making this bug occur
This commit is contained in:
duncanspumpkin 2021-11-19 23:09:34 +00:00 committed by Gymnasiast
parent 22b9671435
commit f8091a462e
No known key found for this signature in database
GPG key ID: DBFFF47AB2CA3EDD
4 changed files with 14 additions and 6 deletions

View file

@ -355,6 +355,7 @@ static void remove_selected_objects_from_research(const ObjectEntryDescriptor& d
ResearchItem tmp = {};
tmp.type = Research::EntryType::Scenery;
tmp.entryIndex = entryIndex;
tmp.baseRideType = 0;
ResearchRemove(tmp);
break;
}

View file

@ -529,8 +529,7 @@ bool research_insert_scenery_group_entry(ObjectEntryIndex entryIndex, bool resea
{
if (entryIndex != OBJECT_ENTRY_INDEX_NULL)
{
auto tmpItem = ResearchItem(
Research::EntryType::Scenery, entryIndex, RIDE_TYPE_NULL, ResearchCategory::SceneryGroup, 0);
auto tmpItem = ResearchItem(Research::EntryType::Scenery, entryIndex, 0, ResearchCategory::SceneryGroup, 0);
research_insert(std::move(tmpItem), researched);
return true;
}

View file

@ -117,13 +117,20 @@ struct ResearchItem
}
else
{
entryIndex = RCTEntryIndexToOpenRCT2EntryIndex(oldResearchItem.entryIndex);
auto* rideEntry = get_ride_entry(entryIndex);
baseRideType = rideEntry != nullptr ? RCT2RideTypeToOpenRCT2RideType(oldResearchItem.baseRideType, rideEntry)
: oldResearchItem.baseRideType;
type = Research::EntryType{ oldResearchItem.type };
entryIndex = RCTEntryIndexToOpenRCT2EntryIndex(oldResearchItem.entryIndex);
flags = oldResearchItem.flags;
category = static_cast<ResearchCategory>(oldResearchItem.category);
if (type == Research::EntryType::Ride)
{
auto* rideEntry = get_ride_entry(entryIndex);
baseRideType = rideEntry != nullptr ? RCT2RideTypeToOpenRCT2RideType(oldResearchItem.baseRideType, rideEntry)
: oldResearchItem.baseRideType;
}
else
{
baseRideType = 0;
}
}
}

View file

@ -2289,6 +2289,7 @@ namespace RCT1
dst->entryIndex = entryIndex;
dst->type = Research::EntryType::Scenery;
dst->category = ResearchCategory::SceneryGroup;
dst->baseRideType = 0;
dst->flags = 0;
}
}