mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix track manager issues
This commit is contained in:
parent
f489bba4f0
commit
9eaf887546
|
@ -135,6 +135,7 @@ public:
|
|||
if (platform_file_delete(path))
|
||||
{
|
||||
_items.erase(_items.begin() + index);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,19 +154,15 @@ public:
|
|||
utf8 newPath[MAX_PATH];
|
||||
Path::GetDirectory(newPath, sizeof(newPath), path);
|
||||
Path::Append(newPath, sizeof(newPath), newName);
|
||||
Path::Append(newPath, sizeof(newPath), Path::GetExtension(path));
|
||||
String::Append(newPath, sizeof(newPath), Path::GetExtension(path));
|
||||
|
||||
if (platform_file_move(path, newPath))
|
||||
{
|
||||
item->Name = std::string(newName);
|
||||
item->Path = std::string(newPath);
|
||||
|
||||
SortItems();
|
||||
|
||||
item = GetTrackItem(path);
|
||||
if (item != nullptr)
|
||||
{
|
||||
result = item->Path.c_str();
|
||||
}
|
||||
result = newPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ static rct_window_event_list window_track_delete_prompt_events = {
|
|||
static track_design_file_ref *_trackDesignFileReference;
|
||||
|
||||
static void window_track_delete_prompt_open();
|
||||
static void window_track_design_list_reload_tracks();
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -231,6 +232,7 @@ static void window_track_manage_textinput(rct_window *w, int widgetIndex, char *
|
|||
if (track_repository_rename(_trackDesignFileReference->path, text)) {
|
||||
window_close_by_class(WC_TRACK_DELETE_PROMPT);
|
||||
window_close(w);
|
||||
window_track_design_list_reload_tracks();
|
||||
} else {
|
||||
window_error_open(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED);
|
||||
}
|
||||
|
@ -294,6 +296,7 @@ static void window_track_delete_prompt_mouseup(rct_window *w, int widgetIndex)
|
|||
window_close(w);
|
||||
if (track_repository_delete(_trackDesignFileReference->path)) {
|
||||
window_close_by_class(WC_MANAGE_TRACK_DESIGN);
|
||||
window_track_design_list_reload_tracks();
|
||||
} else {
|
||||
window_error_open(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED);
|
||||
}
|
||||
|
@ -324,3 +327,11 @@ static void window_track_delete_prompt_paint(rct_window *w, rct_drawpixelinfo *d
|
|||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_track_design_list_reload_tracks()
|
||||
{
|
||||
rct_window * trackListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
||||
if (trackListWindow != NULL) {
|
||||
trackListWindow->track_list.reload_track_designs = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue