mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Added routines to find scenario index and source from predefined listings.
This commit is contained in:
committed by
IntelOrca
parent
cf935d45c6
commit
3bad0870fb
@@ -36,7 +36,6 @@
|
||||
#include "platform/platform.h"
|
||||
#include "ride/ride.h"
|
||||
#include "scenario.h"
|
||||
#include "scenario_sources.h"
|
||||
#include "title.h"
|
||||
#include "util/sawyercoding.h"
|
||||
#include "util/util.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "platform/platform.h"
|
||||
#include "util/util.h"
|
||||
#include "scenario.h"
|
||||
#include "scenario_sources.h"
|
||||
|
||||
// Scenario list
|
||||
int gScenarioListCount = 0;
|
||||
@@ -43,6 +44,37 @@ rct_scenario_basic *get_scenario_by_filename(const char *filename)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sint16 get_scenario_index(rct_scenario_basic *scenario)
|
||||
{
|
||||
for (int i = 0; i < NUM_ORIGINAL_SCENARIOS; i++) {
|
||||
if (strcmp(original_scenario_names[i], scenario->name) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
scenario_source source_by_index(uint8 index)
|
||||
{
|
||||
if (index >= SCENARIO_SOURCE_RCT1_CLASSIC_INDEX && index < SCENARIO_SOURCE_RCT1_CORKSCREW_INDEX) {
|
||||
return SCENARIO_SOURCE_RCT1_CLASSIC;
|
||||
} else if (index >= SCENARIO_SOURCE_RCT1_CORKSCREW_INDEX && index < SCENARIO_SOURCE_RCT1_LOOPY_INDEX) {
|
||||
return SCENARIO_SOURCE_RCT1_CORKSCREW;
|
||||
} else if (index >= SCENARIO_SOURCE_RCT1_LOOPY_INDEX && index < SCENARIO_SOURCE_RCT2_VANILLA_INDEX) {
|
||||
return SCENARIO_SOURCE_RCT1_LOOPY;
|
||||
} else if (index >= SCENARIO_SOURCE_RCT2_VANILLA_INDEX && index < SCENARIO_SOURCE_RCT2_WACKY_INDEX) {
|
||||
return SCENARIO_SOURCE_RCT2_VANILLA;
|
||||
} else if (index >= SCENARIO_SOURCE_RCT2_WACKY_INDEX && index < SCENARIO_SOURCE_RCT2_TIME_INDEX) {
|
||||
return SCENARIO_SOURCE_RCT2_WACKY;
|
||||
} else if (index >= SCENARIO_SOURCE_RCT2_TIME_INDEX && index < SCENARIO_SOURCE_REAL_INDEX) {
|
||||
return SCENARIO_SOURCE_RCT2_TIME;
|
||||
} else if (index >= SCENARIO_SOURCE_REAL_INDEX && index < NUM_ORIGINAL_SCENARIOS) {
|
||||
return SCENARIO_SOURCE_REAL;
|
||||
} else {
|
||||
return SCENARIO_SOURCE_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006775A8
|
||||
@@ -130,6 +162,9 @@ static void scenario_list_add(const char *path)
|
||||
safe_strncpy(scenario->name, s6Info.name, 64);
|
||||
safe_strncpy(scenario->details, s6Info.details, 256);
|
||||
}
|
||||
|
||||
sint16 index = get_scenario_index(scenario);
|
||||
printf("Name: %-50s -- Index: %d -- Source: %d\n", scenario->name, index, source_by_index(index));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,7 +149,6 @@ static void window_scenarioselect_init_tabs()
|
||||
{
|
||||
int show_pages = 0;
|
||||
for (int i = 0; i < gScenarioListCount; i++) {
|
||||
printf("%s\n", gScenarioList[i].name);
|
||||
rct_scenario_basic* scenario = &gScenarioList[i];
|
||||
if (scenario->flags & SCENARIO_FLAGS_VISIBLE)
|
||||
show_pages |= 1 << scenario->category;
|
||||
|
||||
Reference in New Issue
Block a user