]> git.lizzy.rs Git - minetest.git/blobdiff - src/sound.h
Move `setlocale` from Lua to C++.
[minetest.git] / src / sound.h
index b9c8470799b9ff506dc8aa68558ff9438491e297..0ad34e5cdfb68e9f477c7305ce1f0baf0f92272f 100644 (file)
@@ -34,12 +34,13 @@ class OnDemandSoundFetcher
 struct SimpleSoundSpec
 {
        SimpleSoundSpec(const std::string &name = "", float gain = 1.0f,
-                       float fade = 0.0f, float pitch = 1.0f)
-           : name(name), gain(gain), fade(fade), pitch(pitch)
+                       float fade = 0.0f, float pitch = 1.0f) :
+                       name(name),
+                       gain(gain), fade(fade), pitch(pitch)
        {
        }
 
-       bool exists() const { return name != ""; }
+       bool exists() const { return !name.empty(); }
 
        std::string name = "";
        float gain = 1.0f;
@@ -50,7 +51,8 @@ struct SimpleSoundSpec
 class ISoundManager
 {
 public:
-       virtual ~ISoundManager() {}
+       virtual ~ISoundManager() = default;
+
        // Multiple sounds can be loaded per name; when played, the sound
        // should be chosen randomly from alternatives
        // Return value determines success/failure
@@ -80,7 +82,7 @@ class ISoundManager
        {
                return playSound(spec.name, loop, spec.gain, spec.fade, spec.pitch);
        }
-       int playSoundAt(const SimpleSoundSpec &spec, bool loop, v3f pos)
+       int playSoundAt(const SimpleSoundSpec &spec, bool loop, const v3f &pos)
        {
                return playSoundAt(spec.name, loop, spec.gain, pos, spec.pitch);
        }