1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-17 04:52:31 +01:00

translate scenarios by raw normalised name

This commit is contained in:
IntelOrca
2016-01-02 17:57:02 +00:00
parent 5a4ad66a80
commit 212b8bfa10
2 changed files with 5 additions and 11 deletions

View File

@@ -268,13 +268,12 @@ void scenario_begin()
safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, s6Info->name, 64); safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, s6Info->name, 64);
{ {
// Get filename utf8 normalisedName[64];
utf8 filename[MAX_PATH]; safe_strncpy(normalisedName, s6Info->name, sizeof(normalisedName));
safe_strncpy(filename, _scenarioFileName, sizeof(filename)); scenario_normalise_name(normalisedName);
path_remove_extension(filename);
rct_string_id localisedStringIds[3]; rct_string_id localisedStringIds[3];
if (language_get_localised_scenario_strings(filename, localisedStringIds)) { if (language_get_localised_scenario_strings(normalisedName, localisedStringIds)) {
if (localisedStringIds[0] != (rct_string_id)STR_NONE) { if (localisedStringIds[0] != (rct_string_id)STR_NONE) {
safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, language_get_string(localisedStringIds[0]), 32); safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, language_get_string(localisedStringIds[0]), 32);
} }

View File

@@ -71,7 +71,6 @@ void scenario_load_list()
scenario_list_sort(); scenario_list_sort();
scenario_scores_load(); scenario_scores_load();
utf8 scoresPath[MAX_PATH]; utf8 scoresPath[MAX_PATH];
scenario_scores_legacy_get_path(scoresPath); scenario_scores_legacy_get_path(scoresPath);
scenario_scores_legacy_load(scoresPath); scenario_scores_legacy_load(scoresPath);
@@ -189,12 +188,8 @@ static void scenario_list_add(const utf8 *path, uint64 timestamp)
static void scenario_translate(scenario_index_entry *scenarioEntry, const rct_object_entry *stexObjectEntry) static void scenario_translate(scenario_index_entry *scenarioEntry, const rct_object_entry *stexObjectEntry)
{ {
utf8 filenameWithoutExtension[MAX_PATH];
safe_strncpy(filenameWithoutExtension, scenarioEntry->path, sizeof(filenameWithoutExtension));
path_remove_extension(filenameWithoutExtension);
rct_string_id localisedStringIds[3]; rct_string_id localisedStringIds[3];
if (language_get_localised_scenario_strings(filenameWithoutExtension, localisedStringIds)) { if (language_get_localised_scenario_strings(scenarioEntry->name, localisedStringIds)) {
if (localisedStringIds[0] != (rct_string_id)STR_NONE) { if (localisedStringIds[0] != (rct_string_id)STR_NONE) {
safe_strncpy(scenarioEntry->name, language_get_string(localisedStringIds[0]), 64); safe_strncpy(scenarioEntry->name, language_get_string(localisedStringIds[0]), 64);
} }