cp_aliencont.h File Reference

Header file for Alien Containment stuff. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  aliensCont_s

Defines

#define MAX_ALIENCONT_CAP   32
#define BREATHINGAPPARATUS_TECH   "rs_alien_breathing"
#define AL_GetAircraftAlienCargo(a)   (a)->alienCargo
#define AL_GetAircraftAlienCargoTypes(a)   ((a)->alienCargoTypes)
#define AL_SetAircraftAlienCargoTypes(a, i)   (a)->alienCargoTypes = (i)

Typedefs

typedef struct aliensCont_s aliensCont_t

Enumerations

enum  alienCalcType_t {
  AL_RESEARCH, AL_KILL, AL_KILLONE, AL_ADDALIVE,
  AL_ADDDEAD
}

Functions

void AL_FillInContainment (struct base_s *base)
 Prepares Alien Containment - names, states, and zeroed amount.
const char * AL_AlienTypeToName (int teamDescIdx)
 Index of alien race to its name.
void AL_CollectingAliens (struct aircraft_s *aircraft)
 Collecting stunned aliens and alien bodies after the mission.
void AL_AddAliens (struct aircraft_s *aircraft)
 Puts alien cargo into Alien Containment.
void AL_RemoveAliens (struct base_s *base, const teamDef_t *alienType, int amount, const alienCalcType_t action)
 Removes alien(s) from Alien Containment.
int AL_GetAlienGlobalIDX (int idx)
 Returns global alien index.
int AL_GetAlienAmount (const teamDef_t *alienType, requirementType_t reqtype, const struct base_s *base)
void AL_ChangeAliveAlienNumber (struct base_s *base, aliensCont_t *containment, int num)
 Add / Remove live aliens to Alien Containment.
qboolean AL_CheckAliveFreeSpace (const struct base_s *base, const aliensCont_t *containment, const int num)
int AL_CountInBase (const struct base_s *base)
qboolean AL_AddAlienTypeToAircraftCargo (struct aircraft_s *aircraft, const teamDef_t *teamDef, int amount, qboolean dead)
 Adds an alientype to an aircraft cargo.
int AL_CountAll (void)
 Counts live aliens in all bases.
void AC_InitStartup (void)
 Defines commands and cvars for the alien containment menu(s).
void AC_KillAll (struct base_s *base)
 Kill all aliens in given base.

Detailed Description

Header file for Alien Containment stuff.

Definition in file cp_aliencont.h.


Define Documentation

#define AL_GetAircraftAlienCargo (  )     (a)->alienCargo
#define AL_GetAircraftAlienCargoTypes (  )     ((a)->alienCargoTypes)
#define AL_SetAircraftAlienCargoTypes ( a,
i   )     (a)->alienCargoTypes = (i)
#define BREATHINGAPPARATUS_TECH   "rs_alien_breathing"
Todo:
remove harcoded tech

Definition at line 32 of file cp_aliencont.h.

Referenced by AL_AddAliens(), and TR_TransferAlienAfterMissionStart().

#define MAX_ALIENCONT_CAP   32

Definition at line 29 of file cp_aliencont.h.

Referenced by AC_LoadXML(), AC_SaveXML(), AL_CountForMenu(), and AL_FillInContainment().


Typedef Documentation

typedef struct aliensCont_s aliensCont_t

structure of Alien Containment being a member of base_t


Enumeration Type Documentation

cases of alien amount calculation

Enumerator:
AL_RESEARCH 

When we remove alien(s) because of research topic.

AL_KILL 

When we kill all aliens in base because of base defence mission.

AL_KILLONE 

When we kill one alien of given type in AC menu.

AL_ADDALIVE 

When we add one alien by hand.

AL_ADDDEAD 

When we kill one alien by hand.

Definition at line 35 of file cp_aliencont.h.


Function Documentation

void AC_InitStartup ( void   ) 

Defines commands and cvars for the alien containment menu(s).

See also:
UI_InitStartup

Definition at line 687 of file cp_aliencont.c.

References AC_InitCallbacks(), and Cmd_AddCommand().

Referenced by CP_InitStartup().

void AC_KillAll ( base_t base  ) 

Kill all aliens in given base.

Parameters:
[in] base The base in which you want to kill all aliens
See also:
AC_KillAll_f

Definition at line 601 of file cp_aliencont.c.

References AL_KILL, AL_RemoveAliens(), base_s::alienscont, aliensCont_s::amountAlive, ccs, i, ccs_s::numAliensTD, qfalse, and qtrue.

Referenced by AC_KillAll_f(), and B_UpdateOneBaseBuildingStatusOnDisable().

void AL_AddAliens ( aircraft_t aircraft  ) 
qboolean AL_AddAlienTypeToAircraftCargo ( aircraft_t aircraft,
const teamDef_t teamDef,
int  amount,
qboolean  dead 
)

Adds an alientype to an aircraft cargo.

Parameters:
[in] aircraft The aircraft that owns the alien cargo to add the alien race to
[in] teamDef The team definition of the alien race to add to the alien cargo container of the given aircraft
[in] amount The amount of aliens of the given race (teamDef ) that should be added to the alien cargo
[in] dead true for cases where the aliens should be added as dead to the alien cargo - false for living aliens
Todo:
Return false for cases where the alien race could not be added to the alien cargo of the aircraft
Returns:
Currently always true

Definition at line 72 of file cp_aliencont.c.

References AL_GetAircraftAlienCargo, AL_GetAircraftAlienCargoTypes, AL_GetCargoIndexForTeamDefintion(), AL_SetAircraftAlienCargoTypes, aliensTmp_s::amountAlive, aliensTmp_s::amountDead, qtrue, and aliensTmp_s::teamDef.

