UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_messages.cpp File Reference
#include "../../cl_shared.h"
#include "cp_campaign.h"
#include "cp_popup.h"
#include "cp_messages.h"
#include "cp_time.h"
#include "save/save_messages.h"

Go to the source code of this file.

Functions

static void MS_TimestampedText (char *text, uiMessageListNodeMessage_t *message, size_t textsize)
 Returns formatted text of a message timestamp. More...
 
uiMessageListNodeMessage_tMS_AddNewMessage (const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup, bool playSound)
 Adds a new message to message stack. More...
 
static void MS_MessageSaveXML (xmlNode_t *p, uiMessageListNodeMessage_t *message)
 Save a list of messages to xml. More...
 
bool MS_SaveXML (xmlNode_t *p)
 Save callback for messages. More...
 
bool MS_LoadXML (xmlNode_t *p)
 Load callback for messages. More...
 
void MS_MessageInit (void)
 

Variables

char cp_messageBuffer [MAX_MESSAGE_TEXT]
 

Function Documentation

uiMessageListNodeMessage_t* MS_AddNewMessage ( const char *  title,
const char *  text,
messageType_t  type,
technology_t pedia,
bool  popup,
bool  playSound 
)

Adds a new message to message stack.

Note
These are the messages that are displayed at geoscape
Parameters
[in]titleAlready translated message/mail title
[in]textAlready translated message/mail body
[in]popupShow this as a popup, too?
[in]typeThe message type
[in]pediaPointer to technology (only if needed)
[in]playSoundWhether the sound associated with the message type should be played
Returns
message_t pointer
See also
UP_OpenMail_f
CL_EventAddMail_f
Note
this method forwards to MS_AddNewMessageSound with
1 playSound = true

< only save them in debug mode

< don't save these messages

Definition at line 61 of file cp_messages.cpp.

References ccs, cgi, cp_campaignPool, CP_GameTimeStop(), CP_Popup(), uiMessageListNodeMessage_s::date, ccs_s::date, f, uiMessageListNodeMessage_s::iconName, Mem_PoolAllocType, MS_TimestampedText(), MSG_BASEATTACK, MSG_CONSTRUCTION, MSG_CRASHSITE, MSG_DEATH, MSG_DEBUG, MSG_EVENT, MSG_INFO, MSG_MAX, MSG_NEWS, MSG_PRODUCTION, MSG_PROMOTION, MSG_RESEARCH_FINISHED, MSG_RESEARCH_HALTED, MSG_RESEARCH_PROPOSAL, MSG_STANDARD, MSG_TERRORSITE, MSG_TRANSFERFINISHED, MSG_UFOLOST, MSG_UFOSPOTTED, ccs_s::numUnreadMails, uiMessageListNodeMessage_s::pedia, cgame_import_s::PoolStrDup(), Q_strncpyz(), uiMessageListNodeMessage_s::text, uiMessageListNodeMessage_s::timestamp, uiMessageListNodeMessage_s::title, uiMessageListNodeMessage_s::type, and type.

Referenced by AIM_AircraftStart_f(), AIR_CampaignRun(), AIR_NewAircraft(), AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), AIRFIGHT_ActionsAfterAirfight(), AIRFIGHT_ExecuteActions(), AL_AddAliens(), AM_AlienCollect(), AM_DisplayResults(), AM_Go_f(), B_BuildBase_f(), B_Destroy_AntimaterStorage_f(), B_SellOrAddItems(), B_SetBaseTitle_f(), CHAR_UpdateStats(), CL_EventAddMail(), CP_BaseAttackMissionDestroyBase(), CP_MissionAddToGeoscape(), CP_MissionEndActions(), MS_LoadXML(), MSO_CheckAddNewMessage(), NAT_HandleBudget(), SAV_GameQuickLoad_f(), SAV_GameQuickSave_f(), UR_DialogStartSell_f(), and UR_DialogStartStore_f().

void MS_MessageInit ( void  )

Definition at line 329 of file cp_messages.cpp.

References MSO_Init().

Referenced by CP_InitStartup().

bool MS_SaveXML ( xmlNode_t p)

Save callback for messages.

Parameters
[out]pXML Node structure, where we write the information to
See also
MS_MessageSaveXML

Definition at line 236 of file cp_messages.cpp.

References cgi, MS_MessageSaveXML(), SAVE_MESSAGES_MESSAGES, cgame_import_s::UI_MessageGetStack(), cgame_import_s::XML_AddNode(), and xmlNode_t.

Referenced by SAV_Init().

static void MS_TimestampedText ( char *  text,
uiMessageListNodeMessage_t message,
size_t  textsize 
)
static

Returns formatted text of a message timestamp.

Parameters
[in]textBuffer to hold the final result
[in]messageThe message to convert into text
[in]textsizeThe maximum length for text

Definition at line 39 of file cp_messages.cpp.

References _, Com_sprintf(), CP_DateConvertLong(), uiMessageListNodeMessage_s::date, Date_GetMonthName(), dateLong_s::day, dateLong_s::hour, dateLong_s::min, dateLong_s::month, and dateLong_s::year.

Referenced by MS_AddNewMessage(), and MS_LoadXML().

Variable Documentation