UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_mission_buildbase.cpp File Reference

Campaign mission code for alien bases. More...

#include "../../../DateTime.h"
#include "../../../cl_shared.h"
#include "../cp_campaign.h"
#include "../cp_alienbase.h"
#include "../cp_geoscape.h"
#include "../cp_ufo.h"
#include "../cp_missions.h"
#include "../cp_time.h"
#include "../cp_xvi.h"
#include "../cp_alien_interest.h"
#include "cp_mission_buildbase.h"
#include "cp_mission_recon.h"
Include dependency graph for cp_mission_buildbase.cpp:

Go to the source code of this file.

Macros

#define HAPPINESS_SUBVERSION_LOSS   -0.15

Functions

bool CP_BasemissionIsSubvertingGovernmentMission (const mission_t *mission)
void CP_BuildBaseMissionIsSuccess (mission_t *mission)
 Build Base mission is over and is a success (from an alien point of view): change interest values.
void CP_BuildBaseMissionIsFailure (mission_t *mission)
 Build Base mission is over and is a failure (from an alien point of view): change interest values.
void CP_BuildBaseMissionOnSpawn (void)
 Run when the mission is spawned.
void CP_BuildBaseMissionBaseDestroyed (mission_t *mission)
 Alien base has been destroyed: change interest values.
static void CP_BuildBaseMissionLeave (mission_t *mission)
 Build Base mission ends: UFO leave earth.
static void CP_BuildBaseSetUpBase (mission_t *mission)
 UFO arrived on new base destination: build base.
static void CP_BuildBaseGoToBase (mission_t *mission)
 Go to new base position.
static void CP_BuildBaseGovernmentLeave (const campaign_t *campaign, mission_t *mission)
 Subverting Mission ends: UFO leave earth.
static void CP_BuildBaseSubvertGovernment (mission_t *mission)
 Start Subverting Mission.
static void CP_BuildBaseChooseMission (mission_t *mission)
 Choose if the mission should be an alien infiltration or a build base mission.
void CP_BuildBaseMissionNextStage (const campaign_t *campaign, mission_t *mission)
 Determine what action should be performed when a Build Base mission stage ends.

Detailed Description

Campaign mission code for alien bases.

Definition in file cp_mission_buildbase.cpp.

Macro Definition Documentation

◆ HAPPINESS_SUBVERSION_LOSS

#define HAPPINESS_SUBVERSION_LOSS   -0.15

Definition at line 39 of file cp_mission_buildbase.cpp.

Referenced by CP_BuildBaseGovernmentLeave().

Function Documentation

◆ CP_BasemissionIsSubvertingGovernmentMission()

bool CP_BasemissionIsSubvertingGovernmentMission ( const mission_t * mission)

This mission type has no alienbase set

Parameters
missionThe mission to check
Returns

Definition at line 46 of file cp_mission_buildbase.cpp.

References ccs, and mission_t::initialOverallInterest.

Referenced by CP_BuildBaseChooseMission(), CP_BuildBaseMissionIsSuccess(), CP_BuildBaseMissionNextStage(), CP_MissionChooseUFO(), and MIS_LoadXML().

◆ CP_BuildBaseChooseMission()

void CP_BuildBaseChooseMission ( mission_t * mission)
static

Choose if the mission should be an alien infiltration or a build base mission.

Note
Build Base mission – Stage 1

Definition at line 230 of file cp_mission_buildbase.cpp.

References CP_BasemissionIsSubvertingGovernmentMission(), CP_BuildBaseGoToBase(), and CP_ReconMissionGroundGo().

Referenced by CP_BuildBaseMissionNextStage().

◆ CP_BuildBaseGoToBase()

void CP_BuildBaseGoToBase ( mission_t * mission)
static

Go to new base position.

Parameters
[in,out]missionPointer to the mission
Note
Build Base mission – Stage 1

Definition at line 166 of file cp_mission_buildbase.cpp.

References AB_SetAlienBasePosition(), mission_t::pos, mission_t::stage, STAGE_MISSION_GOTO, mission_t::ufo, and UFO_SendToDestination().

Referenced by CP_BuildBaseChooseMission().

◆ CP_BuildBaseGovernmentLeave()

void CP_BuildBaseGovernmentLeave ( const campaign_t * campaign,
mission_t * mission )
static

Subverting Mission ends: UFO leave earth.

