| 74 | // CFilePageDialog message handlers |
| 75 | |
| 76 | void CFilePageDialog::OnAddFile() { |
| 77 | if (!Network_up) { |
| 78 | OutrageMessageBox("Sorry babe, the network is down. This action is a no-no.\n"); |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | CFilePageAddDlg dlg; |
| 83 | |
| 84 | dlg.SetInitialPath(LocalD3Dir); |
| 85 | if (dlg.DoModal() != IDOK) |
| 86 | return; |
| 87 | |
| 88 | char cur_name[100]; |
| 89 | char pathname[100], name[100], extension[100]; |
| 90 | int gamefile_handle; |
| 91 | |
| 92 | if (dlg.m_NumberOfSelectedFiles > 0) { |
| 93 | ASSERT(dlg.m_SelectedFiles); |
| 94 | ASSERT(dlg.m_SelectedDestDir); |
| 95 | } |
| 96 | |
| 97 | for (int q = 0; q < dlg.m_NumberOfSelectedFiles; q++) { |
| 98 | ASSERT(dlg.m_SelectedFiles[q]); |
| 99 | if (!dlg.m_SelectedFiles[q]) |
| 100 | continue; |
| 101 | |
| 102 | // Okay, we selected a file. Lets do what needs to be done here. |
| 103 | ddio_SplitPath(dlg.m_SelectedFiles[q], pathname, name, extension); |
| 104 | sprintf(cur_name, "%s%s", name, extension); |
| 105 | |
| 106 | if ((FindGamefileName(cur_name)) != -1) { |
| 107 | char buffer[512]; |
| 108 | sprintf(buffer, "%s already exists in the manage system", cur_name); |
| 109 | OutrageMessageBox(buffer); |
| 110 | continue; |
| 111 | } |
| 112 | |
| 113 | gamefile_handle = AllocGamefile(); |
| 114 | strcpy(Gamefiles[gamefile_handle].name, cur_name); |
| 115 | strcpy(Gamefiles[gamefile_handle].dir_name, dlg.m_SelectedDestDir); |
| 116 | |
| 117 | // Finally, save a local copy of the model/anim and alloc a tracklock |
| 118 | mprintf(0, "Making a copy of '%s' locally...\n", cur_name); |
| 119 | |
| 120 | char destname[100]; |
| 121 | ddio_MakePath(destname, LocalD3Dir, "data", dlg.m_SelectedDestDir, Gamefiles[gamefile_handle].name, NULL); |
| 122 | if (stricmp(destname, dlg.m_SelectedFiles[q])) // only copy if they are different |
| 123 | cf_CopyFile(destname, dlg.m_SelectedFiles[q]); |
| 124 | |
| 125 | mng_AllocTrackLock(cur_name, PAGETYPE_GAMEFILE); |
| 126 | |
| 127 | // D3EditState.current_gamefile=gamefile_handle; |
| 128 | } |
| 129 | |
| 130 | UpdateDialog(); |
| 131 | } |
| 132 | |
| 133 | void CFilePageDialog::UpdateDialog() { |
nothing calls this directly
no test coverage detected