UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_event.h File Reference

Header for geoscape event related stuff. More...

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

Go to the source code of this file.

Data Structures

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

Macros

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

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.
void CP_FreeDynamicEventMail (void)
 Make sure, that the linked list is freed with every new game.
void CL_EventAddMail (const char *eventMailId)
 Adds the event mail to the message stack. This message is going to be added to the savegame.
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.
const campaignEvents_tCP_GetEventsByID (const char *name)

Detailed Description

Header for geoscape event related stuff.

Definition in file cp_event.h.

Macro Definition Documentation

◆ MAX_CAMPAIGN_TRIGGER_EVENTS

#define MAX_CAMPAIGN_TRIGGER_EVENTS   32

Definition at line 96 of file cp_event.h.

Referenced by CP_ParseEventTrigger().

◆ MAX_CAMPAIGNEVENTS

#define MAX_CAMPAIGNEVENTS   128

Definition at line 29 of file cp_event.h.

Referenced by CL_ParseCampaignEvents().

◆ MAX_EVENTMAILS

#define MAX_EVENTMAILS   64

Definition at line 28 of file cp_event.h.

Referenced by CL_ParseEventMails().

Enumeration Type Documentation

◆ campaignTriggerEventType_t

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

◆ CL_EventAddMail()

◆ CL_EventAddMail_f()

void CL_EventAddMail_f ( void )

◆ CL_GetEventMail()

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 45 of file cp_event.cpp.

References ccs, eventMails, i, eventMail_t::id, LIST_Foreach, and Q_streq.

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

◆ CL_ParseCampaignEvents()

void CL_ParseCampaignEvents ( 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 448 of file cp_event.cpp.

References ccs, cgi, cp_campaignPool, DEBUG_CLIENT, events, campaignEvent_t::interest, MAX_CAMPAIGNEVENTS, MAX_CAMPAIGNS, name, OBJZERO, Sys_Error(), campaignEvent_t::tech, and V_INT.

Referenced by CP_ParseScriptFirst().

◆ CL_ParseEventMails()

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 93 of file cp_event.cpp.

References ccs, cgi, cp_campaignPool, DEBUG_CLIENT, eventMail_vals, eventMail_t::id, MAX_EVENTMAILS, name, and OBJZERO.

Referenced by CP_ParseScriptFirst().

◆ CP_CheckCampaignEvents()

void CP_CheckCampaignEvents ( struct campaign_s * campaign)

References name, type, and xmlNode_t.

◆ CP_FreeDynamicEventMail()

void CP_FreeDynamicEventMail ( void )

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

See also
CP_ResetCampaignData

Definition at line 67 of file cp_event.cpp.

References cgi, and eventMails.

Referenced by CP_ResetCampaignData().

◆ CP_GetEventsByID()

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 139 of file cp_event.cpp.

References ccs, events, i, name, Q_streq, RS_GetTechByID(), and Sys_Error().

Referenced by CP_ParseCampaign().

◆ CP_ParseEventTrigger()

void CP_ParseEventTrigger ( const char * name,
const char ** text )

◆ CP_TriggerEvent()

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 310 of file cp_event.cpp.

References ccs, cgi, CP_CampaignTriggerFunctions(), CP_CheckTriggerEvent(), i, Q_strvalid, and type.

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

◆ CP_TriggerEventLoadXML()

bool CP_TriggerEventLoadXML ( xmlNode_t * p)

◆ CP_TriggerEventSaveXML()

bool CP_TriggerEventSaveXML ( xmlNode_t * p)