| 204 | } |
| 205 | |
| 206 | bool CEditor::CallbackSaveSound(const char *pFilename, int StorageType, void *pUser) |
| 207 | { |
| 208 | dbg_assert(StorageType == IStorage::TYPE_SAVE, "Saving only allowed for IStorage::TYPE_SAVE"); |
| 209 | |
| 210 | CEditor *pEditor = static_cast<CEditor *>(pUser); |
| 211 | |
| 212 | std::shared_ptr<CEditorSound> pSound = pEditor->Map()->SelectedSound(); |
| 213 | |
| 214 | IOHANDLE File = pEditor->Storage()->OpenFile(pFilename, IOFLAG_WRITE, StorageType); |
| 215 | if(File) |
| 216 | { |
| 217 | io_write(File, pSound->m_pData, pSound->m_DataSize); |
| 218 | io_close(File); |
| 219 | pEditor->OnDialogClose(); |
| 220 | return true; |
| 221 | } |
| 222 | pEditor->ShowFileDialogError("Failed to open file '%s'.", pFilename); |
| 223 | return false; |
| 224 | } |
| 225 | |
| 226 | bool CEditor::CallbackCustomEntities(const char *pFilename, int StorageType, void *pUser) |
| 227 | { |
nothing calls this directly
no test coverage detected