Repository navigation
fix: -intercept reads its six mission flags at option-relative argv indices - #7
Open
tomingtoming wants to merge 1 commit into
Open
tomingtoming wants to merge 1 commit into
tomingtoming wants to merge 1 commit into
Conversation
The six mission parameters after "-intercept AIR FLD" were read from av[3..8] instead of av[i+3..i+8], so they only lined up when -intercept happened to start at av[1] — and even then everything was off by one (allowStealth got FLD, numWingman got the intended maxNumAttacker, and the real last parameter was ignored). Use i-relative indices like every other option in this parser. Pure upstream-candidate bug fix, kept as a standalone commit so it can be cherry-picked and proposed as-is. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TpRG2watB63MUc5r4Vy5yx
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-intercept AIR FLD S AC H B N Wreads its six trailing mission flags from the absolute argv positionsav[3..8], while every other option inFsCommandParameter::RecognizeCommandParameterreads option-relativeav[i+3..i+8].Consequences:
-intercepthappens to be the first option (i==1) — and even then everything is shifted by one:allowStealthreceives the FIELD string, each subsequent flag receives the previous flag's value, and the documented last parameter (NWingmen) is dropped.-intercept, the six flags read unrelated argv entries.Fix: read
av[i+3..i+8], matching-freeflight,-endurance, etc. The documented argument order (-intercept Airplane Field Stealth Escort HeavyBomber Bomb NEnemy NWingmen) then takes effect regardless of the option's position.Verification
Built
ysflight64_gl2on Linux (gcc) from currentmasterwith only this commit applied, and calledRecognizeCommandParameterdirectly with the documented argument order and the values1 0 1 0 3 2(stealth=1, escort=0, heavy bomber=1, bomb=0, NEnemy=3, NWingmen=2):-interceptfirststealth=0 aircover=1 heavyBomber=0 bomb=1 maxNumAttacker=1 numWingman=2(shifted by one)1 0 1 0 3 2as documented-autoexitbefore-interceptstealth=0 aircover=0 heavyBomber=1 bomb=0 maxNumAttacker=1 numWingman=0(readsAIR FLD 1 0 1 0)1 0 1 0 3 2as documentedexecutionMode,airNameandfldNameare correct in all cases (those already used option-relative indices).Found while porting YSFLIGHT to WebAssembly (ysflight-web) — the bug is in the original desktop code path as well. Thank you for releasing the source, and no hurry at all with this one!