gm9 is correct. Mathematically the returned value for the mission # can never be greater than 18. The modulus operator is pretty cool and I personally only knew of it's existence in probably the past year or so and never knew a good reason to use it.
I realize now I could probably just use array_size or something, instead of having the hard-coded number 19, but oh well. And yes it allows easily to add/remove missions should it be necessary.
It's simple division, between two numbers, but the % sign uses the remainder, so that the number can never be more than 18.
0%19 = 0 (0 is mission #1 starting at 0 in code)
10%19 = 10
18%19 = 18 (18 is mission #19 since we started at 0 in code)
19%19 = 0 (0 would be the first mission, starting the cycle over)
|