summaryrefslogtreecommitdiff
path: root/src/resources/soundeffect.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-19 17:46:46 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-19 17:46:46 +0000
commit41cf359468d6379bc0e033bee9ac148d1b9255dd (patch)
treed351692d76e861607fd504366ae22374613b0fec /src/resources/soundeffect.cpp
parentc3e36e443698b001e98219e48cc97e259ada0a1d (diff)
downloadmana-client-41cf359468d6379bc0e033bee9ac148d1b9255dd.tar.gz
mana-client-41cf359468d6379bc0e033bee9ac148d1b9255dd.tar.bz2
mana-client-41cf359468d6379bc0e033bee9ac148d1b9255dd.tar.xz
mana-client-41cf359468d6379bc0e033bee9ac148d1b9255dd.zip
Factored code between resource handlers. Implemented failure-friendly sprite loader.
Diffstat (limited to 'src/resources/soundeffect.cpp')
-rw-r--r--src/resources/soundeffect.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index bb35218e..ec9bc65c 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -25,20 +25,12 @@
#include "../log.h"
-SoundEffect::SoundEffect(const std::string &idPath, Mix_Chunk *soundEffect):
- Resource(idPath),
- mChunk(soundEffect)
-{
-}
-
SoundEffect::~SoundEffect()
{
Mix_FreeChunk(mChunk);
}
-SoundEffect*
-SoundEffect::load(void *buffer, unsigned int bufferSize,
- const std::string &idPath)
+Resource *SoundEffect::load(void *buffer, unsigned bufferSize)
{
// Load the raw file data from the buffer in an RWops structure
SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
@@ -48,11 +40,11 @@ SoundEffect::load(void *buffer, unsigned int bufferSize,
if (tmpSoundEffect)
{
- return new SoundEffect(idPath, tmpSoundEffect);
+ return new SoundEffect(tmpSoundEffect);
}
else
{
- logger->log("Error while loading sound effect (%s)", idPath.c_str());
+ logger->log("Error, failed to load sound effect: %s", Mix_GetError());
return NULL;
}
}