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

Geoscape event implementation. More...

Include dependency graph for cp_event.cpp:

Go to the source code of this file.

Macros

#define EVENTCONSTANTS_NAMESPACE   "eventTrigger::"

Functions

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_ParseEventMails (const char *name, const char **text)
void CP_CheckCampaignEvents (campaign_t *campaign)
const campaignEvents_tCP_GetEventsByID (const char *name)
static int CP_CheckTriggerEvent (const char *expression, const void *userdata)
void CP_TriggerEvent (campaignTriggerEventType_t type, const void *userdata)
 Triggers a campaign event with a special type.
void CP_ParseEventTrigger (const char *name, const char **text)
bool CP_TriggerEventSaveXML (xmlNode_t *p)
bool CP_TriggerEventLoadXML (xmlNode_t *p)
void CL_ParseCampaignEvents (const char *name, const char **text)
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 CL_EventAddMail_f (void)

Variables

static linkedList_teventMails = nullptr
static const value_t eventMail_vals []
 Valid event mail parameters.
static const value_t event_vals []
 Valid event mail parameters.
static const constListEntry_t eventConstants []

Detailed Description

Geoscape event implementation.

Definition in file cp_event.cpp.

Macro Definition Documentation

◆ EVENTCONSTANTS_NAMESPACE

#define EVENTCONSTANTS_NAMESPACE   "eventTrigger::"

Definition at line 348 of file cp_event.cpp.

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 ( campaign_t * campaign)

Definition at line 113 of file cp_event.cpp.

References ccs, campaign_t::events, events, i, and RS_MarkStoryLineEventResearched().

Referenced by CP_CampaignRun().

◆ CP_CheckTriggerEvent()

◆ 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)

Variable Documentation

◆ event_vals

const value_t event_vals[]
static
Initial value:
= {
{"require", V_HUNK_STRING, offsetof(campaignTriggerEvent_t, require), 0},
{"reactivate", V_HUNK_STRING, offsetof(campaignTriggerEvent_t, reactivate), 0},
{"command", V_HUNK_STRING, offsetof(campaignTriggerEvent_t, command), 0},
{"once", V_BOOL, offsetof(campaignTriggerEvent_t, once), MEMBER_SIZEOF(campaignTriggerEvent_t, once)},
{nullptr, V_NULL, 0, 0}
}
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94
@ V_BOOL
Definition scripts.h:50
@ V_HUNK_STRING
Definition scripts.h:69
@ V_NULL
Definition scripts.h:49
@ V_INT
Definition scripts.h:52
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition scripts.h:34

Valid event mail parameters.

Definition at line 338 of file cp_event.cpp.

Referenced by CP_ParseEventTrigger().

◆ eventConstants

const constListEntry_t eventConstants[]
static
Initial value:
= {
{nullptr, -1}
}
#define EVENTCONSTANTS_NAMESPACE
Definition cp_event.cpp:348
@ UFO_DETECTION
Definition cp_event.h:80
@ ALIENBASE_DISCOVERED
Definition cp_event.h:83
@ CAPTURED_ALIENS
Definition cp_event.h:82
@ NEW_DAY
Definition cp_event.h:79
@ CAPTURED_ALIENS_DIED
Definition cp_event.h:81

Definition at line 349 of file cp_event.cpp.

Referenced by CP_ParseEventTrigger().

◆ eventMail_vals

const value_t eventMail_vals[]
static
Initial value:
= {
{"subject", V_TRANSLATION_STRING, offsetof(eventMail_t, subject), 0},
{"from", V_TRANSLATION_STRING, offsetof(eventMail_t, from), 0},
{"to", V_TRANSLATION_STRING, offsetof(eventMail_t, to), 0},
{"cc", V_TRANSLATION_STRING, offsetof(eventMail_t, cc), 0},
{"date", V_TRANSLATION_STRING, offsetof(eventMail_t, date), 0},
{"body", V_TRANSLATION_STRING, offsetof(eventMail_t, body), 0},
{"icon", V_HUNK_STRING, offsetof(eventMail_t, icon), 0},
{"model", V_HUNK_STRING, offsetof(eventMail_t, model), 0},
{"skipmessage", V_BOOL, offsetof(eventMail_t, skipMessage), MEMBER_SIZEOF(eventMail_t, skipMessage)},
{nullptr, V_NULL, 0, 0}
}
@ V_TRANSLATION_STRING
Definition scripts.h:59
available mails for a tech - mail and mail_pre in script files
Definition cp_event.h:38

Valid event mail parameters.

Definition at line 75 of file cp_event.cpp.

Referenced by CL_ParseEventMails().

◆ eventMails

linkedList_t* eventMails = nullptr
static

Definition at line 36 of file cp_event.cpp.

Referenced by CL_GetEventMail(), and CP_FreeDynamicEventMail().