/** Sets Goal Values and Sums into Data Structure
 * control should be always called with a value of 0
 * Successful Steps Only
 * Requires MEV to be packed
 */
char Set_Goal(char plr, char which, char control)
{
    char sum, pd, qt;

    sum = 0;

    if (control != 3) {
        if (MaxFail() > 1999) {
            return -1;
        }
    } else {
        control = 0;
    }

    if (control == 1 || which >= 0) { // Means successful to this part

        if (Data->Prestige[which].Place == -1) {
            switch (which) { // flag milestones
            case Prestige_OrbitalSatellite:
                isMile(plr, Milestone_OrbitalSatellite) = 1;
                break;

            case Prestige_MannedSpaceMission:
                isMile(plr, Milestone_ManInSpace) = 1;
                break;

            case Prestige_MannedOrbital:
                isMile(plr, Milestone_EarthOrbit) = 1;
                break;

            case Prestige_LunarFlyby:
                isMile(plr, Milestone_LunarFlyby) = 1;
                break;

            case Prestige_LunarProbeLanding:
                isMile(plr, Milestone_LunarPlanetary) = 1;
                break;

            case Prestige_MannedLunarPass:
                isMile(plr, Milestone_LunarPass) = 1;
                break;

            case Prestige_MannedLunarOrbit:
                isMile(plr, Milestone_LunarOrbit) = 1;
                break;

            case Prestige_MannedLunarLanding:
                isMile(plr, Milestone_LunarLanding) = 1;
                break;
            }

            if (control == 0) {
                Data->P[plr].MissionCatastrophicFailureOnTurn |= 4; // for astros


                if (MAIL == 0) {
                    pd = Mev[0].pad;
                    qt = Data->P[0].Udp[pd].Qty;
                    Data->P[0].Udp[pd].HInd = Data->P[0].PastMissionCount;
                    Data->P[0].Udp[pd].Poss[qt] = which;
                    Data->P[0].Udp[pd].PossVal[qt] = 0;
                    Data->P[0].Udp[pd].Mnth = tMo;
                    ++Data->P[0].Udp[pd].Qty;
                } else {
                    Data->Prestige[which].Place = plr;
                    Data->Prestige[which].Index = Data->P[plr].PastMissionCount;
                    Data->Prestige[which].Year = tYr;
                    Data->Prestige[which].Month = tMo;
                    Data->Prestige[which].Goal[plr]++;  // increment count
                    Data->Prestige[which].Points[plr] += Data->Prestige[which].Add[0];
                    sum += Data->Prestige[which].Add[0];
                }

                hero |= HeroCheck(which);
            } else if (control == 1) {
                switch (which) {
                case Prestige_Duration_B:
                case Prestige_Duration_C:
                case Prestige_Duration_D:
                case Prestige_Duration_E:
                case Prestige_Duration_F:
                    if (MAIL == 0) {
                        pd = Mev[0].pad;
                        qt = Data->P[0].Udp[pd].Qty;
                        Data->P[0].Udp[pd].HInd = Data->P[0].PastMissionCount;
                        Data->P[0].Udp[pd].Poss[qt] = which;
                        Data->P[0].Udp[pd].PossVal[qt] = 0;
                        Data->P[0].Udp[pd].Mnth = tMo;
                        ++Data->P[0].Udp[pd].Qty;
                    } else {
                        Data->Prestige[which].Place = plr;
                        Data->Prestige[which].Index = Data->P[plr].PastMissionCount;
                        Data->Prestige[which].Year = tYr;
                        Data->Prestige[which].Month = tMo;
                    }

                default:
                    break;
                }
            }
        } else if (Data->Prestige[which].mPlace == -1 && Data->Prestige[which].Place != plr) {
            Data->P[plr].MissionCatastrophicFailureOnTurn |= 4; // for astros


            Data->Prestige[which].mPlace = plr;

            switch (which) { // flag milestones
            case Prestige_OrbitalSatellite:
                isMile(plr, Milestone_OrbitalSatellite) = 1;
                break;

            case Prestige_MannedSpaceMission:
                isMile(plr, Milestone_ManInSpace) = 1;
                break;

            case Prestige_MannedOrbital:
                isMile(plr, Milestone_EarthOrbit) = 1;
                break;

            case Prestige_LunarFlyby:
                isMile(plr, Milestone_LunarFlyby) = 1;
                break;

            case Prestige_LunarProbeLanding:
                isMile(plr, Milestone_LunarPlanetary) = 1;
                break;

            case Prestige_MannedLunarPass:
                isMile(plr, Milestone_LunarPass) = 1;
                break;

            case Prestige_MannedLunarOrbit:
                isMile(plr, Milestone_LunarOrbit) = 1;
                break;

            case Prestige_MannedLunarLanding:
                isMile(plr, Milestone_LunarLanding) = 1;
                break;
            }

            if (control == 0) {
                Data->Prestige[which].Goal[plr]++;  // increment count
                sum += Data->Prestige[which].Add[1];
                Data->Prestige[which].Points[plr] += Data->Prestige[which].Add[1];

                hero |= HeroCheck(which);
            }
        } else if (sum < 3) { // Other
            if (control == 0) {
                Data->Prestige[which].Goal[plr]++;  // increment count
                sum += Data->Prestige[which].Add[2];
                Data->Prestige[which].Points[plr] += Data->Prestige[which].Add[2];
            }
        }
    }

    //----------------------------------------
    //Specs: Lunar Landing klugge (Duration D)
    //----------------------------------------
    if (which == Prestige_MannedLunarLanding || Data->Prestige[Prestige_MannedLunarLanding].Place == plr) {
        Data->P[plr].History[Data->P[plr].PastMissionCount].Duration = 4;
    }

    switch (which) {
    case Prestige_OrbitalSatellite:
        return (sum);

    case Prestige_MannedSpaceMission:
        return (sum);

    case Prestige_MannedOrbital:
        return (sum + Set_Goal(plr, Prestige_OrbitalSatellite, 1));

    case Prestige_LunarFlyby:
        return (sum + Set_Goal(plr, Prestige_MannedOrbital, 1));

    case Prestige_LunarProbeLanding:
        return (sum + Set_Goal(plr, Prestige_LunarFlyby, 1));

    case Prestige_MannedLunarPass:
        return (sum + Set_Goal(plr, Prestige_LunarProbeLanding, 1));

    case Prestige_MannedLunarOrbit:
        return (sum + Set_Goal(plr, Prestige_MannedLunarPass, 1));

    case Prestige_MannedLunarLanding:
        return (sum + Set_Goal(plr, Prestige_MannedLunarOrbit, 1));

    case Prestige_Duration_A:
        return (sum);

    case Prestige_Duration_B:
        return (sum);

    case Prestige_Duration_C:
        return (sum + Set_Goal(plr, Prestige_Duration_B, 1));

    case Prestige_Duration_D:
        return (sum + Set_Goal(plr, Prestige_Duration_C, 1));

    case Prestige_Duration_E:
        return (sum + Set_Goal(plr, Prestige_Duration_D, 1));

    case Prestige_Duration_F:
        return (sum + Set_Goal(plr, Prestige_Duration_E, 1));

    case Prestige_OnePerson:
        return (sum);

    case Prestige_TwoPerson:
        return (sum + Set_Goal(plr, Prestige_OnePerson, 1));

    case Prestige_ThreePerson:
        return (sum + Set_Goal(plr, Prestige_TwoPerson, 1));

    case Prestige_Minishuttle:
        return (sum + Set_Goal(plr, Prestige_ThreePerson, 1));

    case Prestige_FourPerson:
        return (sum + Set_Goal(plr, Prestige_Minishuttle, 1));

    case Prestige_MercuryFlyby:
    case Prestige_VenusFlyby:
    case Prestige_MarsFlyby:
    case Prestige_JupiterFlyby:
    case Prestige_SaturnFlyby:
    case Prestige_OrbitingLab:
    case Prestige_Spacewalk:
    case Prestige_MannedDocking:
    case Prestige_WomanInSpace:
        return (sum);

    default:
        return 0;
    }
}
Exemple #2
0
/** Sets Goal Values and Sums into Data Structure
 * control should be always called with a value of 0
 * Successful Steps Only
 * Requires MEV to be packed
 */
