let CEditorSound inherit CEditorComponent

This commit is contained in:
marmare314 2023-08-28 18:07:28 +02:00
parent d68029a252
commit c3a07dd977
3 changed files with 12 additions and 21 deletions

View file

@ -549,7 +549,6 @@ bool CEditorMap::Load(const char *pFileName, int StorageType, const std::functio
// copy base info // copy base info
std::shared_ptr<CEditorSound> pSound = std::make_shared<CEditorSound>(m_pEditor); std::shared_ptr<CEditorSound> pSound = std::make_shared<CEditorSound>(m_pEditor);
if(pItem->m_External) if(pItem->m_External)
{ {
char aBuf[IO_MAX_PATH_LENGTH]; char aBuf[IO_MAX_PATH_LENGTH];

View file

@ -2,11 +2,14 @@
#include <engine/sound.h> #include <engine/sound.h>
#include <game/editor/editor.h> CEditorSound::CEditorSound(CEditor *pEditor)
{
Init(pEditor);
}
CEditorSound::~CEditorSound() CEditorSound::~CEditorSound()
{ {
m_pEditor->Sound()->UnloadSample(m_SoundID); Sound()->UnloadSample(m_SoundID);
free(m_pData); free(m_pData);
m_pData = nullptr; m_pData = nullptr;
} }

View file

@ -3,30 +3,19 @@
#include <base/system.h> #include <base/system.h>
class CEditor; #include <game/editor/component.h>
class CEditorSound class CEditorSound : public CEditorComponent
{ {
public: public:
CEditor *m_pEditor; explicit CEditorSound(CEditor *pEditor);
CEditorSound(CEditor *pEditor)
{
m_pEditor = pEditor;
m_aName[0] = 0;
m_SoundID = 0;
m_pData = nullptr;
m_DataSize = 0;
}
~CEditorSound(); ~CEditorSound();
int m_SoundID; int m_SoundID = 0;
char m_aName[IO_MAX_PATH_LENGTH]; char m_aName[IO_MAX_PATH_LENGTH] = "";
void *m_pData; void *m_pData = nullptr;
unsigned m_DataSize; unsigned m_DataSize = 0;
}; };
#endif #endif