25 #include "../../cl_shared.h"
26 #include "../../../shared/parse.h"
35 N_(
"installation_installed"),
36 N_(
"installation_removed"),
37 N_(
"installation_replaced"),
38 N_(
"aircraft_refueled"),
39 N_(
"aircraft_cannotrefuel"),
40 N_(
"aircraft_arrivedhome"),
41 N_(
"installation_build_started"),
42 N_(
"installation_build_finished"),
43 N_(
"installation_destroyed"),
44 N_(
"research_new_proposed"),
45 N_(
"research_halted"),
46 N_(
"research_completed"),
47 N_(
"production_started"),
48 N_(
"production_finished"),
49 N_(
"production_failed"),
50 N_(
"production_queue_empty"),
51 N_(
"nation_happiness_changed"),
54 N_(
"transfer_started"),
55 N_(
"transfer_completed_success"),
57 N_(
"transfer_aliens_defered"),
58 N_(
"transfer_uforecovery_finished"),
60 N_(
"ufo_signal_lost"),
63 N_(
"building_finished")
80 void MSO_Set (
const int listIndex,
const notify_t type,
const int optionType,
const bool activate,
const bool sendCommands)
138 cgi->Com_Printf(
"Unrecognized optionstype during set '%s' ignored\n", type);
148 if (
cgi->Cmd_Argc() != 4) {
149 cgi->Com_Printf(
"Usage: %s <messagetypename> <pause|notify|sound> <0|1>\n",
cgi->
Cmd_Argv(0));
154 if (optionsType == 0)
163 if (type == NT_NUM_NOTIFYTYPE) {
164 cgi->Com_Printf(
"Unrecognized messagetype during set '%s' ignored\n", messagetype);
178 if (
cgi->Cmd_Argc() != 3) {
179 cgi->Com_Printf(
"Usage: %s <pause|notify|sound> <0|1>\n",
cgi->
Cmd_Argv(0));
185 if (optionsType == 0)
264 if (type == NT_NUM_NOTIFYTYPE) {
265 cgi->Com_Printf(
"Unrecognized messagetype '%s' ignored while loading\n", messagetype);
282 const char* errhead =
"MSO_ParseSettings: unexpected end of file (names ";
288 if (!*text || *token !=
'{') {
289 cgi->Com_Printf(
"MSO_ParseOption: settingslist \"%s\" without body ignored\n", blockName);
293 int messageType = -1;
300 cgi->Com_Printf(
"MSO_ParseOption: end of file not expected \"%s\"\n", blockName);
309 }
else if (
Q_streq(token,
"status")) {
310 if (status !=
nullptr) {
311 cgi->Com_Printf(
"MSO_ParseOption: status already defined. Previous definition ignored.\n");
312 cgi->LIST_Delete(&status);
313 }
else if (!
cgi->Com_ParseList(text, &status)) {
314 cgi->Com_Printf(
"MSO_ParseOption: error while parsing option status.\n");
318 cgi->Com_Printf(
"MSO_ParseOption: token \"%s\" in \"%s\" not expected.\n", token, blockName);
323 if (messageType == -1) {
324 cgi->Com_Printf(
"MSO_ParseOption: message option type undefined.\n");
328 for (
linkedList_t* element = status; element !=
nullptr; element = element->
next) {
329 const char* value = (
const char*)element->
data;
331 if (optionType == 0) {
332 cgi->Com_Printf(
"MSO_ParseOption: message option type \"%s\" undefined.\n", value);
350 const char* errhead =
"MSO_ParseCategory: unexpected end of file (names ";
358 if (!*text || *token !=
'{') {
359 cgi->Com_Printf(
"MSO_ParseCategory: category without body\n");
365 cgi->Com_Printf(
"MSO_ParseCategory: too many messagecategory defs\n");
382 categoryEntry->
next =
nullptr;
390 cgi->Com_Printf(
"MSO_ParseMessageSettings: end of file not expected\n");
396 if (
Q_streq(token,
"option")) {
398 if (optionId == -1) {
399 cgi->Com_Error(
ERR_DROP,
"MSO_ParseMessageSettings: error while parsing option from \"%s\".\n", blockName);
406 previous->
next = entry;
410 entry->
next =
nullptr;
412 entry->
settings = &messageSettings[optionId];
414 }
else if (
Q_streq(token,
"name")) {
417 cgi->Com_Printf(
"MSO_ParseMessageSettings: end of file not expected\n");
421 if (token[0] ==
'_') {
427 cgi->Com_Error(
ERR_DROP,
"MSO_ParseMessageSettings: token \"%s\" in \"%s\" not expected.\n", token, blockName);
431 if (category->
name ==
nullptr) {
432 cgi->Com_Printf(
"MSO_ParseMessageSettings: category do not have name\n");
446 const char* errhead =
"MSO_ParseMessageSettings: unexpected end of file (names ";
455 if (!*text || token[0] !=
'{') {
456 cgi->Com_Error(
ERR_DROP,
"MSO_ParseMessageSettings: msgoptions \"%s\" without body.\n", name);
464 cgi->Com_Error(
ERR_DROP,
"MSO_ParseMessageSettings: end of file not expected \"%s\".\n", name);
468 if (
Q_streq(token,
"category")) {
470 cgi->Com_Error(
ERR_DROP,
"MSO_ParseMessageSettings: error while parsing category from \"%s\".\n", name);
473 cgi->Com_Error(
ERR_DROP,
"MSO_ParseMessageSettings: token \"%s\" in \"%s\" not expected.\n", token, name);
480 {
"msgoptions_setall",
MSO_SetAll_f,
"Sets pause, notification or sound setting for all message categories"},
481 {
"msgoptions_set",
MSO_Set_f,
"Sets pause, notification or sound setting for a message category"},
482 {
nullptr,
nullptr,
nullptr}
486 cgi->Cmd_TableAddList(msgOptionsCmds);
492 cgi->Cmd_TableRemoveList(msgOptionsCmds);
structure holding pause and notify settings for a notify type.
#define SAVE_MESSAGEOPTIONS_NOTIFY
msgCategory_t messageCategories[MAX_MESSAGECATEGORIES]
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 playe...
#define SAVE_MESSAGEOPTIONS_NAME
QGL_EXTERN GLint GLenum type
#define MAX_MESSAGECATEGORIES
#define MSO_SOUND
notification type: play notification sound
char const *const nt_strings[NT_NUM_NOTIFYTYPE]
valid notification types that may cause pause / notice
msgCategoryEntry_t * first
static void MSO_Set_f(void)
Function callback used to initialize values for messageoptions and for manual setting changes...
void MSO_InitCallbacks(void)
void MSO_SetMenuState(const msoMenuState_t newState, const bool callInit, const bool preserveIndex)
Header file for messageoptions related stuff.
struct msgCategoryEntry_s * previous
#define MSO_PAUSE
notification type: pause game
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.
memPool_t * cp_campaignPool
void CP_GameTimeStop(void)
Stop game time speed.
static void MSO_SetAll_f(void)
Function callback that sets all message options settings for one option type to given value...
messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE]
#define SAVE_MESSAGEOPTIONS_PAUSE
#define SAVE_MESSAGEOPTIONS_TYPE
static int MSO_ParseOptionType(const char *type)
Parse option type.
const cgame_import_t * cgi
static int MSO_ParseNotifyType(const char *name)
Parse notify type.
static bool MSO_ParseCategory(const char *blockName, const char **text)
Parses a messagecategory script section. These categories are used to group notification types...
msgCategoryEntry_t * last
bool MSO_SaveXML(xmlNode_t *p)
saves current notification and pause settings
This is the technology parsed from research.ufo.
#define Q_strcaseeq(a, b)
Campaign geoscape time header.
msgCategoryEntry_t msgCategoryEntries[NT_NUM_NOTIFYTYPE+MAX_MESSAGECATEGORIES]
struct msgCategoryEntry_s * next
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
#define SAVE_MESSAGEOPTIONS_MESSAGEOPTIONS
#define SAVE_MESSAGEOPTIONS_SOUND
XML tag constants for savegame.
int numMsgCategoryEntries
void MSO_ParseMessageSettings(const char *name, const char **text)
parses message options settings from file.
CASSERT(lengthof(nt_strings)==NT_NUM_NOTIFYTYPE)
static const cmdList_t msgOptionsCmds[]
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
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.
bool MSO_LoadXML(xmlNode_t *p)
Restores the notification and pause settings from savegame.
Header file for single player campaign control.
enum nt_s notify_t
Notify types.
static int MSO_ParseOption(const char *blockName, const char **text)
parses message options settings from file.
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
const char *IMPORT * Com_EParse(const char **text, const char *errhead, const char *errinfo)
struct msgCategory_s * category
char *IMPORT * PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
messageSettings_t * settings
void MSO_ShutdownCallbacks(void)
#define MSO_NOTIFY
notification type: add notification message
Header file for menu related console command callbacks.
const char *IMPORT * Cmd_Argv(int n)
const char *IMPORT * XML_GetString(xmlNode_t *parent, const char *name)
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)