mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix track load/save last-dir storing
Doesn't really belong to this PR, but it's needed anyway
This commit is contained in:
parent
2d7cd0e719
commit
662d92be74
|
@ -22,6 +22,8 @@
|
|||
#include "../util/sawyercoding.h"
|
||||
#include "../windows/error.h"
|
||||
#include "../world/scenery.h"
|
||||
#include "../config.h"
|
||||
#include "../util/util.h"
|
||||
#include "ride_data.h"
|
||||
#include "track.h"
|
||||
#include "track_data.h"
|
||||
|
@ -160,7 +162,12 @@ bool track_design_save(uint8 rideIndex)
|
|||
|
||||
// Default location
|
||||
utf8 path[MAX_PATH];
|
||||
platform_get_user_directory(path, "track");
|
||||
|
||||
if (gConfigGeneral.last_save_track_directory && platform_directory_exists(gConfigGeneral.last_save_track_directory))
|
||||
safe_strcpy(path, gConfigGeneral.last_save_track_directory, MAX_PATH);
|
||||
else
|
||||
platform_get_user_directory(path, "track");
|
||||
|
||||
strcat(path, track_name);
|
||||
strcat(path, ".td6");
|
||||
|
||||
|
@ -195,6 +202,8 @@ bool track_design_save(uint8 rideIndex)
|
|||
audio_unpause_sounds();
|
||||
|
||||
if (result) {
|
||||
gConfigGeneral.last_save_track_directory = path_get_directory(path);
|
||||
config_save_default();
|
||||
result = track_design_save_to_file(_trackDesign, path);
|
||||
}
|
||||
|
||||
|
|
|
@ -242,11 +242,6 @@ rct_window *window_loadsave_open(int type, char *defaultName)
|
|||
case LOADSAVETYPE_TRACK:
|
||||
/*
|
||||
Uncomment when user tracks are separated
|
||||
|
||||
if (gConfigGeneral.last_save_track_directory && platform_ensure_directory_exists(gConfigGeneral.last_save_track_directory))
|
||||
save_strcpy(path, gConfigGeneral.last_save_track_directory, MAX_PATH);
|
||||
else
|
||||
platform_get_user_directory(path, "tracks");
|
||||
|
||||
if (!platform_ensure_directory_exists(path)) {
|
||||
log_error("Unable to create tracks directory.");
|
||||
|
@ -254,12 +249,16 @@ rct_window *window_loadsave_open(int type, char *defaultName)
|
|||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
safe_strcpy(path, gRCT2AddressTracksPath, MAX_PATH);
|
||||
ch = strchr(path, '*');
|
||||
if (ch != NULL)
|
||||
*ch = 0;
|
||||
|
||||
|
||||
if (gConfigGeneral.last_save_track_directory && platform_ensure_directory_exists(gConfigGeneral.last_save_track_directory))
|
||||
safe_strcpy(path, gConfigGeneral.last_save_track_directory, MAX_PATH);
|
||||
else {
|
||||
safe_strcpy(path, gRCT2AddressTracksPath, MAX_PATH);
|
||||
ch = strchr(path, '*');
|
||||
if (ch != NULL)
|
||||
*ch = 0;
|
||||
}
|
||||
|
||||
window_loadsave_populate_list(w, includeNewItem, path, ".td?");
|
||||
break;
|
||||
}
|
||||
|
@ -392,7 +391,7 @@ static void window_loadsave_mouseup(rct_window *w, int widgetIndex)
|
|||
case WIDX_DEFAULT:
|
||||
{
|
||||
char directory[MAX_PATH];
|
||||
char *ch = directory;
|
||||
char *ch;
|
||||
|
||||
int includeNewItem = (_type & 1) == LOADSAVETYPE_SAVE;
|
||||
|
||||
|
@ -410,6 +409,7 @@ static void window_loadsave_mouseup(rct_window *w, int widgetIndex)
|
|||
break;
|
||||
|
||||
case LOADSAVETYPE_TRACK:
|
||||
{
|
||||
/*
|
||||
Uncomment when tracks get separated
|
||||
|
||||
|
@ -417,13 +417,15 @@ static void window_loadsave_mouseup(rct_window *w, int widgetIndex)
|
|||
*/
|
||||
|
||||
safe_strcpy(directory, gRCT2AddressTracksPath, MAX_PATH);
|
||||
ch = strchr(directory, '*');
|
||||
char *ch = strchr(directory, '*');
|
||||
if (ch != NULL)
|
||||
*ch = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
window_loadsave_populate_list(w, includeNewItem, ch, _extension);
|
||||
window_loadsave_populate_list(w, includeNewItem, directory, _extension);
|
||||
window_init_scroll_widgets(w);
|
||||
w->no_list_items = _listItemsCount;
|
||||
|
||||
|
|
Loading…
Reference in New Issue