Skip to content

Conversation

@hweimer
Copy link
Contributor

@hweimer hweimer commented Sep 9, 2020

Fixed a bug that led to LM points not being awarded in case of an "all systems go" (i.e., code 0) failure. Closes #441.

@rnyoakum
Copy link
Contributor

As I understand it, the criteria for awarding the LM points is a successful "LEM THRUST TEST" step, which should be an 'a' code in the mStr. When Mev[i].PComp is set in MissionSteps, there is no case 'a' defined. This makes sense; a thrust test isn't a prestige event. Consequently the thrust test should fall under

 399     default:
 400         Mev[step].Prest = -100;
 401         Mev[step].PComp = 0;
 402         break;
 403     }

and PComp should remain at that value for the rest of the function (the steps fails the subsequent if... conditions)

 405     if (Mev[step].Prest != -100) {
 406         Mev[step].PComp = WhichPart(plr, Mev[step].Prest);
 407     }
 408 
 409     if (PastBANG == 1 && Mev[step].PComp > 0) {
 410         Mev[step].PComp = 5;
 411     }

The PComp value isn't referenced again until FailEval in mis_m.cpp; for a LEM Thrust Test, the failure codes should be 0 (A-OK), 31 (everyone dies), or 4 (fail and branch to alternate). Every instance where PComp is modified in FailEval - in fact, in all of mis_m.cpp - the code always checks

if (Mev[STEP].PComp > 0) {
    Mev[STEP].PComp = 4;
}

Since PComp should be 0 at this point, it will remain that value.

When the steps are traced in prest.cpp, Mev[i].PComp once again may be changed

 804     other = MaxFail();
 805 
 806     for (i = 0; i < STEPnum; i++) {
 807         if (Mev[i].PComp == 5 && Mev[i].StepInfo == 0) {
 808             Mev[i].PComp = 0;
 809             Mev[i].Prest = -100;
 810         }
 811 
 812         if ((MANNED[0] + MANNED[1]) > 0) {
 813             if (other >= 3000) {
 814                 Mev[i].PComp = 4;
 815             } else if (Mev[i].Prest >= -28 && Mev[i].StepInfo > 2999) {
 816                 Mev[i].PComp = 4;
 817             }
 818         }
 819     }

and should be set to 4 if somebody died. For a type 31 failure, this is true. For a type 4 failure, it need not be. The max fail code could easily be 1926, the value set for a type 4 failure during the LEM Thrust Test. In that case, Mev[i].PComp would remain 0 and award LM points in Set_LM even though the step failed.

Am I missing something?

Fixed a bug that led to LM points not being awarded in case of an "all
systems go" (i.e., code 0) failure. Closes raceintospace#441.
@hweimer
Copy link
Contributor Author

hweimer commented Sep 11, 2020

You are right, I wasn't aware of the check in MissionSteps. Then we should add a test for StepInfo == 50, such that a-ok failures also get a pass. I have updated the commit to do that.

@rnyoakum rnyoakum merged commit 654153f into raceintospace:master Sep 11, 2020
@hweimer hweimer deleted the fix-lm-aok branch April 28, 2021 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A-OK error on LEM Thrust Test does not award LM point

2 participants