char Set_Goal(char plr, char which, char control)
{
    char sum, pd, qt;

    sum = 0;

    if (control != 3) {
        if (MaxFail() > 1999) {
            return -1;
        }
    } else {
        control = 0;
    }

    if (control == 1 || which >= 0) { // Means successful to this part

        if (Data->Prestige[which].Place == -1) {
            switch (which) { // flag milestones
            case ORBSAT:
                isMile(plr, MILE_OSAT) = 1;
                break;

            case MANSPACE:
                isMile(plr, MILE_MAN) = 1;
                break;

            case EORBIT:
                isMile(plr, MILE_EORBIT) = 1;
                break;

            case LUNFLY:
                isMile(plr, MILE_LFLY) = 1;
                break;

            case PROBELAND:
                isMile(plr, MILE_LPL) = 1;
                break;

            case LPASS:
                isMile(plr, MILE_LPASS) = 1;
                break;

            case LORBIT:
                isMile(plr, MILE_LORBIT) = 1;
                break;

            case LLAND:
                isMile(plr, MILE_LLAND) = 1;
                break;
            }

            if (control == 0) {
                Data->P[plr].Other |= 4; // for astros


                if (Option == 1) {
                    pd = Mev[0].pad;
                    qt = MP[pd].Qty;
                    MP[pd].HInd = Data->P[1].PastMis;
                    MP[pd].Poss[qt] = which;
                    MP[pd].PossVal[qt] = 0;
                    MP[pd].Mnth = tMo;
                    ++MP[pd].Qty;
                } else if (MAIL == 0) {
                    pd = Mev[0].pad;
                    qt = Data->P[0].Udp[pd].Qty;
                    Data->P[0].Udp[pd].HInd = Data->P[0].PastMis;
                    Data->P[0].Udp[pd].Poss[qt] = which;
                    Data->P[0].Udp[pd].PossVal[qt] = 0;
                    Data->P[0].Udp[pd].Mnth = tMo;
                    ++Data->P[0].Udp[pd].Qty;
                } else {
                    Data->Prestige[which].Place = plr;
                    Data->Prestige[which].Indec = Data->P[plr].PastMis;
                    Data->Prestige[which].Year = tYr;
                    Data->Prestige[which].Month = tMo;
                    Data->Prestige[which].Goal[plr]++;  // increment count
                    Data->Prestige[which].Points[plr] += Data->Prestige[which].Add[0];
                    sum += Data->Prestige[which].Add[0];
                }

                hero |= HeroCheck(which);
            } else if (control == 1) {
                switch (which) {
                case DUR_B:
                case DUR_C:
                case DUR_D:
                case DUR_E:
                case DUR_F:
                    if (Option == 1) {
                        pd = Mev[0].pad;
                        qt = MP[pd].Qty;
                        MP[pd].HInd = Data->P[1].PastMis;
                        MP[pd].Poss[qt] = which;
                        MP[pd].PossVal[qt] = 0;
                        MP[pd].Mnth = tMo;
                        ++MP[pd].Qty;
                    } else if (MAIL == 0) {
                        pd = Mev[0].pad;
                        qt = Data->P[0].Udp[pd].Qty;
                        Data->P[0].Udp[pd].HInd = Data->P[0].PastMis;
                        Data->P[0].Udp[pd].Poss[qt] = which;
                        Data->P[0].Udp[pd].PossVal[qt] = 0;
                        Data->P[0].Udp[pd].Mnth = tMo;
                        ++Data->P[0].Udp[pd].Qty;
                    } else {
                        Data->Prestige[which].Place = plr;
                        Data->Prestige[which].Indec = Data->P[plr].PastMis;
                        Data->Prestige[which].Year = tYr;
                        Data->Prestige[which].Month = tMo;
                    }

                default:
                    break;
                };
            }
        } else if (Data->Prestige[which].mPlace == -1 && Data->Prestige[which].Place != plr) {
            Data->P[plr].Other |= 4; // for astros


            Data->Prestige[which].mPlace = plr;

            switch (which) { // flag milestones
            case ORBSAT:
                isMile(plr, MILE_OSAT) = 1;
                break;

            case MANSPACE:
                isMile(plr, MILE_MAN) = 1;
                break;

            case EORBIT:
                isMile(plr, MILE_EORBIT) = 1;
                break;

            case LUNFLY:
                isMile(plr, MILE_LFLY) = 1;
                break;

            case PROBELAND:
                isMile(plr, MILE_LPL) = 1;
                break;

            case LPASS:
                isMile(plr, MILE_LPASS) = 1;
                break;

            case LORBIT:
                isMile(plr, MILE_LORBIT) = 1;
                break;

            case LLAND:
                isMile(plr, MILE_LLAND) = 1;
                break;
            }

            if (control == 0) {
                if (Option == 1) {
                    pd = Mev[0].pad;
                    qt = MP[pd].Qty;
                    MP[pd].HInd = Data->P[1].PastMis;
                    MP[pd].Poss[qt] = which;
                    MP[pd].PossVal[qt] = 1;
                    MP[pd].Mnth = tMo;
                    ++MP[pd].Qty;
                } else {
                    Data->Prestige[which].Goal[plr]++;  // increment count
                    sum += Data->Prestige[which].Add[1];
                    Data->Prestige[which].Points[plr] += Data->Prestige[which].Add[1];
                }

                hero |= HeroCheck(which);
            }
        } else if (sum < 3) { // Other
            if (control == 0) {
                if (Option == 1) {
                    pd = Mev[0].pad;
                    qt = MP[pd].Qty;
                    MP[pd].HInd = Data->P[1].PastMis;
                    MP[pd].Poss[qt] = which;
                    MP[pd].PossVal[qt] = 2;
                    MP[pd].Mnth = tMo;
                    ++MP[pd].Qty;
                } else {
                    Data->Prestige[which].Goal[plr]++;  // increment count
                    sum += Data->Prestige[which].Add[2];
                    Data->Prestige[which].Points[plr] += Data->Prestige[which].Add[2];
                }
            }
        }
    }

    //----------------------------------------
    //Specs: Lunar Landing klugge (Duration D)
    //----------------------------------------
    if (which == LLAND || Data->Prestige[22].Place == plr) {
        Data->P[plr].History[Data->P[plr].PastMis].Duration = 4;
    }

    switch (which) {
    case ORBSAT:
        return(sum);

    case MANSPACE:
        return(sum);

    case EORBIT:
        return(sum + Set_Goal(plr, ORBSAT, 1));

    case LUNFLY:
        return(sum + Set_Goal(plr, EORBIT, 1));

    case PROBELAND:
        return(sum + Set_Goal(plr, LUNFLY, 1));

    case LPASS:
        return(sum + Set_Goal(plr, PROBELAND, 1));

    case LORBIT:
        return(sum + Set_Goal(plr, LPASS, 1));

    case LLAND:
        return(sum + Set_Goal(plr, LORBIT, 1));

    case DUR_A:
        return(sum);

    case DUR_B:
        return(sum);

    case DUR_C:
        return(sum + Set_Goal(plr, DUR_B, 1));

    case DUR_D:
        return(sum + Set_Goal(plr, DUR_C, 1));

    case DUR_E:
        return(sum + Set_Goal(plr, DUR_D, 1));

    case DUR_F:
        return(sum + Set_Goal(plr, DUR_E, 1));

    case CAP1:
        return(sum);

    case CAP2:
        return(sum + Set_Goal(plr, CAP1, 1));

    case CAP3:
        return(sum + Set_Goal(plr, CAP2, 1));

    case CAPMS:
        return(sum + Set_Goal(plr, CAP3, 1));

    case CAP4:
        return(sum + Set_Goal(plr, CAPMS, 1));

    case ME_FB:
    case VE_FB:
    case MA_FB:
    case JU_FB:
    case SA_FB:
    case OLAB:
    case EWALK:
    case DOCK:
    case WOMAN:
        return (sum);

    default:
        return 0;
    }
}