Fixed track delete.

This commit is contained in:
Duncan Frost 2015-02-12 18:40:07 +00:00
parent 715c8bcf0f
commit 12cf791254
2 changed files with 22 additions and 1 deletions

View File

@ -94,6 +94,7 @@ HANDLE osinterface_file_open(const char* filename);
int osinterface_file_read(HANDLE handle, void* data, int size);
int osinterface_file_close(HANDLE handle);
int osinterface_file_move(const char* srcfilename, const char* dstfilename);
int osinterface_file_delete(const char* filename);
int osinterface_open_common_file_dialog(int type, char *title, char *filename, char *filterPattern, char *filterName);
void osinterface_show_messagebox(char* message);

View File

@ -1104,5 +1104,25 @@ int track_rename(const char *text)
*/
int track_delete()
{
return (RCT2_CALLPROC_X(0x006D3761, 0, 0, 0, 0, 0, 0, 0) & 0x100) == 0;
rct_window* w = window_find_by_class(WC_TRACK_DESIGN_LIST);
char path[MAX_PATH];
subsitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), &RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, char)[128 * w->track_list.var_482]);
if (osinterface_file_delete(path)){
RCT2_GLOBAL(0x141E9AC, uint16) = 3355;
return 0;
}
ride_list_item item = { 0xFC, 0 };
track_load_list(item);
item.type = RCT2_GLOBAL(0xF44158, uint8);
item.entry_index = RCT2_GLOBAL(0xF44159, uint8);
track_load_list(item);
reset_track_list_cache();
window_invalidate(w);
return 1;
}