Changed: #1469 Converting sound names to sheet id when parsing sound triggers (camera modifier and mission action)

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent ae6aeb5c22
commit be0fdfc666

@ -17,6 +17,8 @@
#include "camera_animation_manager/camera_animation_modifier_factory.h" #include "camera_animation_manager/camera_animation_modifier_factory.h"
#include "nel/misc/sheet_id.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/// This animation modifier shakes the camera. The parameter is /// This animation modifier shakes the camera. The parameter is
/// - strength /// - strength
@ -61,12 +63,14 @@ class CCameraAnimationModifierSoundTrigger : public ICameraAnimationModifier
protected: protected:
std::string SoundName; std::string SoundName;
std::string SoundPos; std::string SoundPos;
NLMISC::CSheetId SoundId;
public: public:
CCameraAnimationModifierSoundTrigger() CCameraAnimationModifierSoundTrigger()
{ {
SoundName = ""; SoundName = "";
SoundPos = ""; SoundPos = "";
SoundId = NLMISC::CSheetId::Unknown;
} }
virtual bool parseModifier(const NLLIGO::IPrimitive* prim, const std::string& filename) virtual bool parseModifier(const NLLIGO::IPrimitive* prim, const std::string& filename)
@ -80,6 +84,12 @@ public:
return false; return false;
} }
SoundName = value; SoundName = value;
SoundId = NLMISC::CSheetId(SoundName);
if (SoundId == NLMISC::CSheetId::Unknown)
{
nlwarning("<CCameraAnimationModifierSoundTrigger parseModifier> sheetid not found for sound name %s in the basic modifier in primitive : %s", SoundName.c_str(), filename.c_str());
return false;
}
// We get the sound position // We get the sound position
if (!prim->getPropertyByName("sound_position", value)) if (!prim->getPropertyByName("sound_position", value))
{ {

@ -5449,6 +5449,13 @@ class CMissionActionSoundTrigger : public IMissionAction
else else
_SoundPosition = ""; _SoundPosition = "";
_SoundId = NLMISC::CSheetId(_SoundName);
if (_SoundId == NLMISC::CSheetId::Unknown)
{
MISLOGSYNTAXERROR("sound_trigger action: sheetid not found");
return false;
}
return ret; return ret;
} }
@ -5460,6 +5467,7 @@ class CMissionActionSoundTrigger : public IMissionAction
}; };
std::string _SoundName; std::string _SoundName;
std::string _SoundPosition; std::string _SoundPosition;
NLMISC::CSheetId _SoundId;
MISSION_ACTION_GETNEWPTR(CMissionActionSoundTrigger) MISSION_ACTION_GETNEWPTR(CMissionActionSoundTrigger)
}; };

Loading…
Cancel
Save