Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 415311c

Browse files
committed
Made LuaMan a friend of SoundSet so it has access to the SubSoundSets property, since the reference getter can't be used with the stl_iterator. Changed luaman accordingly
Changed SoundContainer TopLevelSoundSet getter to a function instead of a property cause a property wasn't working for some reason Fixed a couple little issues
1 parent 16f6e83 commit 415311c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Entities/SoundSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ namespace RTE {
243243
/// </summary>
244244
auto selectSoundForwards = [&selectedVectorSize, &unselectedVectorSize, this]() {
245245
m_CurrentSelection.second++;
246-
if (m_CurrentSelection.second > selectedVectorSize) {
246+
if (m_CurrentSelection.second > selectedVectorSize - 1) {
247247
m_CurrentSelection = {!m_CurrentSelection.first, 0};
248248
std::swap(selectedVectorSize, unselectedVectorSize);
249249
if (selectedVectorSize == 0) {

Entities/SoundSet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33

44
#include "Vector.h"
55
#include "ContentFile.h"
6+
#include "LuaMan.h"
67

78
namespace RTE {
89

910
/// <summary>
1011
/// A set of sounds, and their selection data.
1112
/// </summary>
1213
class SoundSet : public Serializable {
14+
friend class LuaMan;
1315

1416
public:
1517

Managers/LuaMan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ int LuaMan::Create() {
581581
value("RESTART", SoundContainer::SoundOverlapMode::RESTART),
582582
value("IGNORE_PLAY", SoundContainer::SoundOverlapMode::IGNORE_PLAY)
583583
]
584-
.property("TopLevelSoundSet", &SoundContainer::GetTopLevelSoundSet)
585584
.property("SoundOverlapMode", &SoundContainer::GetSoundOverlapMode, &SoundContainer::SetSoundOverlapMode)
586585
.property("Immobile", &SoundContainer::IsImmobile, &SoundContainer::SetImmobile)
587586
.property("AttenuationStartDistance", &SoundContainer::GetAttenuationStartDistance, &SoundContainer::SetAttenuationStartDistance)
@@ -592,6 +591,7 @@ int LuaMan::Create() {
592591
.property("Volume", &SoundContainer::GetVolume, &SoundContainer::SetVolume)
593592
.property("Pitch", &SoundContainer::GetPitch, &SoundContainer::SetPitch)
594593
.def("HasAnySounds", &SoundContainer::HasAnySounds)
594+
.def("GetTopLevelSoundSet", &SoundContainer::GetTopLevelSoundSet)
595595
.def("IsBeingPlayed", &SoundContainer::IsBeingPlayed)
596596
.def("Play", (bool (SoundContainer:: *)()) &SoundContainer::Play)
597597
.def("Play", (bool (SoundContainer:: *)(const int player)) &SoundContainer::Play)
@@ -602,15 +602,15 @@ int LuaMan::Create() {
602602
.def("Restart", (bool (SoundContainer:: *)()) &SoundContainer::Restart)
603603
.def("Restart", (bool (SoundContainer:: *)(int player)) &SoundContainer::Restart),
604604

605-
class_<SoundSet, Serializable>("SoundSet")
605+
class_<SoundSet>("SoundSet")
606606
.def(constructor<>())
607607
.enum_("SoundSelectionCycleMode")[
608608
value("RANDOM", SoundSet::SoundSelectionCycleMode::RANDOM),
609609
value("FORWARDS", SoundSet::SoundSelectionCycleMode::FORWARDS),
610610
value("ALL", SoundSet::SoundSelectionCycleMode::ALL)
611611
]
612612
.property("SoundSelectionCycleMode", &SoundSet::GetSoundSelectionCycleMode, &SoundSet::SetSoundSelectionCycleMode)
613-
.def_readonly("SubSoundSets", &SoundSet::GetSubSoundSets, return_stl_iterator)
613+
.def_readonly("SubSoundSets", &SoundSet::m_SubSoundSets, return_stl_iterator)
614614
.def("HasAnySounds", &SoundSet::HasAnySounds)
615615
.def("SelectNextSounds", &SoundSet::SelectNextSounds)
616616
.def("AddSound", (void (SoundSet:: *)(std::string const &soundFilePath)) &SoundSet::AddSound)

0 commit comments

Comments
 (0)