Note
Build Base mission – Stage 3
Todo
when the mission is created, we should select a position where nation exists, otherwise subverting a government is meaningless

Definition at line 181 of file cp_mission_buildbase.cpp.

References CP_MissionDisableTimeLimit(), GEO_GetNation(), nationInfo_t::happiness, HAPPINESS_SUBVERSION_LOSS, aircraft_t::landed, campaign_t::minhappiness, NAT_GetCurrentMonthInfo(), NAT_SetHappiness(), mission_t::pos, mission_t::stage, STAGE_RETURN_TO_ORBIT, mission_t::ufo, and UFO_SetRandomDest().

Referenced by CP_BuildBaseMissionNextStage().

◆ CP_BuildBaseMissionBaseDestroyed()

void CP_BuildBaseMissionBaseDestroyed ( mission_t * mission)

Alien base has been destroyed: change interest values.

Note
Build Base mission

Definition at line 100 of file cp_mission_buildbase.cpp.

References AB_DestroyBase(), mission_t::missionData_t::alienBase, CP_MissionRemove(), mission_t::data, INT_ChangeIndividualInterest(), INTERESTCATEGORY_BUILDING, and INTERESTCATEGORY_INTERCEPT.

Referenced by CP_MissionIsOver().

◆ CP_BuildBaseMissionIsFailure()

void CP_BuildBaseMissionIsFailure ( mission_t * mission)

Build Base mission is over and is a failure (from an alien point of view): change interest values.

Note
Build Base mission

Definition at line 79 of file cp_mission_buildbase.cpp.

References CP_MissionRemove(), INT_ChangeIndividualInterest(), INTERESTCATEGORY_BASE_ATTACK, and INTERESTCATEGORY_BUILDING.

Referenced by CP_MissionIsOver().

◆ CP_BuildBaseMissionIsSuccess()

void CP_BuildBaseMissionIsSuccess ( mission_t * mission)

◆ CP_BuildBaseMissionLeave()

void CP_BuildBaseMissionLeave ( mission_t * mission)
static

Build Base mission ends: UFO leave earth.

Note
Build Base mission – Stage 3

Definition at line 118 of file cp_mission_buildbase.cpp.

References mission_t::missionData_t::alienBase, CP_MissionDisableTimeLimit(), mission_t::data, aircraft_t::landed, mission_t::stage, STAGE_RETURN_TO_ORBIT, mission_t::ufo, and UFO_SetRandomDest().

Referenced by CP_BuildBaseMissionNextStage().

◆ CP_BuildBaseMissionNextStage()

void CP_BuildBaseMissionNextStage ( const campaign_t * campaign,
mission_t * mission )

◆ CP_BuildBaseMissionOnSpawn()

void CP_BuildBaseMissionOnSpawn ( void )

Run when the mission is spawned.

Definition at line 91 of file cp_mission_buildbase.cpp.

References INT_ChangeIndividualInterest(), and INTERESTCATEGORY_BUILDING.

Referenced by CP_CreateNewMission().

◆ CP_BuildBaseSetUpBase()

void CP_BuildBaseSetUpBase ( mission_t * mission)
static

UFO arrived on new base destination: build base.

Parameters
[in,out]missionPointer to the mission
Note
Build Base mission – Stage 2

< Minimum time needed to start a new base construction

< Maximum time needed to start a new base construction

Definition at line 137 of file cp_mission_buildbase.cpp.

References AB_BuildBase(), mission_t::missionData_t::alienBase, ccs, cgi, CP_MissionRemove(), CP_UFORemoveFromGeoscape(), mission_t::data, Date_Random(), DEBUG_CLIENT, mission_t::finalDate, mission_t::pos, mission_t::stage, STAGE_BUILD_BASE, and mission_t::ufo.

Referenced by CP_BuildBaseMissionNextStage().

◆ CP_BuildBaseSubvertGovernment()

void CP_BuildBaseSubvertGovernment ( mission_t * mission)
static

Start Subverting Mission.

Note
Build Base mission – Stage 2

Definition at line 209 of file cp_mission_buildbase.cpp.

References ccs, CP_MissionAddToGeoscape(), CP_UFORemoveFromGeoscape(), Date_Random(), mission_t::finalDate, mission_t::stage, STAGE_SUBVERT_GOV, and mission_t::ufo.

Referenced by CP_BuildBaseMissionNextStage().