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

In-game message settings. More...

Go to the source code of this file.

Functions

 CASSERT (lengthof(nt_strings)==NT_NUM_NOTIFYTYPE)
 
void MSO_Set (const int listIndex, const notify_t type, const int optionType, const bool activate, const bool sendCommands)
 Function updates pause or notification settings. More...
 
static int MSO_ParseNotifyType (const char *name)
 Parse notify type. More...
 
static int MSO_ParseOptionType (const char *type)
 Parse option type. More...
 
static void MSO_Set_f (void)
 Function callback used to initialize values for messageoptions and for manual setting changes. More...
 
static void MSO_SetAll_f (void)
 Function callback that sets all message options settings for one option type to given value. More...
 
uiMessageListNodeMessage_tMSO_CheckAddNewMessage (const notify_t messagecategory, const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup)
 Adds a new message to message stack. It uses message settings to verify whether sound should be played and whether game should stop. More...
 
bool MSO_SaveXML (xmlNode_t *p)
 saves current notification and pause settings More...
 
bool MSO_LoadXML (xmlNode_t *p)
 Restores the notification and pause settings from savegame. More...
 
static int MSO_ParseOption (const char *blockName, const char **text)
 parses message options settings from file. More...
 
static bool MSO_ParseCategory (const char *blockName, const char **text)
 Parses a messagecategory script section. These categories are used to group notification types. More...
 
void MSO_ParseMessageSettings (const char *name, const char **text)
 parses message options settings from file. More...
 
void MSO_Init (void)
 
void MSO_Shutdown (void)
 

Variables

char const *const nt_strings [NT_NUM_NOTIFYTYPE]
 valid notification types that may cause pause / notice More...
 
messageSettings_t messageSettings [NT_NUM_NOTIFYTYPE]
 
static const cmdList_t msgOptionsCmds []
 

Detailed Description

In-game message settings.

Definition in file cp_messageoptions.cpp.

Function Documentation

uiMessageListNodeMessage_t* MSO_CheckAddNewMessage ( const notify_t  messagecategory,
const char *  title,
const char *  text,
messageType_t  type,
technology_t pedia,
bool  popup 
)

Adds a new message to message stack. It uses message settings to verify whether sound should be played and whether game should stop.

Parameters
messagecategorycategory for notification
[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)
Returns
message_t pointer if message was added
See also
MS_AddNewMessageSound

Definition at line 208 of file cp_messageoptions.cpp.

References CP_GameTimeStop(), messageSettings_s::doNotify, messageSettings_s::doPause, messageSettings_s::doSound, and MS_AddNewMessage().

Referenced by AII_UpdateOneInstallationDelay(), AIR_Move(), AIR_Refuel(), AIRFIGHT_ExecuteActions(), B_UpdateBuildingConstructions(), CP_BaseAttackStartMission(), INS_BuildInstallation_f(), INS_DestroyInstallation(), INS_UpdateInstallationData(), NAT_SetHappiness(), PR_CheckFrame(), PR_FinishDisassembly(), PR_FinishProduction(), PR_ProductionIncrease_f(), PR_QueueNext(), RS_CheckRequirements(), RS_MarkCollected(), RS_MarkOneResearchable(), RS_ResearchFinish(), RS_ResearchRun(), TR_EmptyTransferCargo(), TR_TransferEnd(), TR_TransferStart_f(), UFO_CampaignCheckEvents(), UFO_SearchAircraftTarget(), UR_ProcessActive(), and US_TransferUFO().

void MSO_Init ( void  )

Definition at line 484 of file cp_messageoptions.cpp.

References cgi, and MSO_InitCallbacks().

Referenced by MS_MessageInit().

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

parses message options settings from file.

Definition at line 444 of file cp_messageoptions.cpp.

References cgi, cgame_import_s::Com_EParse(), Com_Parse(), ERR_DROP, MSO_ParseCategory(), OBJZERO, and Q_streq.

Referenced by CP_ParseScriptFirst().

static int MSO_ParseNotifyType ( const char *  name)
static

