MCPcopy Create free account
hub / github.com/ddnet/ddnet / CallbackSaveSound

Method CallbackSaveSound

src/game/editor/editor.cpp:206–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206bool 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
226bool CEditor::CallbackCustomEntities(const char *pFilename, int StorageType, void *pUser)
227{

Callers

nothing calls this directly

Calls 8

io_writeFunction · 0.85
io_closeFunction · 0.85
SelectedSoundMethod · 0.80
ShowFileDialogErrorMethod · 0.80
MapMethod · 0.45
OpenFileMethod · 0.45
StorageMethod · 0.45
OnDialogCloseMethod · 0.45

Tested by

no test coverage detected