Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ambient music looping #5061

Merged
merged 1 commit into from
Dec 11, 2020
Merged

Fix ambient music looping #5061

merged 1 commit into from
Dec 11, 2020

Conversation

WKFO
Copy link
Contributor

@WKFO WKFO commented Dec 8, 2020

I haven't got the slightest idea why no argument to loop isn't treated as such, but adding a default seems to fix #5049
It looks like otherwise the related code in SoundMusic.cpp gets a repeat = true (line 53 I think).

¯_(ツ)_/¯

@Web-eWorks
Copy link
Member

@WKFO the relevant code is in src/lua/LuaMusic.cpp - it uses the pattern

bool repeat = true;
if (lua_isboolean(l, 2))
    repeat = lua_toboolean(l, 2) != 0;

Which should instead be bool repeat = LuaPull<bool>(l, 2, false);, that is, default to a false value if no argument is present. Changing all instances of the above resolves the root cause of the issue and also makes the code cleaner!

@WKFO
Copy link
Contributor Author

WKFO commented Dec 10, 2020

@Web-eWorks saves me again. Thank you, and I pushed the change.

src/lua/LuaMusic.cpp Outdated Show resolved Hide resolved
@Web-eWorks Web-eWorks merged commit 0b8bcd3 into pioneerspacesim:master Dec 11, 2020
@WKFO WKFO deleted the loop branch December 11, 2020 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Music loops unintentionally
2 participants