Simplest explanation I could come up with is, someone didn't know about continue and restarts execution of the loop via break, breaking out into the outer loop restarting the inner.
Or some clean-up/reset code follows after the inner loop to put it back into a state where the outer loop can re-run the inner.
There may be better ways to do this, but this could be on a hardware platform where code size is limited, and for hardware while true loops are a fact of life and very understood. Not saying this is the case, but I can see a scenario where this would be the best code for the job.
That makes me sad. But in c++ at least it calls the default constructor, so this player will be reset every loop iteration. So there must be something else happening
Simplest explanation I could come up with is, someone didn't know about continue and restarts execution of the loop via break, breaking out into the outer loop restarting the inner.
Or some clean-up/reset code follows after the inner loop to put it back into a state where the outer loop can re-run the inner.
My guess is they're iterating two different things that they break out of at some point, instead of using the outer scope to keep track within the while.
seeming as this is a game, I imagine it's nested with 3 other while loops for game states (main menu, main game, play again screen) and it breaks every state. Can this be done better? probably, but it makes sense
66
u/malsomnus Nov 27 '21
Wait, no, I'm legit curious and am asking.
3
u/[deleted] Nov 27 '21
Cant so just do the basic sfml loop ? XD
14
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 27 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
6
u/Nall-ohki Nov 27 '21
So true, so true...
2
u/ScrimmlyBingus Nov 28 '21
gotta break dance to escape the loops
5
u/[deleted] Nov 27 '21
For a split second I thought Sprite the soda was part of the code 😭
4
u/noreal Nov 27 '21
What’s wrong with this?
1
u/rustyredditortux Nov 28 '21
seeming as this is a game, I imagine it's nested with 3 other while loops for game states (main menu, main game, play again screen) and it breaks every state. Can this be done better? probably, but it makes sense