X Tutup
Skip to content

Fix ambient music looping#5061

Merged
sturnclaw merged 1 commit intopioneerspacesim:masterfrom
WKFO:loop
Dec 11, 2020
Merged

Fix ambient music looping#5061
sturnclaw merged 1 commit intopioneerspacesim:masterfrom
WKFO:loop

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).

¯_(ツ)_/¯

@sturnclaw
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.

@sturnclaw sturnclaw 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

X Tutup