cp_messageoptions.c File Reference

#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_messageoptions.h"
#include "cp_messageoptions_callbacks.h"
#include "cp_time.h"
#include "save/save_messageoptions.h"
Include dependency graph for cp_messageoptions.c:

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 qboolean activate, const qboolean sendCommands)
 Function updates pause or notification settings.
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.
message_tMSO_CheckAddNewMessage (const notify_t messagecategory, const char *title, const char *text, qboolean popup, messageType_t type, void *pedia)
 Adds a new message to message stack. It uses message settings to verify whether sound should be played and whether game should stop.
qboolean MSO_SaveXML (mxml_node_t *p)
 saves current notification and pause settings
qboolean MSO_LoadXML (mxml_node_t *p)
 Restores the notification and pause settings from savegame.
void MSO_ParseSettings (const char *name, const char **text)
 parses message options settings from file.
void MSO_ParseCategories (const char *name, const char **text)
 Parses a messagecategory script section. These categories are used to group notification types.
void MSO_Init (void)
void MSO_Shutdown (void)

Variables

const char * nt_strings [NT_NUM_NOTIFYTYPE]
 valid notification types that may cause pause / notice
messageSettings_t messageSettings [NT_NUM_NOTIFYTYPE]

Detailed Description

Definition in file cp_messageoptions.c.


Function Documentation

CASSERT ( lengthof(nt_strings = =NT_NUM_NOTIFYTYPE  ) 
message_t* MSO_CheckAddNewMessage ( const notify_t  messagecategory,
const char *  title,
const char *  text,
qboolean  popup,
messageType_t  type,
void *  pedia 
)

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

Parameters:
messagecategory category for notification
[in] title Already translated message/mail title
[in] text Already translated message/mail body
[in] popup Show this as a popup, too?
[in] type The message type
[in] pedia Pointer to technology (only if needed)
Returns:
message_t pointer if message was added
See also:
MS_AddNewMessageSound

Definition at line 190 of file cp_messageoptions.c.

References CL_GameTimeStop(), and MS_AddNewMessageSound().

Referenced by AII_UpdateOneInstallationDelay(), AIR_Refuel(), AIRFIGHT_ExecuteActions(), INS_BuildInstallation_f(), INS_DestroyInstallation(), INS_UpdateInstallationData(), NAT_SetHappiness(), PR_DisassemblingFrame(), PR_ProductionFrame(), PR_ProductionIncrease_f(), PR_QueueNext(), RS_MarkCollected(), RS_MarkOneResearchable(), RS_ResearchFinish(), RS_ResearchRun(), TR_EmptyTransferCargo(), TR_TransferAlienAfterMissionStart(), TR_TransferEnd(), TR_TransferStart_f(), UFO_CampaignCheckEvents(), UFO_SearchAircraftTarget(), and UR_ProcessActive().

void MSO_Init ( void   ) 

Definition at line 381 of file cp_messageoptions.c.

References Cmd_AddCommand(), MSO_InitCallbacks(), MSO_Set_f(), and MSO_SetAll_f().

Referenced by MS_MessageInit().

qboolean MSO_LoadXML ( mxml_node_t p  ) 
void MSO_ParseCategories ( const char *  name,
const char **  text 
)
void MSO_ParseSettings ( const char *  name,
const char **  text 
)

parses message options settings from file.

Parameters:
name 
text 

Definition at line 266 of file cp_messageoptions.c.

References Cmd_ExecuteString(), Com_EParse(), Com_Parse(), Com_Printf(), MSO_MSTATE_REINIT, MSO_SetMenuState(), qfalse, and va().

Referenced by CL_ParseScriptFirst().

qboolean MSO_SaveXML ( mxml_node_t p  ) 
void MSO_Set ( const int  listIndex,
const notify_t  type,
const int  optionType,
const qboolean  activate,
const qboolean  sendCommands 
)

Function updates pause or notification settings.

Parameters:
listIndex listIndex in menu to update via confunc
type notification type to update
optionType option type that should be updated
activate flag indicating whether setting should be activated (qtrue) or deactivated
sendCommands flag indicating whether confunc command to update menu button should be sent
See also:
MSO_Toggle_f
MSO_Set_f
Note:
if sendCommands is qfalse, initialization of buttons is reactivated for next menu displaying

Definition at line 79 of file cp_messageoptions.c.

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

Referenced by MSO_LoadXML(), 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 114 of file cp_messageoptions.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), MSO_NOTIFY, MSO_PAUSE, MSO_Set(), MSO_SOUND, NT_NUM_NOTIFYTYPE, nt_strings, qfalse, and type.

Referenced by MSO_Init().

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 151 of file cp_messageoptions.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), MSO_MSTATE_PREPARED, MSO_NOTIFY, MSO_PAUSE, MSO_Set(), MSO_SetMenuState(), MSO_SOUND, NT_NUM_NOTIFYTYPE, qfalse, qtrue, and type.

Referenced by MSO_Init().

void MSO_Shutdown ( void   ) 

Definition at line 388 of file cp_messageoptions.c.

References Cmd_RemoveCommand(), and MSO_ShutdownCallbacks().

Referenced by CP_RemoveCampaignCallbackCommands().


Variable Documentation

messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE]

array holding actual message settings for every notify type

Definition at line 66 of file cp_messageoptions.c.

Referenced by MSO_BackupSettings_f(), and MSO_RestoreSettings_f().

const char* nt_strings[NT_NUM_NOTIFYTYPE]
Initial value:
 {
    N_("installation_installed"),
    N_("installation_removed"),
    N_("installation_replaced"),
    N_("aircraft_refueled"),
    N_("aircraft_cannotrefuel"),
    N_("installation_build_started"),
    N_("installation_build_finished"),
    N_("installation_destroyed"),
    N_("research_new_proposed"),
    N_("research_halted"),
    N_("research_completed"),
    N_("production_started"),
    N_("production_finished"),
    N_("production_failed"),
    N_("production_queue_empty"),
    N_("nation_happiness_changed"),
    N_("nation_unhappy"),
    N_("nation_pleased"),
    N_("transfer_started"),
    N_("transfer_completed_success"),
    N_("transfer_lost"),
    N_("transfer_aliens_defered"),
    N_("transfer_uforecovery_finished"),
    N_("ufo_spotted"),
    N_("ufo_signal_lost"),
    N_("ufo_attacking"),

}

valid notification types that may cause pause / notice

Definition at line 35 of file cp_messageoptions.c.

Referenced by MSO_LoadXML(), MSO_ParseCategories(), MSO_SaveXML(), MSO_Set_f(), and MSO_Toggle_f().


Generated by  doxygen 1.6.2