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

Header file for messageoptions related stuff. More...

#include "cp_messages.h"

Go to the source code of this file.

Data Structures

struct  messageSettings_s
 structure holding pause and notify settings for a notify type. More...
 
struct  msgCategoryEntry_s
 
struct  msgCategory_s
 

Macros

#define MSO_PAUSE   (NTMASK_PAUSE | NTMASK_NOTIFY)
 notification type: pause game More...
 
#define MSO_NOTIFY   (NTMASK_NOTIFY)
 notification type: add notification message More...
 
#define MSO_SOUND   (NTMASK_SOUND | NTMASK_NOTIFY)
 notification type: play notification sound More...
 
#define MAX_MESSAGECATEGORIES   16
 

Typedefs

typedef enum nt_s notify_t
 Notify types. More...
 
typedef enum ntmask_s notifyMask_t
 bitmask values for storing msgoptions More...
 
typedef enum msgcategorymask_s msgCategoryMask_t
 bitmask values for storing msgcategory state More...
 
typedef struct messageSettings_s messageSettings_t
 structure holding pause and notify settings for a notify type. More...
 
typedef struct msgCategoryEntry_s msgCategoryEntry_t
 
typedef struct msgCategory_s msgCategory_t
 

Enumerations

enum  nt_s {
  NT_INSTALLATION_INSTALLED, NT_INSTALLATION_REMOVED, NT_INSTALLATION_REPLACE, NT_AIRCRAFT_REFUELED,
  NT_AIRCRAFT_CANNOTREFUEL, NT_AIRCRAFT_ARRIVEDHOME, NT_INSTALLATION_BUILDSTART, NT_INSTALLATION_BUILDFINISH,
  NT_INSTALLATION_DESTROY, NT_RESEARCH_PROPOSED, NT_RESEARCH_HALTED, NT_RESEARCH_COMPLETED,
  NT_PRODUCTION_STARTED, NT_PRODUCTION_FINISHED, NT_PRODUCTION_FAILED, NT_PRODUCTION_QUEUE_EMPTY,
  NT_HAPPINESS_CHANGED, NT_HAPPINESS_MIN, NT_HAPPINESS_PLEASED, NT_TRANSFER_STARTED,
  NT_TRANSFER_COMPLETED_SUCCESS, NT_TRANSFER_LOST, NT_TRANSFER_ALIENBODIES_DEFERED, NT_TRANSFER_UFORECOVERY_FINISHED,
  NT_UFO_SPOTTED, NT_UFO_SIGNAL_LOST, NT_UFO_ATTACKING, NT_BASE_ATTACK,
  NT_BUILDING_FINISHED, NT_NUM_NOTIFYTYPE
}
 Notify types. More...
 
enum  ntmask_s { NTMASK_NOTIFY = 1 << 0, NTMASK_PAUSE = 1 << 1, NTMASK_SOUND = 1 << 2 }
 bitmask values for storing msgoptions More...
 
enum  msgcategorymask_s { MSGCATMASK_FOLDED = 1 << 0 }
 bitmask values for storing msgcategory state More...
 

Functions

uiMessageListNodeMessage_tMSO_CheckAddNewMessage (const notify_t messagecategory, const char *title, const char *text, messageType_t type=MSG_STANDARD, technology_t *pedia=nullptr, bool popup=false)
 Adds a new message to message stack. It uses message settings to verify whether sound should be played and whether game should stop. More...
 
void MSO_ParseMessageSettings (const char *name, const char **text)
 parses message options settings from file. More...
 
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...
 
void MSO_Init (void)
 
void MSO_Shutdown (void)
 

Variables

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

Detailed Description

Header file for messageoptions related stuff.

Definition in file cp_messageoptions.h.

Macro Definition Documentation

#define MAX_MESSAGECATEGORIES   16

Definition at line 92 of file cp_messageoptions.h.

Referenced by MSO_ParseCategory().

#define MSO_NOTIFY   (NTMASK_NOTIFY)

notification type: add notification message

Definition at line 79 of file cp_messageoptions.h.

Referenced by MSO_LoadXML(), MSO_ParseOptionType(), MSO_Set(), and MSO_Toggle_f().

#define MSO_PAUSE   (NTMASK_PAUSE | NTMASK_NOTIFY)

notification type: pause game

Definition at line 77 of file cp_messageoptions.h.

Referenced by MSO_LoadXML(), MSO_ParseOptionType(), and MSO_Toggle_f().

#define MSO_SOUND   (NTMASK_SOUND | NTMASK_NOTIFY)

notification type: play notification sound

Definition at line 81 of file cp_messageoptions.h.

Referenced by MSO_LoadXML(), MSO_ParseOptionType(), and MSO_Toggle_f().

Typedef Documentation

structure holding pause and notify settings for a notify type.

typedef struct msgCategory_s msgCategory_t

bitmask values for storing msgcategory state

typedef enum nt_s notify_t

Notify types.

typedef enum ntmask_s notifyMask_t

bitmask values for storing msgoptions

Enumeration Type Documentation

bitmask values for storing msgcategory state

Enumerator
MSGCATMASK_FOLDED 

Definition at line 72 of file cp_messageoptions.h.

enum nt_s

Notify types.

Enumerator
NT_INSTALLATION_INSTALLED 
NT_INSTALLATION_REMOVED 
NT_INSTALLATION_REPLACE 
NT_AIRCRAFT_REFUELED 
NT_AIRCRAFT_CANNOTREFUEL 
NT_AIRCRAFT_ARRIVEDHOME 
NT_INSTALLATION_BUILDSTART 
NT_INSTALLATION_BUILDFINISH 
NT_INSTALLATION_DESTROY 
NT_RESEARCH_PROPOSED 
NT_RESEARCH_HALTED 
NT_RESEARCH_COMPLETED 
NT_PRODUCTION_STARTED 
NT_PRODUCTION_FINISHED 
NT_PRODUCTION_FAILED 
NT_PRODUCTION_QUEUE_EMPTY 
NT_HAPPINESS_CHANGED 
NT_HAPPINESS_MIN 
NT_HAPPINESS_PLEASED 
NT_TRANSFER_STARTED 
NT_TRANSFER_COMPLETED_SUCCESS 
NT_TRANSFER_LOST 
NT_TRANSFER_ALIENBODIES_DEFERED 
NT_TRANSFER_UFORECOVERY_FINISHED 
NT_UFO_SPOTTED 
NT_UFO_SIGNAL_LOST 
NT_UFO_ATTACKING 
NT_BASE_ATTACK 
NT_BUILDING_FINISHED 
NT_NUM_NOTIFYTYPE 

Definition at line 30 of file cp_messageoptions.h.

enum ntmask_s

bitmask values for storing msgoptions

Enumerator
NTMASK_NOTIFY 
NTMASK_PAUSE 
NTMASK_SOUND 

Definition at line 65 of file cp_messageoptions.h.

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

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

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

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