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_tAB_GetByIDX (int baseIDX)
 Get Alien Base per Idx.
void AB_SetAlienBasePosition (vec2_t pos)
 Set new base position.
alienBase_tAB_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_tAB_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

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:
LIST_Foreach(ccs.alienBases, alienBase_t, var)
#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_Foreach, ccs, CP_SpawnAlienBaseMission(), GEO_GetNation(), NAT_GetCurrentMonthInfo(), and nationInfo_t::xviInfection.

Referenced by 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 ccs, alienBase_t::idx, LIST_Add(), OBJZERO, alienBase_t::pos, alienBase_t::stealth, and Vector2Copy.

Referenced by 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_Exists.

Referenced by 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_Foreach, AB_GetAlienBaseNumber(), cgi, and i.

Referenced by 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_Exists, ccs, cgi, and INTERESTCATEGORY_SUPPLY.

Referenced by 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 ccs, and cgi.

Referenced by AB_ChooseBaseToSupply(), 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.

Referenced by 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 cgi, and debugAlienBaseCmds.

Referenced by 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, CP_GetRandomPosOnGeoscape(), GEO_PositionCloseToBase(), GetDistanceOnGlobe(), and Vector2Copy.

Referenced by CP_BuildBaseGoToBase().

◆ AB_Shutdown()

void AB_Shutdown ( void )

Closing actions for alienbase-subsystem.

Definition at line 431 of file cp_alienbase.cpp.

References ccs, cgi, and debugAlienBaseCmds.

Referenced by 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 alienBase_t::stealth, and alienBase_t::supply.

Referenced by 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_UpdateStealthForOneBase(), AIR_ForeachFromBase, AIR_IsAircraftOnGeoscape(), and B_GetNext().

Referenced by CP_CampaignFunctionPeriodicCall().

◆ CP_SpawnAlienBaseMission()