UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_alienbase.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  alienBase_t
 Alien Base. More...

Macros

#define AB_Foreach(var)
#define AB_Exists()

Functions

alienBase_t * AB_GetByIDX (int baseIDX)
 Get Alien Base per Idx.
void AB_SetAlienBasePosition (vec2_t pos)
 Set new base position.
alienBase_t * AB_BuildBase (const vec2_t pos)
 Build a new alien base.
void AB_DestroyBase (alienBase_t *base)
 Destroy an alien base.
void AB_UpdateStealthForAllBase (void)
 Update stealth value of every base for every aircraft.
void AB_BaseSearchedByNations (void)
 Nations help in searching alien base.
bool AB_CheckSupplyMissionPossible (void)
 Check if a supply mission is possible.
alienBase_t * AB_ChooseBaseToSupply (void)
 Choose Alien Base that should be supplied.
void AB_SupplyBase (alienBase_t *base, bool decreaseStealth)
 Supply a base.
int AB_GetAlienBaseNumber (void)
 Check number of alien bases.
void CP_SpawnAlienBaseMission (alienBase_t *alienBase)
 Spawn a new alien base mission after it has been discovered.
void AB_InitStartup (void)
 Init actions for alienbase-subsystem.
void AB_Shutdown (void)
 Closing actions for alienbase-subsystem.

Macro Definition Documentation

◆ AB_Exists

#define AB_Exists ( )
Value:
(!cgi->LIST_IsEmpty(ccs.alienBases))
ccs_t ccs
const cgame_import_t * cgi
linkedList_t * alienBases

Definition at line 39 of file cp_alienbase.h.

Referenced by AB_CheckSupplyMissionPossible(), AB_DestroyBase(), AB_SetAlienBasePosition(), TEST_F(), and TEST_F().

◆ AB_Foreach

#define AB_Foreach ( var)
Value:
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
Definition list.h:41
Alien Base.

Definition at line 36 of file cp_alienbase.h.

Referenced by AB_BaseSearchedByNations(), AB_ChooseBaseToSupply(), AB_GetByIDX(), AB_SaveXML(), AB_SetAlienBasePosition(), and AB_UpdateStealthForAllBase().

Function Documentation

◆ AB_BaseSearchedByNations()

void AB_BaseSearchedByNations ( void )

Nations help in searching alien base.

Note
called once per day, but will update stealth only every daysPerWeek day
See also
CP_CampaignRun

< delay (in days) between base stealth update

< base probability, will be modified below

< xviInfection value of nation that will divide probability to find alien base by 2

Definition at line 238 of file cp_alienbase.cpp.

References AB_BaseSearchedByNations(), AB_Foreach, ccs, CP_SpawnAlienBaseMission(), ccs_t::date, GEO_GetNation(), DateTime::getDateAsDays(), NAT_GetCurrentMonthInfo(), and nationInfo_t::xviInfection.

Referenced by AB_BaseSearchedByNations(), CP_CampaignRun(), and TEST_F().

◆ AB_BuildBase()

alienBase_t * AB_BuildBase ( const vec2_t pos)

Build a new alien base.

Parameters
[in]posPosition of the new base.
Returns
Pointer to the base that has been built.

< How hard PHALANX will find the base

Definition at line 90 of file cp_alienbase.cpp.

References AB_BuildBase(), ccs_t::alienBases, stats_t::alienBasesBuilt, ccs_t::campaignStats, ccs, alienBase_t::idx, LIST_Add(), OBJZERO, alienBase_t::pos, alienBase_t::stealth, and Vector2Copy.

Referenced by AB_BuildBase(), CP_BuildBaseSetUpBase(), TEST_F(), and TEST_F().

◆ AB_CheckSupplyMissionPossible()

bool AB_CheckSupplyMissionPossible ( void )

Check if a supply mission is possible.

Returns
True if there is at least one base to supply.

Definition at line 274 of file cp_alienbase.cpp.

References AB_CheckSupplyMissionPossible(), and AB_Exists.

Referenced by AB_CheckSupplyMissionPossible(), CP_SupplyGoToBase(), CP_SupplyMissionCreate(), and CP_SupplySetStayAtBase().

◆ AB_ChooseBaseToSupply()

alienBase_t * AB_ChooseBaseToSupply ( void )

Choose Alien Base that should be supplied.

Returns
Pointer to the base.

Definition at line 283 of file cp_alienbase.cpp.