Referenced by AL_CollectingAliens(), and CL_AutoMissionAlienCollect().

const char* AL_AlienTypeToName ( int  teamDefIdx  ) 

Index of alien race to its name.

Parameters:
[in] teamDefIdx Index of alien race in teamDef array.
Returns:
name (untranslated) or NULL if no definition found.

Definition at line 133 of file cp_aliencont.c.

References Com_Printf(), csi, teamDef_s::name, csi_s::numTeamDefs, and csi_s::teamDef.

Referenced by TR_CargoList(), and TR_TransferSelect().

void AL_ChangeAliveAlienNumber ( base_t base,
aliensCont_t containment,
int  num 
)

Add / Remove live aliens to Alien Containment.

Parameters:
[in] base Pointer to the base where Alien Cont. should be checked.
[in] containment Pointer to the containment
[in] num Number of alien to be added/removed
Precondition:
free space has already been checked
Todo:
handle containment[j].amountDead++; in case the num is negative?

Definition at line 515 of file cp_aliencont.c.

References AL_CheckAliveFreeSpace(), AL_CountInBase(), aliensCont_s::amountAlive, B_ALIEN_CONTAINMENT, B_GetBuildingStatus(), CAP_ALIENS, base_s::capacities, Com_Error(), Com_Printf(), cap_maxcur_s::cur, ERR_DROP, and cap_maxcur_s::max.

Referenced by AL_AddAliens(), AL_RemoveAliens(), TR_CargoListSelect_f(), TR_EmptyTransferCargo(), TR_TransferListClear_f(), and TR_TransferListSelect_f().

qboolean AL_CheckAliveFreeSpace ( const struct base_s base,
const aliensCont_t containment,
const int  num 
)
void AL_CollectingAliens ( aircraft_t aircraft  ) 

Collecting stunned aliens and alien bodies after the mission.

Parameters:
[in] aircraft Pointer to the aircraft with cargo.
See also:
CL_ParseResults
CL_GameAutoGo

Definition at line 148 of file cp_aliencont.c.

References AL_AddAlienTypeToAircraftCargo(), LE_GetNextInUse(), LE_IsActor(), LE_IsAlien, LE_IsDead, LE_IsStunned, qfalse, qtrue, and le_s::teamDef.

Referenced by GAME_CP_Results().

int AL_CountAll ( void   ) 

Counts live aliens in all bases.

Menu functions

Menu functions

Note:
This should be called whenever you add or remove
aliens from alien containment.
Returns:
amount of all live aliens stored in containments
See also:
B_AircraftReturnedToHomeBase
AC_Init_f

Definition at line 577 of file cp_aliencont.c.

References base_s::alienscont, aliensCont_s::amountAlive, B_ALIEN_CONTAINMENT, B_GetBuildingStatus(), B_GetFoundedBaseByIDX(), ccs, i, MAX_BASES, ccs_s::numAliensTD, and aliensCont_s::teamDef.

Referenced by RS_RequirementsMet().

int AL_CountInBase ( const struct base_s base  ) 
void AL_FillInContainment ( base_t base  ) 

Prepares Alien Containment - names, states, and zeroed amount.

Collecting aliens functions.

General Collecting aliens functions

Parameters:
[in] base Pointer to the base with AC.
See also:
B_BuildBase
AL_AddAliens

Definition at line 100 of file cp_aliencont.c.

References base_s::alienscont, aliensCont_s::amountAlive, aliensCont_s::amountDead, CAP_ALIENS, base_s::capacities, ccs, CHRSH_IsTeamDefAlien(), Com_DPrintf(), Com_Error(), csi, cap_maxcur_s::cur, DEBUG_CLIENT, ERR_DROP, i, technology_s::idx, teamDef_s::idx, MAX_ALIENCONT_CAP, teamDef_s::name, csi_s::numTeamDefs, td, aliensCont_s::teamDef, csi_s::teamDef, ccs_s::teamDefTechs, and aliensCont_s::tech.

Referenced by AC_LoadXML(), and B_BuildBase_f().

int AL_GetAlienAmount ( const teamDef_t alienType,
requirementType_t  reqtype,
const struct base_s base 
)
int AL_GetAlienGlobalIDX ( int  idx  ) 

Returns global alien index.

Parameters:
[in] idx Alien index in Alien Containment.
Returns:
Global alien index in csi.teamDef array.
See also:
AL_GetAlienIDX

Definition at line 439 of file cp_aliencont.c.

References CHRSH_IsTeamDefAlien(), Com_Printf(), csi, i, csi_s::numTeamDefs, and csi_s::teamDef.

Referenced by TR_CargoList(), and TR_TransferSelect().

void AL_RemoveAliens ( base_t base,
const teamDef_t alienType,
int  amount,
const alienCalcType_t  action 
)

Removes alien(s) from Alien Containment.

Parameters:
[in,out] base Pointer to the base where we will perform action (remove, add, ... aliens).
[in] alienType Type of the alien (a teamDef_t pointer)
[in] amount Amount of aliens to be removed.
[in] action Type of action (see alienCalcType_t).
See also:
AC_KillAll_f
AC_KillOne_f
Note:
Call with NULL name when no matters what type to remove.
Todo:
integrate this with research system

Definition at line 296 of file cp_aliencont.c.

References AL_ChangeAliveAlienNumber(), AL_KILL, AL_KILLONE, AL_RESEARCH, base_s::alienscont, aliensCont_s::amountAlive, aliensCont_s::amountDead, ccs, Com_Printf(), ccs_s::numAliensTD, and Sys_Error().

Referenced by AC_KillAll(), AC_KillOne_f(), and B_BuildingOnDestroy_f().


Generated by  doxygen 1.6.2