-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
allow to specify park via absolute path make .sv6 filename extension optional support .sc6 filename extension, but default to .sv6
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1319,14 +1319,28 @@ static int32_t cc_for_date([[maybe_unused]] InteractiveConsole& console, [[maybe | |
|
||
static int32_t cc_load_park([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv) | ||
{ | ||
if (argv.size() > 0) | ||
if (argv.size() < 1) | ||
{ | ||
console.WriteFormatLine("Parameters required <filename>"); | ||
return 0; | ||
} | ||
|
||
char savePath[MAX_PATH]; | ||
if (String::IndexOf(argv[0].c_str(), '/') == SIZE_MAX && String::IndexOf(argv[0].c_str(), '\\') == SIZE_MAX) | ||
{ | ||
char savePath[MAX_PATH]; | ||
// no / or \ was included. File should be in save dir. | ||
platform_get_user_directory(savePath, "save", sizeof(savePath)); | ||
safe_strcat_path(savePath, argv[0].c_str(), sizeof(savePath)); | ||
} | ||
else | ||
{ | ||
safe_strcpy(savePath, argv[0].c_str(), sizeof(savePath)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
quadratrund
Author
Contributor
|
||
} | ||
if (!String::EndsWith(savePath, ".sv6", true) && !String::EndsWith(savePath, ".sc6", true)) | ||
{ | ||
path_append_extension(savePath, ".sv6", sizeof(savePath)); | ||
context_load_park_from_file(savePath); | ||
} | ||
context_load_park_from_file(savePath); | ||
This comment has been minimized.
Sorry, something went wrong.
janisozaur
Member
|
||
return 1; | ||
} | ||
|
||
|
@@ -1701,7 +1715,7 @@ static constexpr const console_command console_command_table[] = { | |
"Loading a scenery group will not load its associated objects.\n" | ||
"This is a safer method opposed to \"open object_selection\".", | ||
"load_object <objectfilenodat>" }, | ||
{ "load_park", cc_load_park, "Load park from save directory with load_park parkname", "load_park <name>" }, | ||
{ "load_park", cc_load_park, "Load park from save directory or by absolute path", "load_park <filename>" }, | ||
{ "object_count", cc_object_count, "Shows the number of objects of each type in the scenario.", "object_count" }, | ||
{ "open", cc_open, "Opens the window with the give name.", "open <window>." }, | ||
{ "quit", cc_close, "Closes the console.", "quit" }, | ||
|
No reason to copy, add a pointer and set it either at
savePath
or atargv[0].c_str()