UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_event.h File Reference

Header for geoscape event related stuff. More...

Go to the source code of this file.

Data Structures

struct  eventMail_s
 available mails for a tech - mail and mail_pre in script files More...
 
struct  campaignEvent_s
 Defines campaign events when story related technologies should be researched. More...
 
struct  campaignEvents_s
 
struct  campaignTriggerEvent_t
 

Macros

#define MAX_EVENTMAILS   64
 
#define MAX_CAMPAIGNEVENTS   128
 
#define MAX_CAMPAIGN_TRIGGER_EVENTS   32
 

Typedefs

typedef struct eventMail_s eventMail_t
 available mails for a tech - mail and mail_pre in script files More...
 
typedef struct campaignEvent_s campaignEvent_t
 Defines campaign events when story related technologies should be researched. More...
 
typedef struct campaignEvents_s campaignEvents_t
 

Enumerations

enum  campaignTriggerEventType_t {
  NEW_DAY, UFO_DETECTION, CAPTURED_ALIENS_DIED, CAPTURED_ALIENS,
  ALIENBASE_DISCOVERED
}
 events that are triggered by the campaign More...
 

Functions

void CL_EventAddMail_f (void)
 
void CL_ParseEventMails (const char *name, const char **text)
 
eventMail_tCL_GetEventMail (const char *id)
 Searches all event mails for a given id. More...
 
void CP_FreeDynamicEventMail (void)
 Make sure, that the linked list is freed with every new game. More...
 
void CL_EventAddMail (const char *eventMailId)
 Adds the event mail to the message stack. This message is going to be added to the savegame. More...
 
void CP_CheckCampaignEvents (struct campaign_s *campaign)
 
void CL_ParseCampaignEvents (const char *name, const char **text)
 
void CP_ParseEventTrigger (const char *name, const char **text)
 
bool CP_TriggerEventLoadXML (xmlNode_t *p)
 
bool CP_TriggerEventSaveXML (xmlNode_t *p)
 
void CP_TriggerEvent (campaignTriggerEventType_t type, const void *userdata=nullptr)
 Triggers a campaign event with a special type. More...
 
const campaignEvents_tCP_GetEventsByID (const char *name)
 

Detailed Description

Header for geoscape event related stuff.

Definition in file cp_event.h.

Macro Definition Documentation

#define MAX_CAMPAIGN_TRIGGER_EVENTS   32

Definition at line 96 of file cp_event.h.

Referenced by CP_ParseEventTrigger().

#define MAX_CAMPAIGNEVENTS   128

Definition at line 29 of file cp_event.h.

Referenced by CL_ParseCampaignEvents().

#define MAX_EVENTMAILS   64

Definition at line 28 of file cp_event.h.

Referenced by CL_ParseEventMails().

Typedef Documentation

Defines campaign events when story related technologies should be researched.

typedef struct eventMail_s eventMail_t

available mails for a tech - mail and mail_pre in script files

See also
techMail_t
Note
Parsed via CL_ParseEventMails
You can add a mail to the message system and mail client by using e.g. the mission triggers with the script command 'addeventmail <id>'

Enumeration Type Documentation

events that are triggered by the campaign

Enumerator
NEW_DAY 
UFO_DETECTION 
CAPTURED_ALIENS_DIED 
CAPTURED_ALIENS 
ALIENBASE_DISCOVERED 

Definition at line 78 of file cp_event.h.

Function Documentation

void CL_EventAddMail_f ( void  )
eventMail_t* CL_GetEventMail ( const char *  id)

Searches all event mails for a given id.

Note
Might also return nullptr - always check the return value
If you want to create mails that base on a script definition but have different body messages, set createCopy to true
Parameters
[in]idThe id from the script files

Definition at line 44 of file cp_event.cpp.

References ccs, ccs_s::eventMails, i, eventMail_s::id, LIST_Foreach, ccs_s::numEventMails, and Q_streq.

Referenced by CL_EventAddMail(), MS_LoadXML(), and UP_OpenEventMail().

void CL_ParseCampaignEvents ( const char *  name,
const char **  text 
)
void CL_ParseEventMails ( const char *  name,
const char **  text 
)
See also
CL_ParseScriptFirst
Note
write into cp_campaignPool - free on every game restart and reparse

Definition at line 92 of file cp_event.cpp.

References ccs, cgi, cp_campaignPool, DEBUG_CLIENT, ccs_s::eventMails, eventMail_s::id, MAX_EVENTMAILS, ccs_s::numEventMails, OBJZERO, and cgame_import_s::PoolStrDup().

Referenced by CP_ParseScriptFirst().

void CP_FreeDynamicEventMail ( void  )

Make sure, that the linked list is freed with every new game.

See also
CP_ResetCampaignData

Definition at line 66 of file cp_event.cpp.

References cgi.

Referenced by CP_ResetCampaignData().

const campaignEvents_t* CP_GetEventsByID ( const char *  name)

Will return the campaign related events

Note
Also performs some sanity check
Parameters
nameThe events id

Definition at line 138 of file cp_event.cpp.

References campaignEvents_s::campaignEvents, ccs_s::campaignEvents, ccs, events, i, campaignEvents_s::id, ccs_s::numCampaignEventDefinitions, campaignEvents_s::numCampaignEvents, Q_streq, RS_GetTechByID(), and Sys_Error().

Referenced by CP_ParseCampaign().

void CP_ParseEventTrigger ( const char *  name,
const char **  text 
)
void CP_TriggerEvent ( campaignTriggerEventType_t  type,
const void userdata 
)

Triggers a campaign event with a special type.

Parameters
[in]typethe event type
[in]userdataAny userdata that is passed to the bep checker function

Definition at line 311 of file cp_event.cpp.

References ccs_s::campaignTriggerEvents, ccs, cgi, CP_CampaignTriggerFunctions(), CP_CheckTriggerEvent(), i, ccs_s::numCampaignTriggerEvents, and Q_strvalid.

Referenced by AL_AddAliens(), CP_CampaignRun(), CP_SpawnAlienBaseMission(), TEST_F(), and UFO_DetectNewUFO().