From 282553f0c599e996677c9ecc11d49febe0c3fea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Wed, 7 Feb 2018 21:51:09 +0100 Subject: [PATCH] Upgrade some char arrays to strings --- src/openrct2/Context.cpp | 2 +- src/openrct2/Game.cpp | 6 +++--- src/openrct2/Game.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 21ca652be3..ec73748e52 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -454,7 +454,7 @@ namespace OpenRCT2 } else { - handle_park_load_failure_with_title_opt(&result, path.c_str(), loadTitleScreenFirstOnFail); + handle_park_load_failure_with_title_opt(&result, path, loadTitleScreenFirstOnFail); } } catch (const std::exception &e) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 4d5de9fe7c..02e664ae3a 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -1255,7 +1255,7 @@ void game_fix_save_vars() fix_ride_entrance_and_exit_locations(); } -void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const utf8 * path, bool loadTitleFirst) +void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const std::string & path, bool loadTitleFirst) { if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_MISSING_OBJECTS) { @@ -1268,7 +1268,7 @@ void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, cons // The path needs to be duplicated as it's a const here // which the window function doesn't like auto intent = Intent(WC_OBJECT_LOAD_ERROR); - intent.putExtra(INTENT_EXTRA_PATH, std::string{path, path + strnlen(path, MAX_PATH)}); + intent.putExtra(INTENT_EXTRA_PATH, path); intent.putExtra(INTENT_EXTRA_LIST, (void *) ParkLoadResult_GetMissingObjects(result)); intent.putExtra(INTENT_EXTRA_LIST_COUNT, (uint32) ParkLoadResult_GetMissingObjectsCount(result)); context_open_intent(&intent); @@ -1294,7 +1294,7 @@ void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, cons } } -void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path) +void handle_park_load_failure(const ParkLoadResult * result, const std::string & path) { handle_park_load_failure_with_title_opt(result, path, false); } diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index d6566019ce..3faf00cb74 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -179,8 +179,8 @@ bool game_is_not_paused(); void save_game(); void * create_save_game_as_intent(); void save_game_as(); -void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const utf8 * path, bool loadTitleFirst); -void handle_park_load_failure(const ParkLoadResult * result, const utf8 * path); +void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, const std::string & path, bool loadTitleFirst); +void handle_park_load_failure(const ParkLoadResult * result, const std::string & path); void game_autosave(); void game_convert_strings_to_utf8(); void game_convert_news_items_to_utf8();