cp_mission_xvi.c
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "../../cl_shared.h"
00027 #include "../cp_campaign.h"
00028 #include "../cp_missions.h"
00029 #include "../cp_time.h"
00030 #include "../cp_alien_interest.h"
00031 #include "../cp_ufo.h"
00032
00037 void CP_XVIMissionIsSuccess (mission_t *mission)
00038 {
00039 CL_ChangeIndividualInterest(-0.3f, INTERESTCATEGORY_XVI);
00040 CL_ChangeIndividualInterest(0.1f, INTERESTCATEGORY_HARVEST);
00041 CL_ChangeIndividualInterest(0.05f, INTERESTCATEGORY_BUILDING);
00042
00043 CP_MissionRemove(mission);
00044 }
00045
00050 void CP_XVIMissionIsFailure (mission_t *mission)
00051 {
00052 CL_ChangeIndividualInterest(0.1f, INTERESTCATEGORY_INTERCEPT);
00053 CL_ChangeIndividualInterest(0.05f, INTERESTCATEGORY_TERROR_ATTACK);
00054 CL_ChangeIndividualInterest(0.01f, INTERESTCATEGORY_BASE_ATTACK);
00055
00056 CP_MissionRemove(mission);
00057 }
00058
00063 static void CP_XVIMissionStart (mission_t *mission)
00064 {
00065 const date_t minMissionDelay = {2, 0};
00066 const date_t missionDelay = {3, 0};
00067
00068 mission->stage = STAGE_SPREAD_XVI;
00069
00070
00071 CP_MissionAddToGeoscape(mission, qfalse);
00072
00073 if (mission->ufo) {
00074 mission->finalDate = Date_Add(ccs.date, Date_Random(minMissionDelay, missionDelay));
00075
00076 CP_UFORemoveFromGeoscape(mission, qfalse);
00077 } else {
00078
00079 mission->finalDate = ccs.date;
00080 }
00081 }
00082
00090 int CP_XVIMissionAvailableUFOs (const mission_t const *mission, ufoType_t *ufoTypes)
00091 {
00092 int num = 0;
00093
00094 ufoTypes[num++] = UFO_SCOUT;
00095 ufoTypes[num++] = UFO_FIGHTER;
00096 if (UFO_ShouldAppearOnGeoscape(UFO_CORRUPTER))
00097 ufoTypes[num++] = UFO_CORRUPTER;
00098
00099 return num;
00100 }
00101
00106 void CP_XVIMissionNextStage (mission_t *mission)
00107 {
00108 switch (mission->stage) {
00109 case STAGE_NOT_ACTIVE:
00110
00111 CP_MissionBegin(mission);
00112 break;
00113 case STAGE_COME_FROM_ORBIT:
00114
00115 CP_HarvestMissionGo(mission);
00116 break;
00117 case STAGE_MISSION_GOTO:
00118
00119 CP_XVIMissionStart(mission);
00120 break;
00121 case STAGE_SPREAD_XVI:
00122
00123 CP_ReconMissionLeave(mission);
00124 break;
00125 case STAGE_RETURN_TO_ORBIT:
00126
00127 CP_XVIMissionIsSuccess(mission);
00128 break;
00129 default:
00130 Com_Printf("CP_XVIMissionNextStage: Unknown stage: %i, removing mission.\n", mission->stage);
00131 CP_MissionRemove(mission);
00132 break;
00133 }
00134 }