Fix code review comments on research

This commit is contained in:
Ted John 2023-04-17 21:25:19 +01:00
parent 59f9d099b9
commit fe3f32e82e
2 changed files with 30 additions and 4 deletions

View File

@ -3130,8 +3130,21 @@ declare global {
*/ */
readonly parkSize: number; readonly parkSize: number;
/**
* The name of the park, shown on the park entrance.
* Not the name of the scenario.
*/
name: string; name: string;
research: Research;
/**
* The current research status, and what
* has and hasn't yet been researched.
*/
readonly research: Research;
/**
* The park message / notification queue, and historical messages.
*/
messages: ParkMessage[]; messages: ParkMessage[];
/** /**
@ -3162,6 +3175,18 @@ declare global {
*/ */
uninventedItems: ResearchItem[]; uninventedItems: ResearchItem[];
/**
* The last item that was researched, or null if no
* item has been researched yet.
*/
readonly lastResearchedItem: ResearchItem | null;
/**
* The item currently being researched, or null if
* research is complete.
*/
readonly expectedItem: ResearchItem | null;
/** /**
* The amount of funding currently spent on research. * The amount of funding currently spent on research.
*/ */
@ -3192,7 +3217,7 @@ declare global {
/** /**
* The expected day of the month the current item being researched will complete. * The expected day of the month the current item being researched will complete.
* Value is between 0 and 30, add 1 to it for the human readable date. * Value is between 1 and 31.
* Value is null if there is not yet an expected month. * Value is null if there is not yet an expected month.
*/ */
readonly expectedDay: number | null; readonly expectedDay: number | null;
@ -3213,6 +3238,7 @@ declare global {
/** /**
* The research category this item belongs in. * The research category this item belongs in.
* E.g. gentle rides, thrill rides, shops etc. * E.g. gentle rides, thrill rides, shops etc.
* Note: This field is ignored by OpenRCT2, the category will be determined by the ride type.
*/ */
category?: ResearchCategory; category?: ResearchCategory;

View File

@ -65,7 +65,7 @@ namespace OpenRCT2::Scripting
{ {
ResearchItem result; ResearchItem result;
result.baseRideType = 0; result.baseRideType = 0;
result.category = ResearchCategory::Transport; result.category = {}; // We ignore category because it will be derived from ride type
result.flags = 0; result.flags = 0;
result.type = FromDuk<Research::EntryType>(d["type"]); result.type = FromDuk<Research::EntryType>(d["type"]);
auto baseRideType = d["rideType"]; auto baseRideType = d["rideType"];
@ -94,7 +94,7 @@ namespace OpenRCT2::Scripting
void funding_set(uint8_t value) void funding_set(uint8_t value)
{ {
ThrowIfGameStateNotMutable(); ThrowIfGameStateNotMutable();
gResearchFundingLevel = value; gResearchFundingLevel = std::clamp<uint8_t>(value, RESEARCH_FUNDING_NONE, RESEARCH_FUNDING_MAXIMUM);
} }
uint8_t priorities_get() const uint8_t priorities_get() const