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

Geoscape event implementation. More...

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. More...
 
void CP_FreeDynamicEventMail (void)
 Make sure, that the linked list is freed with every new game. More...
 
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. More...
 
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. More...
 
void CL_EventAddMail_f (void)
 

Variables

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

Detailed Description

Geoscape event implementation.

Definition in file cp_event.cpp.

Macro Definition Documentation

#define EVENTCONSTANTS_NAMESPACE   "eventTrigger::"

Definition at line 349 of file cp_event.cpp.

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().

Variable Documentation

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},
{nullptr, V_NULL, 0, 0}
}
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
Definition: scripts.h:49
Definition: scripts.h:50
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Valid event mail parameters.

Definition at line 339 of file cp_event.cpp.

const constListEntry_t eventConstants[]
static
Initial value:
= {
{nullptr, -1}
}
#define EVENTCONSTANTS_NAMESPACE
Definition: cp_event.cpp:349

Definition at line 350 of file cp_event.cpp.

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}
}
available mails for a tech - mail and mail_pre in script files
Definition: cp_event.h:38
Definition: scripts.h:49
Definition: scripts.h:50
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34

Valid event mail parameters.

Definition at line 74 of file cp_event.cpp.

linkedList_t* eventMails = nullptr
static

Definition at line 35 of file cp_event.cpp.