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

Commit e50c888

Browse files
committed
Added consts to a bunch methods - if any of them are wrong please remove them
1 parent daedacb commit e50c888

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

Entities/SoundContainer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ namespace RTE {
171171

172172
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
173173

174-
std::vector<size_t> SoundContainer::GetSelectedSoundHashes() {
174+
std::vector<size_t> SoundContainer::GetSelectedSoundHashes() const {
175175
std::vector<size_t> soundHashes;
176176
for (SoundData selectedSoundData : m_SoundSets[m_SelectedSoundSet]) {
177177
soundHashes.push_back(selectedSoundData.SoundFile.GetHash());

Entities/SoundContainer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ namespace RTE {
187187
/// Indicates whether any sound in this SoundContainer is currently being played.
188188
/// </summary>
189189
/// <returns>Whether any sounds are playing.</returns>
190-
bool IsBeingPlayed() { return m_PlayingChannels.size() > 0; }
190+
bool IsBeingPlayed() const { return m_PlayingChannels.size() > 0; }
191191

192192
/// <summary>
193193
/// Adds a channel index to the SoundContainer's collection of playing channels.
@@ -205,7 +205,7 @@ namespace RTE {
205205
/// Gets the current sound selection cycle mode, which is used to determine what SoundSet to select next time SelectNextSoundSet is called.
206206
/// </summary>
207207
/// <returns>The current sound selection cycle mode.</returns>
208-
SoundCycleMode GetSoundSelectionCycleMode() { return m_SoundSelectionCycleMode; }
208+
SoundCycleMode GetSoundSelectionCycleMode() const { return m_SoundSelectionCycleMode; }
209209

210210
/// <summary>
211211
/// Sets the current sound selection cycle mode, which is used to determine what SoundSet to select next time SelectNextSoundSet is called.
@@ -217,13 +217,13 @@ namespace RTE {
217217
/// Gets the selected SoundSet for this SoundContainer. The selected SoundSet is changed with SelectNextSoundSet.
218218
/// </summary>
219219
/// <returns>The selected SoundSet.</returns>
220-
std::vector<SoundData> GetSelectedSoundSet() { return m_SoundSets[m_SelectedSoundSet]; }
220+
std::vector<SoundData> GetSelectedSoundSet() const { return m_SoundSets[m_SelectedSoundSet]; }
221221

222222
/// <summary>
223223
/// Gets a vector of hashes of the sounds selected to be played next in this SoundContainer.
224224
/// </summary>
225225
/// <returns>The currently playing sounds hashes.</returns>
226-
std::vector<size_t> GetSelectedSoundHashes();
226+
std::vector<size_t> GetSelectedSoundHashes() const;
227227

228228
/// <summary>
229229
/// Gets the SoundData object that corresponds to the given FMOD::Sound. If the sound can't be found, it returns a null pointer.
@@ -306,7 +306,7 @@ namespace RTE {
306306
/// Gets whether the sounds in this SoundContainer have all had all their properties set appropriately. Used to account for issues with ordering in INI loading.
307307
/// </summary>
308308
/// <returns>Whether or not the sounds in this SoundContainer have their properties set appropriately.</returns>
309-
bool AllSoundPropertiesUpToDate() { return m_AllSoundPropertiesUpToDate; }
309+
bool AllSoundPropertiesUpToDate() const { return m_AllSoundPropertiesUpToDate; }
310310
#pragma endregion
311311

312312
#pragma region Playback Controls

Managers/AudioMan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ namespace RTE {
186186

187187
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
188188

189-
double AudioMan::GetMusicPosition() {
189+
double AudioMan::GetMusicPosition() const {
190190
if (m_AudioEnabled || IsMusicPlaying()) {
191191
FMOD_RESULT result;
192192
FMOD::Channel *musicChannel;
@@ -745,14 +745,14 @@ namespace RTE {
745745

746746
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
747747

748-
FMOD_VECTOR AudioMan::GetAsFMODVector(const Vector &vector, float zValue) {
748+
FMOD_VECTOR AudioMan::GetAsFMODVector(const Vector &vector, float zValue) const {
749749
Vector sceneDimensions = g_SceneMan.GetScene() ? g_SceneMan.GetSceneDim() : Vector();
750750
return sceneDimensions.IsZero() ? FMOD_VECTOR{0, 0, zValue} : FMOD_VECTOR{vector.m_X, sceneDimensions.m_Y - vector.m_Y, zValue};
751751
}
752752

753753
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
754754

755-
Vector AudioMan::GetAsVector(FMOD_VECTOR fmodVector) {
755+
Vector AudioMan::GetAsVector(FMOD_VECTOR fmodVector) const {
756756
Vector sceneDimensions = g_SceneMan.GetScene() ? g_SceneMan.GetSceneDim() : Vector();
757757
return sceneDimensions.IsZero() ? Vector() : Vector(fmodVector.x, sceneDimensions.m_Y - fmodVector.y);
758758
}

Managers/AudioMan.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,25 +111,25 @@ namespace RTE {
111111
/// Gets the audio management system object used for playing all audio.
112112
/// </summary>
113113
/// <returns>The audio management system object used by AudioMan for playing audio.</returns>
114-
FMOD::System *GetAudioSystem() { return m_AudioSystem; }
114+
FMOD::System *GetAudioSystem() const { return m_AudioSystem; }
115115

116116
/// <summary>
117117
/// Reports whether audio is enabled.
118118
/// </summary>
119119
/// <returns>Whether audio is enabled.</returns>
120-
bool IsAudioEnabled() { return m_AudioEnabled; }
120+
bool IsAudioEnabled() const { return m_AudioEnabled; }
121121

122122
/// <summary>
123123
/// Returns the number of audio channels currently used.
124124
/// </summary>
125125
/// <returns>The number of audio channels currently used.</returns>
126-
int GetPlayingChannelCount() { int channelCount; return m_AudioSystem->getChannelsPlaying(&channelCount, NULL) == FMOD_OK ? channelCount : 0; }
126+
int GetPlayingChannelCount() const { int channelCount; return m_AudioSystem->getChannelsPlaying(&channelCount, NULL) == FMOD_OK ? channelCount : 0; }
127127

128128
/// <summary>
129129
/// Returns the number of audio channels available in total.
130130
/// </summary>
131131
/// <returns>The number of audio channels available in total.</returns>
132-
int GetTotalChannelCount() { int channelCount; return m_AudioSystem->getSoftwareChannels(&channelCount) == FMOD_OK ? channelCount : 0; }
132+
int GetTotalChannelCount() const { int channelCount; return m_AudioSystem->getSoftwareChannels(&channelCount) == FMOD_OK ? channelCount : 0; }
133133

134134
/// <summary>
135135
/// Gets the global pitch scalar value for all sounds and music.
@@ -151,7 +151,7 @@ namespace RTE {
151151
/// Reports whether any music stream is currently playing.
152152
/// </summary>
153153
/// <returns>Whether any music stream is currently playing.</returns>
154-
bool IsMusicPlaying() { bool isPlayingMusic; return m_AudioEnabled && m_MusicChannelGroup->isPlaying(&isPlayingMusic) == FMOD_OK ? isPlayingMusic : false; }
154+
bool IsMusicPlaying() const { bool isPlayingMusic; return m_AudioEnabled && m_MusicChannelGroup->isPlaying(&isPlayingMusic) == FMOD_OK ? isPlayingMusic : false; }
155155

156156
/// <summary>
157157
/// Gets the volume of music. Does not get volume of sounds.
@@ -188,7 +188,7 @@ namespace RTE {
188188
/// Gets the position of playback of the current music stream, in seconds.
189189
/// </summary>
190190
/// <returns>The current position of the current stream playing, in seconds.</returns>
191-
double GetMusicPosition();
191+
double GetMusicPosition() const;
192192

193193
/// <summary>
194194
/// Sets the music to a specific position in the song.
@@ -352,7 +352,7 @@ namespace RTE {
352352
/// Returns true if manager is in multiplayer mode.
353353
/// </summary>
354354
/// <returns>True if in multiplayer mode.</returns>
355-
bool IsInMultiplayerMode() { return m_IsInMultiplayerMode; }
355+
bool IsInMultiplayerMode() const { return m_IsInMultiplayerMode; }
356356

357357
/// <summary>
358358
/// Sets the multiplayer mode flag.
@@ -468,14 +468,14 @@ namespace RTE {
468468
/// </summary>
469469
/// <param name="vector">The RTE Vector to get as an FMOD_VECTOR.</param>
470470
/// <returns>The FMOD_VECTOR that corresponds to the given RTE Vector.</returns>
471-
FMOD_VECTOR GetAsFMODVector(const Vector &vector, float zValue = 0);
471+
FMOD_VECTOR GetAsFMODVector(const Vector &vector, float zValue = 0) const;
472472

473473
/// <summary>
474474
/// Gets the corresponding RTE Vector for a given FMOD_VECTOR.
475475
/// </summary>
476476
/// <param name="fmodVector">The FMOD_VECTOR to get as an RTE Vector.</param>
477477
/// <returns>The RTE Vector that corresponds to the given FMOD_VECTOR.</returns>
478-
Vector GetAsVector(FMOD_VECTOR fmodVector);
478+
Vector GetAsVector(FMOD_VECTOR fmodVector) const;
479479

480480
/// <summary>
481481
/// Clears all the member variables of this AudioMan, effectively resetting the members of this abstraction level only.

0 commit comments

Comments
 (0)