Parse notify type.

Returns
A NT_ number, else return -1

Definition at line 115 of file cp_messageoptions.cpp.

References NT_NUM_NOTIFYTYPE, nt_strings, and Q_streq.

Referenced by MSO_ParseOption().

static int MSO_ParseOption ( const char *  blockName,
const char **  text 
)
static
static int MSO_ParseOptionType ( const char *  type)
static

Parse option type.

Returns
A MSO value, else 0

Definition at line 129 of file cp_messageoptions.cpp.

References cgi, MSO_NOTIFY, MSO_PAUSE, MSO_SOUND, and Q_strcaseeq.

Referenced by MSO_ParseOption(), MSO_Set_f(), and MSO_SetAll_f().

void MSO_Set ( const int  listIndex,
const notify_t  type,
const int  optionType,
const bool  activate,
const bool  sendCommands 
)

Function updates pause or notification settings.

Parameters
listIndexlistIndex in menu to update via confunc
typenotification type to update
optionTypeoption type that should be updated
activateflag indicating whether setting should be activated (true) or deactivated
sendCommandsflag indicating whether confunc command to update menu button should be sent
See also
MSO_Toggle_f
MSO_Set_f
Note
if sendCommands is false, initialization of buttons is reactivated for next menu displaying

Definition at line 80 of file cp_messageoptions.cpp.

References cgi, messageSettings_s::doNotify, messageSettings_s::doPause, messageSettings_s::doSound, MSO_MSTATE_PREPARED, MSO_NOTIFY, MSO_SetMenuState(), NTMASK_PAUSE, NTMASK_SOUND, and type.

Referenced by MSO_LoadXML(), MSO_ParseOption(), MSO_Set_f(), MSO_SetAll_f(), and MSO_Toggle_f().

static void MSO_Set_f ( void  )
static

Function callback used to initialize values for messageoptions and for manual setting changes.

See also
MSO_Set

Definition at line 146 of file cp_messageoptions.cpp.

References cgi, cgame_import_s::Cmd_Argv(), MSO_ParseOptionType(), MSO_Set(), NT_NUM_NOTIFYTYPE, nt_strings, Q_streq, and type.

static void MSO_SetAll_f ( void  )
static

Function callback that sets all message options settings for one option type to given value.

See also
MSO_Set
MSO_Init_f

Definition at line 176 of file cp_messageoptions.cpp.

References cgi, cgame_import_s::Cmd_Argv(), MSO_MSTATE_PREPARED, MSO_ParseOptionType(), MSO_Set(), MSO_SetMenuState(), NT_NUM_NOTIFYTYPE, and type.

void MSO_Shutdown ( void  )

Definition at line 490 of file cp_messageoptions.cpp.

References cgi, and MSO_ShutdownCallbacks().

Referenced by CP_RemoveCampaignCallbackCommands().

Variable Documentation

array holding actual message settings for every notify type

Definition at line 67 of file cp_messageoptions.cpp.

Referenced by MSO_BackupSettings_f(), and MSO_RestoreSettings_f().

const cmdList_t msgOptionsCmds[]
static
Initial value:
= {
{"msgoptions_setall", MSO_SetAll_f, "Sets pause, notification or sound setting for all message categories"},
{"msgoptions_set", MSO_Set_f, "Sets pause, notification or sound setting for a message category"},
{nullptr, nullptr, nullptr}
}
static void MSO_Set_f(void)
Function callback used to initialize values for messageoptions and for manual setting changes...
static void MSO_SetAll_f(void)
Function callback that sets all message options settings for one option type to given value...

Definition at line 479 of file cp_messageoptions.cpp.

char const* const nt_strings[NT_NUM_NOTIFYTYPE]

valid notification types that may cause pause / notice

Definition at line 34 of file cp_messageoptions.cpp.

Referenced by MSO_LoadXML(), MSO_ParseCategory(), MSO_ParseNotifyType(), MSO_SaveXML(), MSO_Set_f(), and MSO_Toggle_f().