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

In-game message settings. More...

Include dependency graph for cp_messageoptions.cpp:

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.
static int MSO_ParseNotifyType (const char *name)
 Parse notify type.
static int MSO_ParseOptionType (const char *type)
 Parse option type.
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.
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.
bool MSO_SaveXML (xmlNode_t *p)
 saves current notification and pause settings
bool MSO_LoadXML (xmlNode_t *p)
 Restores the notification and pause settings from savegame.
static int MSO_ParseOption (const char *blockName, const char **text)
 parses message options settings from file.
static bool MSO_ParseCategory (const char *blockName, const char **text)
 Parses a messagecategory script section. These categories are used to group notification types.
void MSO_ParseMessageSettings (const char *name, const char **text)
 parses message options settings from file.
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
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

◆ CASSERT()

◆ MSO_CheckAddNewMessage()

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_t::doNotify, messageSettings_t::doPause, messageSettings_t::doSound, messageSettings, MS_AddNewMessage(), and type.

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

◆ MSO_Init()

void MSO_Init ( void )

Definition at line 484 of file cp_messageoptions.cpp.

References cgi, msgOptionsCmds, and MSO_InitCallbacks().

Referenced by MS_MessageInit().

◆ MSO_LoadXML()

bool MSO_LoadXML ( xmlNode_t * p)

Restores the notification and pause settings from savegame.

See also
MSO_SaveXML
Todo
(menu) check why this message is not shown anywhere in logs

Definition at line 246 of file cp_messageoptions.cpp.

References cgi, MSO_MSTATE_REINIT, MSO_NOTIFY, MSO_PAUSE, MSO_Set(), MSO_SetMenuState(), MSO_SOUND, NT_NUM_NOTIFYTYPE, nt_strings, Q_streq, SAVE_MESSAGEOPTIONS_MESSAGEOPTIONS, SAVE_MESSAGEOPTIONS_NAME, SAVE_MESSAGEOPTIONS_NOTIFY, SAVE_MESSAGEOPTIONS_PAUSE, SAVE_MESSAGEOPTIONS_SOUND, SAVE_MESSAGEOPTIONS_TYPE, type, and xmlNode_t.

Referenced by SAV_Init().

◆ MSO_ParseCategory()

bool MSO_ParseCategory ( const char * blockName,
const char ** text )
static

◆ MSO_ParseMessageSettings()

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, Com_Parse(), ERR_DROP, messageSettings, MSO_ParseCategory(), name, OBJZERO, and Q_streq.

Referenced by CP_ParseScriptFirst().

◆ MSO_ParseNotifyType()

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 name, NT_NUM_NOTIFYTYPE, nt_strings, and Q_streq.

Referenced by MSO_ParseOption().

◆ MSO_ParseOption()

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

parses message options settings from file.

Definition at line 280 of file cp_messageoptions.cpp.

References cgi, Com_Parse(), MSO_MSTATE_REINIT, MSO_ParseNotifyType(), MSO_ParseOptionType(), MSO_Set(), MSO_SetMenuState(), linkedList_t::next, and Q_streq.

Referenced by MSO_ParseCategory().

◆ MSO_ParseOptionType()

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, Q_strcaseeq, and type.

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

◆ MSO_SaveXML()

◆ MSO_Set()

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_t::doNotify, messageSettings_t::doPause, messageSettings_t::doSound, messageSettings, 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().

◆ MSO_Set_f()

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, MSO_ParseOptionType(), MSO_Set(), NT_NUM_NOTIFYTYPE, nt_strings, Q_streq, and type.

◆ MSO_SetAll_f()

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, MSO_MSTATE_PREPARED, MSO_ParseOptionType(), MSO_Set(), MSO_SetMenuState(), NT_NUM_NOTIFYTYPE, and type.

◆ MSO_Shutdown()

void MSO_Shutdown ( void )

Definition at line 490 of file cp_messageoptions.cpp.

References cgi, msgOptionsCmds, and MSO_ShutdownCallbacks().

Referenced by CP_RemoveCampaignCallbackCommands().

Variable Documentation

◆ messageSettings

array holding actual message settings for every notify type

Definition at line 67 of file cp_messageoptions.cpp.

Referenced by MSO_BackupSettings_f(), MSO_CheckAddNewMessage(), MSO_ParseCategory(), MSO_ParseMessageSettings(), MSO_RestoreSettings_f(), MSO_SaveXML(), and MSO_Set().

◆ msgOptionsCmds

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_SetAll_f(void)
Function callback that sets all message options settings for one option type to given value.
static void MSO_Set_f(void)
Function callback used to initialize values for messageoptions and for manual setting changes.

Definition at line 479 of file cp_messageoptions.cpp.

Referenced by MSO_Init(), and MSO_Shutdown().

◆ nt_strings

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 CASSERT(), MSO_LoadXML(), MSO_ParseCategory(), MSO_ParseNotifyType(), MSO_SaveXML(), MSO_Set_f(), and MSO_Toggle_f().