cp_event.c File Reference

Geoscape event implementation. More...

#include "../cl_shared.h"
#include "../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_time.h"
Include dependency graph for cp_event.c:

Go to the source code of this file.

Functions

eventMail_tCL_GetEventMail (const char *id, qboolean createCopy)
 Searches all event mails for a given id.
void CL_FreeDynamicEventMail (void)
 Make sure, that the linked list is freed with every new game.
eventMail_tCL_NewEventMail (const char *id, const char *newID, const char *body)
 Use this function to create new eventmails with dynamic body content.
void CL_ParseEventMails (const char *name, const char **text)
void CP_CheckCampaignEvents (void)
const campaignEvents_tCP_GetEventsByID (const char *name)
void CL_ParseCampaignEvents (const char *name, const char **text)
void CL_EventAddMail_f (void)

Variables

static linkedList_teventMails = NULL
static const value_t eventMail_vals []
 Valid event mail parameters.

Detailed Description

Geoscape event implementation.

Definition in file cp_event.c.


Function Documentation

void CL_EventAddMail_f ( void   ) 
void CL_FreeDynamicEventMail ( void   ) 

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

See also:
CL_ResetSinglePlayerData

Definition at line 95 of file cp_event.c.

References LIST_Delete().

Referenced by CL_ResetSinglePlayerData().

eventMail_t* CL_GetEventMail ( const char *  id,
qboolean  createCopy 
)

Searches all event mails for a given id.

Note:
Might also return NULL - always check the return value
If you want to create mails that base on a script defintion but have differnet body messages, set createCopy to true
Parameters:
[in] id The id from the script files
[in] createCopy Don't return the link to ccs.eventMails but allocate memory and copy the gd.eventMail memory over to the newly allocated. Don't use createCopy on dynamic mails
See also:
UP_SetMailHeader
CL_NewEventMail

Definition at line 45 of file cp_event.c.

References ccs, cp_campaignPool, linkedList_s::data, ccs_s::eventMails, i, eventMail_s::id, LIST_AddPointer(), Mem_PoolAlloc, linkedList_s::next, and ccs_s::numEventMails.

Referenced by CL_EventAddMail_f(), CL_NewEventMail(), MS_LoadXML(), and UP_OpenEventMail().

eventMail_t* CL_NewEventMail ( const char *  id,
const char *  newID,
const char *  body 
)

Use this function to create new eventmails with dynamic body content.

See also:
CL_GetEventMail
Note:
The pointers in the original eventmail are not freed - we still need this memory later!!
See also:
CL_ResetSinglePlayerData
UR_SendMail
Parameters:
[in] id eventmail id of the source mail parsed from events.ufo
[in] newID the new id for the dynamic mail (needed to seperate the new mail from the source mail to let CL_GetEventMail be able to find it afterwards)
[in] body The body of the new mail - this may also be NULL if you need the original body of the source mail that was parsed from events.ufo

Definition at line 114 of file cp_event.c.

References eventMail_s::body, CL_GetEventMail(), cp_campaignPool, eventMail_s::id, Mem_PoolStrDup, and qtrue.

void CL_ParseCampaignEvents ( const char *  name,
const char **  text 
)
void CL_ParseEventMails ( const char *  name,
const char **  text 
)
void CP_CheckCampaignEvents ( void   ) 
const campaignEvents_t* CP_GetEventsByID ( const char *  name  ) 

Will return the campaign related events

Note:
Also performs some sanity check
Parameters:
name The events id

Definition at line 245 of file cp_event.c.

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

Referenced by CL_ParseCampaign().


Variable Documentation

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_CLIENT_HUNK_STRING, offsetof(eventMail_t, icon), 0},
    {"model", V_CLIENT_HUNK_STRING, offsetof(eventMail_t, model), 0},

    {NULL, 0, 0, 0}
}

Valid event mail parameters.

Definition at line 136 of file cp_event.c.

linkedList_t* eventMails = NULL [static]

Definition at line 31 of file cp_event.c.


Generated by  doxygen 1.6.2