References AB_ChooseBaseToSupply(), AB_Foreach, AB_GetAlienBaseNumber(), cgi, and i.

Referenced by AB_ChooseBaseToSupply(), and CP_SupplyGoToBase().

◆ AB_DestroyBase()

void AB_DestroyBase ( alienBase_t * base)

Destroy an alien base.

Parameters
[in]basePointer to the alien base.

Definition at line 107 of file cp_alienbase.cpp.

References AB_DestroyBase(), AB_Exists, ccs_t::alienBases, ccs, cgi, ccs_t::interest, and INTERESTCATEGORY_SUPPLY.

Referenced by AB_DestroyBase(), and CP_BuildBaseMissionBaseDestroyed().

◆ AB_GetAlienBaseNumber()

int AB_GetAlienBaseNumber ( void )

Check number of alien bases.

Returns
number of alien bases.

Definition at line 323 of file cp_alienbase.cpp.

References AB_GetAlienBaseNumber(), ccs_t::alienBases, ccs, and cgi.

Referenced by AB_ChooseBaseToSupply(), AB_GetAlienBaseNumber(), CP_ReconMissionIsSuccess(), CP_SpawnNewMissions(), TEST_F(), and TEST_F().

◆ AB_GetByIDX()

alienBase_t * AB_GetByIDX ( int baseIDX)

Get Alien Base per Idx.

Parameters
[in]baseIDXThe unique IDX of the alien Base.
Returns
Pointer to the base.

Definition at line 123 of file cp_alienbase.cpp.

References AB_Foreach, and AB_GetByIDX().

Referenced by AB_GetByIDX(), and MIS_LoadXML().

◆ AB_InitStartup()

void AB_InitStartup ( void )

Init actions for alienbase-subsystem.

See also
UI_InitStartup

Definition at line 423 of file cp_alienbase.cpp.

References AB_InitStartup(), cgi, and debugAlienBaseCmds.

Referenced by AB_InitStartup(), and CP_InitStartup().

◆ AB_SetAlienBasePosition()

void AB_SetAlienBasePosition ( vec2_t pos)

Set new base position.

Parameters
[out]posPosition of the new base.
Note
This function generates maxLoopPosition random positions, and select among those the one that is the farthest from every other alien bases. This is intended to get a rather uniform distribution of alien bases, while still keeping a random base localisation.

< distance between current selected alien base

< Number of random position among which the final one will be selected

Definition at line 41 of file cp_alienbase.cpp.

References AB_Exists, AB_Foreach, AB_SetAlienBasePosition(), CP_GetRandomPosOnGeoscape(), GEO_PositionCloseToBase(), GetDistanceOnGlobe(), and Vector2Copy.

Referenced by AB_SetAlienBasePosition(), and CP_BuildBaseGoToBase().

◆ AB_Shutdown()

void AB_Shutdown ( void )

Closing actions for alienbase-subsystem.

Definition at line 431 of file cp_alienbase.cpp.

References AB_Shutdown(), ccs_t::alienBases, ccs, cgi, and debugAlienBaseCmds.

Referenced by AB_Shutdown(), and CP_Shutdown().

◆ AB_SupplyBase()

void AB_SupplyBase ( alienBase_t * base,
bool decreaseStealth )

Supply a base.

Parameters
[in]basePointer to the supplied base.
[in]decreaseStealthIf the stealth level of the base should be decreased.

< How much stealth is reduced because Supply UFO was seen

Definition at line 308 of file cp_alienbase.cpp.

References AB_SupplyBase(), alienBase_t::stealth, and alienBase_t::supply.

Referenced by AB_SupplyBase(), and CP_SupplySetStayAtBase().

◆ AB_UpdateStealthForAllBase()

void AB_UpdateStealthForAllBase ( void )

Update stealth value of every base for every aircraft.

Note
Called every DETECTION_INTERVAL
See also
CP_CampaignRun
UFO_UpdateAlienInterestForOneBase

Definition at line 218 of file cp_alienbase.cpp.

References AB_Foreach, AB_UpdateStealthForAllBase(), AB_UpdateStealthForOneBase(), AIR_ForeachFromBase, AIR_IsAircraftOnGeoscape(), and B_GetNext().

Referenced by AB_UpdateStealthForAllBase(), and CP_CampaignFunctionPeriodicCall().

◆ CP_SpawnAlienBaseMission()