Deals with the Alien Containment stuff. More...
#include "../client.h"
#include "cp_campaign.h"
#include "cp_aliencont_callbacks.h"
#include "save/save_aliencont.h"
Go to the source code of this file.
Functions | |
static int | AL_GetCargoIndexForTeamDefintion (const aircraft_t *aircraft, const teamDef_t *teamDef) |
Searches an existing index in the alien cargo of an aircraft, or returns the next free index of the alien cargo if the team definition wasn't found in the current alien cargo. | |
qboolean | AL_AddAlienTypeToAircraftCargo (aircraft_t *aircraft, const teamDef_t *teamDef, int amount, qboolean dead) |
Adds an alientype to an aircraft cargo. | |
void | AL_FillInContainment (base_t *base) |
Prepares Alien Containment - names, states, and zeroed amount. | |
const char * | AL_AlienTypeToName (int teamDefIdx) |
Index of alien race to its name. | |
void | AL_CollectingAliens (aircraft_t *aircraft) |
Collecting stunned aliens and alien bodies after the mission. | |
void | AL_AddAliens (aircraft_t *aircraft) |
Puts alien cargo into Alien Containment. | |
void | AL_RemoveAliens (base_t *base, const teamDef_t *alienType, int amount, const alienCalcType_t action) |
Removes alien(s) from Alien Containment. | |
static int | AL_GetAlienIDX (const teamDef_t *alienType) |
Get index of alien. | |
int | AL_GetAlienGlobalIDX (int idx) |
Returns global alien index. | |
int | AL_GetAlienAmount (const teamDef_t *alienType, requirementType_t reqtype, const base_t *base) |
Get amount of live aliens or alien bodies stored in Containment. | |
int | AL_CountInBase (const base_t *base) |
Counts live aliens in base. | |
void | AL_ChangeAliveAlienNumber (base_t *base, aliensCont_t *containment, int num) |
Add / Remove live aliens to Alien Containment. | |
qboolean | AL_CheckAliveFreeSpace (const base_t *base, const aliensCont_t *containment, const int num) |
Check if live aliens can be added/removed to Alien Containment. | |
int | AL_CountAll (void) |
Counts live aliens in all bases. | |
void | AC_KillAll (base_t *base) |
Kill all aliens in given base. | |
void | AC_InitStartup (void) |
Defines commands and cvars for the alien containment menu(s). | |
qboolean | AC_SaveXML (mxml_node_t *parent) |
Savecallback for saving in XML Format. | |
qboolean | AC_LoadXML (mxml_node_t *parent) |
Load callback for savin in XML Format. | |
qboolean | AC_ContainmentAllowed (const base_t *base) |
Returns true if the current base is able to handle captured aliens. |
Deals with the Alien Containment stuff.
Definition in file cp_aliencont.c.
Returns true if the current base is able to handle captured aliens.
Definition at line 791 of file cp_aliencont.c.
References B_ALIEN_CONTAINMENT, B_GetBuildingStatus(), qfalse, and qtrue.
Referenced by AC_SaveXML(), B_BaseInit_f(), B_BuildingOpenAfterClick(), CP_TransferOfAliensToOtherBaseNeeded(), and TR_TransferAliensFromMission_f().
void AC_InitStartup | ( | void | ) |
Defines commands and cvars for the alien containment menu(s).
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.
[in] | base | The base in which you want to kill all aliens |
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().
qboolean AC_LoadXML | ( | mxml_node_t * | parent | ) |
Load callback for savin in XML Format.
Definition at line 744 of file cp_aliencont.c.
References AL_FillInContainment(), base_s::alienscont, aliensCont_s::amountAlive, aliensCont_s::amountDead, B_GetBaseByIDX(), B_GetFoundedBaseByIDX(), ccs_s::breathingMailSent, ccs, Com_GetTeamDefinitionByID(), Com_Printf(), i, MAX_ALIENCONT_CAP, MAX_BASES, mxml_GetBool(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), qfalse, qtrue, SAVE_ALIENCONT_ALIEN, SAVE_ALIENCONT_ALIENCONT, SAVE_ALIENCONT_AMOUNTALIVE, SAVE_ALIENCONT_AMOUNTDEAD, SAVE_ALIENCONT_BASEIDX, SAVE_ALIENCONT_BREATHINGMAILSENT, SAVE_ALIENCONT_CONT, SAVE_ALIENCONT_TEAMID, and aliensCont_s::teamDef.
Referenced by SAV_Init().
qboolean AC_SaveXML | ( | mxml_node_t * | parent | ) |
Savecallback for saving in XML Format.
Definition at line 702 of file cp_aliencont.c.
References AC_ContainmentAllowed(), base_s::alienscont, aliensCont_s::amountAlive, aliensCont_s::amountDead, B_GetFoundedBaseByIDX(), ccs_s::breathingMailSent, ccs, i, teamDef_s::id, MAX_ALIENCONT_CAP, MAX_BASES, mxml_AddBoolValue(), mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddString(), ccs_s::numAliensTD, qtrue, SAVE_ALIENCONT_ALIEN, SAVE_ALIENCONT_ALIENCONT, SAVE_ALIENCONT_AMOUNTALIVE, SAVE_ALIENCONT_AMOUNTDEAD, SAVE_ALIENCONT_BASEIDX, SAVE_ALIENCONT_BREATHINGMAILSENT, SAVE_ALIENCONT_CONT, SAVE_ALIENCONT_TEAMID, and aliensCont_s::teamDef.
Referenced by SAV_Init().
void AL_AddAliens | ( | aircraft_t * | aircraft | ) |
Puts alien cargo into Alien Containment.
[in] | aircraft | Aircraft transporting cargo to homebase. |
Definition at line 171 of file cp_aliencont.c.
References _, AII_CollectItem(), AL_ChangeAliveAlienNumber(), AL_CheckAliveFreeSpace(), AL_GetAircraftAlienCargo, AL_GetAircraftAlienCargoTypes, AL_SetAircraftAlienCargoTypes, base_s::alienscont, aliensCont_s::amountAlive, aliensTmp_s::amountAlive, aliensTmp_s::amountDead, aliensCont_s::amountDead, B_ALIEN_CONTAINMENT, B_GetBuildingStatus(), BREATHINGAPPARATUS_TECH, ccs_s::breathingMailSent, CAP_ALIENS, base_s::capacities, ccs, CHRSH_IsTeamDefRobot(), Cmd_ExecuteString(), Com_DPrintf(), Com_Error(), cap_maxcur_s::cur, DEBUG_CLIENT, ERR_DROP, aircraft_s::homebase, i, INVSH_GetItemByID(), cap_maxcur_s::max, MS_AddNewMessage(), MSG_DEATH, MSG_STANDARD, teamDef_s::name, ccs_s::numAliensTD, technology_s::provides, qfalse, qtrue, RS_GetTechByID(), RS_IsResearched_ptr(), RS_MarkCollected(), Sys_Error(), aliensTmp_s::teamDef, aliensCont_s::teamDef, and aliensCont_s::tech.
Referenced by B_DumpAircraftToHomeBase().
qboolean AL_AddAlienTypeToAircraftCargo | ( | aircraft_t * | aircraft, | |
const teamDef_t * | teamDef, | |||
int | amount, | |||
qboolean | dead | |||
) |
Adds an alientype to an aircraft cargo.
[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 |
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.
[in] | teamDefIdx | Index of alien race in teamDef array. |
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.
[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 |
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 base_t * | base, | |
const aliensCont_t * | containment, | |||
const int | num | |||
) |
Check if live aliens can be added/removed to Alien Containment.
[in] | base | Pointer to the base where Alien Cont. should be checked. |
[in] | containment | Pointer to the containment (may be NULL when adding aliens or if you don't care about alien type of alien you're removing) |
[in] | num | Number of alien to be added/removed |
Definition at line 544 of file cp_aliencont.c.
References aliensCont_s::amountAlive, B_ALIEN_CONTAINMENT, B_GetBuildingStatus(), CAP_ALIENS, base_s::capacities, cap_maxcur_s::cur, cap_maxcur_s::max, qfalse, and qtrue.
Referenced by AL_AddAliens(), AL_ChangeAliveAlienNumber(), CP_TransferOfAliensToOtherBaseNeeded(), and TR_CheckAlien().
void AL_CollectingAliens | ( | aircraft_t * | aircraft | ) |
Collecting stunned aliens and alien bodies after the mission.
[in] | aircraft | Pointer to the aircraft with cargo. |
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
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 base_t * | base | ) |
Counts live aliens in base.
[in] | base | Pointer to the base |
Definition at line 492 of file cp_aliencont.c.
References base_s::alienscont, aliensCont_s::amountAlive, ccs, ccs_s::numAliensTD, and aliensCont_s::teamDef.
Referenced by AL_ChangeAliveAlienNumber(), and B_ResetAllStatusAndCapacities().
void AL_FillInContainment | ( | base_t * | base | ) |
Prepares Alien Containment - names, states, and zeroed amount.
General Collecting aliens functions
[in] | base | Pointer to the base with AC. |
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 base_t * | base | |||
) |
Get amount of live aliens or alien bodies stored in Containment.
[in] | alienType | The alien type to check for |
[in] | base | The base to count in |
[in] | reqtype | Requirement type (RS_LINK_ALIEN/RS_LINK_ALIEN_DEAD). |
Definition at line 463 of file cp_aliencont.c.
References AL_GetAlienIDX(), base_s::alienscont, aliensCont_s::amountAlive, aliensCont_s::amountDead, RS_LINK_ALIEN, and RS_LINK_ALIEN_DEAD.
Referenced by RS_RequirementsMet().
int AL_GetAlienGlobalIDX | ( | int | idx | ) |
Returns global alien index.
[in] | idx | Alien index in Alien Containment. |
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().
static int AL_GetAlienIDX | ( | const teamDef_t * | alienType | ) | [static] |
Get index of alien.
[in] | alienType | Pointer to alien type. |
ccs.numAliensTD
) csi.teamDef
array. That would be alienType->idx
Definition at line 417 of file cp_aliencont.c.
References CHRSH_IsTeamDefAlien(), Com_Printf(), csi, i, teamDef_s::id, csi_s::numTeamDefs, and csi_s::teamDef.
Referenced by AL_GetAlienAmount().
static int AL_GetCargoIndexForTeamDefintion | ( | const aircraft_t * | aircraft, | |
const teamDef_t * | teamDef | |||
) | [inline, static] |
Searches an existing index in the alien cargo of an aircraft, or returns the next free index of the alien cargo if the team definition wasn't found in the current alien cargo.
Collecting aliens functions for aircraft
[in] | aircraft | The aircraft that should have the given team definition in its alien cargo |
[in] | teamDef | The team definition that should be searched for |
Definition at line 44 of file cp_aliencont.c.
References AL_GetAircraftAlienCargo, AL_GetAircraftAlienCargoTypes, i, MAX_CARGO, and aliensTmp_s::teamDef.
Referenced by AL_AddAlienTypeToAircraftCargo().
void AL_RemoveAliens | ( | base_t * | base, | |
const teamDef_t * | alienType, | |||
int | amount, | |||
const alienCalcType_t | action | |||
) |
Removes alien(s) from Alien Containment.
[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). |
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().