UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_mission_intercept.cpp File Reference

Campaign mission. More...

#include "../../../cl_shared.h"
#include "../cp_campaign.h"
#include "../cp_ufo.h"
#include "../cp_missions.h"
#include "../cp_time.h"
#include "../cp_alien_interest.h"
#include "../cp_xvi.h"
#include "cp_mission_intercept.h"

Go to the source code of this file.

Macros

#define UFO_EPSILON   0.00001f
 

Functions

void CP_InterceptMissionIsSuccess (mission_t *mission)
 Intercept mission is over and is a success: change interest values. More...
 
void CP_InterceptMissionIsFailure (mission_t *mission)
 Intercept mission is over and is a failure: change interest values. More...
 
void CP_InterceptMissionLeave (mission_t *mission, bool destroyed)
 Intercept mission ends: UFO leave earth. More...
 
static void CP_InterceptAttackInstallation (mission_t *mission)
 UFO starts to attack the installation. More...
 
void CP_InterceptAircraftMissionSet (mission_t *mission)
 Set Intercept mission: UFO looks for new aircraft target. More...
 
static installation_tCP_InterceptChooseInstallation (const mission_t *mission)
 Choose Base that will be attacked, and add it to mission description. More...
 
void CP_InterceptGoToInstallation (mission_t *mission)
 Set Intercept mission: UFO chooses an installation an flies to it. More...
 
static void CP_InterceptMissionSet (mission_t *mission)
 Set Intercept mission: choose between attacking aircraft or installations. More...
 
void CP_InterceptNextStage (mission_t *mission)
 Determine what action should be performed when a Intercept mission stage ends. More...
 

Detailed Description

Campaign mission.

Definition in file cp_mission_intercept.cpp.

Macro Definition Documentation

#define UFO_EPSILON   0.00001f

Function Documentation

void CP_InterceptAircraftMissionSet ( mission_t mission)

Set Intercept mission: UFO looks for new aircraft target.

Note
Intercept mission – Stage 1

Definition at line 126 of file cp_mission_intercept.cpp.

References ccs, ccs_s::date, Date_Add(), Date_Random(), mission_s::finalDate, mission_s::stage, and STAGE_INTERCEPT.

Referenced by CP_InterceptMissionSet().

static void CP_InterceptAttackInstallation ( mission_t mission)
static
static installation_t* CP_InterceptChooseInstallation ( const mission_t mission)
static

Choose Base that will be attacked, and add it to mission description.

Note
Base attack mission – Stage 1
Returns
Pointer to the base, nullptr if no base set

Definition at line 140 of file cp_mission_intercept.cpp.

References frand(), i, and INS_Foreach.

Referenced by CP_InterceptGoToInstallation().

void CP_InterceptGoToInstallation ( mission_t mission)
void CP_InterceptMissionIsFailure ( mission_t mission)

Intercept mission is over and is a failure: change interest values.

Note
Intercept mission

Definition at line 53 of file cp_mission_intercept.cpp.

References CP_MissionRemove(), f, INT_ChangeIndividualInterest(), INTERESTCATEGORY_BASE_ATTACK, INTERESTCATEGORY_BUILDING, INTERESTCATEGORY_INTERCEPT, and INTERESTCATEGORY_TERROR_ATTACK.

Referenced by CP_MissionIsOver().

void CP_InterceptMissionIsSuccess ( mission_t mission)

Intercept mission is over and is a success: change interest values.

Note
Intercept mission

Definition at line 38 of file cp_mission_intercept.cpp.

References CP_IsXVIStarted, CP_MissionRemove(), f, INT_ChangeIndividualInterest(), INTERESTCATEGORY_HARVEST, INTERESTCATEGORY_INTERCEPT, INTERESTCATEGORY_RECON, and INTERESTCATEGORY_XVI.

Referenced by CP_InterceptNextStage(), and CP_MissionIsOver().

void CP_InterceptMissionLeave ( mission_t mission,
bool  destroyed 
)

Intercept mission ends: UFO leave earth.

Parameters
[in]missionPointer to the mission
[in]destroyedtrue if the UFO actually destroyed the installation, false else
Note
Intercept mission – Stage 3

Definition at line 71 of file cp_mission_intercept.cpp.

References CP_MissionDisableTimeLimit(), CP_MissionRemoveFromGeoscape(), mission_s::data, INS_DestroyInstallation(), mission_s::missionData_t::installation, aircraft_s::landed, installation_s::pos, mission_s::pos, mission_s::stage, STAGE_RETURN_TO_ORBIT, mission_s::ufo, UFO_EPSILON, UFO_SetRandomDest(), Vector2Copy, and VectorCompareEps().

Referenced by CP_InterceptNextStage(), and CP_MissionNotifyInstallationDestroyed().

static void CP_InterceptMissionSet ( mission_t mission)
static

Set Intercept mission: choose between attacking aircraft or installations.

Note
Intercept mission – Stage 1

Definition at line 196 of file cp_mission_intercept.cpp.

References CP_InterceptAircraftMissionSet(), CP_InterceptGoToInstallation(), frand(), aircraft_s::getUfoType(), INS_HasAny(), mission_s::ufo, and UFO_CanDoMission().

Referenced by CP_InterceptNextStage().