"I dumped the exp 3's config into the exp 4": This is a difficult bug to replicate, and from what I can see the flag is being loaded from and saved to config correctly. Outputting to debug also indicates that the flag is set correctly when gameplay starts. I might need a second pair of eyes on this one.
I've attached my
settings.ini from the exp 3.
Ideas: Assuming you load, save, and use the option properly, there is a fourth thing to it: What happens to this option when we start NL with empty options file/new installation/...?
If you win with the final lemming that goes into the exit, and there are no more lemmings ... NL tells you: No more lemmings, rewind or quit. NL won't quit here even though I've won
tests I performed, levels always exit to postview correctly.
maybe you can see if there's something wrong?
When exactly do you call into the code that you showed?
When does NL update
LemmingsIn? Reason: In my vod at 02:00:45 (the same time that I wrote into my previous post), we clearly see 0 flagpole
and the message. According to your code, this can only happen when
LemmingsIn isn't 10 yet, and the level requires to save 10/10. Do you call into your code too early?
What is
DelayEndFrames? Do you expect it to be 0 in my vod around 02:00:45 when I run into the bug?
Best guess: it takes a tick to register the flags (but this wouldn't explain why it sometimes doesn't happen)
Correct, this doesn't explain why it sometimes freezes correctly (instead of overshooting by 1 frame).
But you make it sound as if you test for end-of-game during the physics updates, not in-between the physics updates. It's okay if you call it
after a physics update and cache your results, but still, caching means more mutable state, and mutable state is a source of bugs.
Consider to factor this code into two methods: One to test for end-of-game (regardless of how we react to that), and one to tell you whether we should show the message (that, among other things, asks the end-of-game method). In effect, try to refactor the flag
ShowNoLemsMessage into a method, to avoid mutable state, and call this method where you would have read the flag.
-- Simon