Macroz/kerbal

"stage" in check-staging! is off-by-one

xkr47 opened this issue · 1 comments

xkr47 commented

Here you set stage to one-less-than current stage:

(let [stage (dec (.getCurrentStage (get-control vessel)))

So therefore (last-stage? stage) further down stops progressing stages one stage too early OR if advanced elsewhere, fails to stop advancing stages when it actually reaches the last stage and busyloops next-stage!.

I guess the reason for this was so the stage argument to the next-stage-has-x? functions would be correct.. but I'd like to argue that if a function is called next-stage-x then the function is expected to do the stage argument adjustment itself, otherwise the next- prefix in the function name is not motivated..

Yes this is definitely in the one evening coding level so I'm not sure what the stage value should be internally.