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")
80void 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)
157 const char* messagetype =
cgi->Cmd_Argv(1);
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));
183 const bool activate = atoi(
cgi->Cmd_Argv(2));
185 if (optionsType == 0)
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;
298 token =
cgi->Com_EParse(text, errhead, blockName);
300 cgi->Com_Printf(
"MSO_ParseOption: end of file not expected \"%s\"\n", blockName);
307 token =
cgi->Com_EParse(text, errhead, 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");
370 category = &
ccs.messageCategories[
ccs.numMsgCategories];
373 category->
idx =
ccs.numMsgCategories;
375 categoryEntry = &
ccs.msgCategoryEntries[
ccs.numMsgCategoryEntries];
379 categoryEntry->
category = &
ccs.messageCategories[
ccs.numMsgCategories];
380 category->
last = category->
first = &
ccs.msgCategoryEntries[
ccs.numMsgCategoryEntries];
382 categoryEntry->
next =
nullptr;
384 ccs.numMsgCategoryEntries++;
388 token =
cgi->Com_EParse(text, errhead, blockName);
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);
405 ccs.messageCategories[
ccs.numMsgCategories].last = entry;
406 previous->
next = entry;
410 entry->
next =
nullptr;
413 ccs.numMsgCategoryEntries++;
414 }
else if (
Q_streq(token,
"name")) {
415 token =
cgi->Com_EParse(text, errhead, blockName);
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");
436 ccs.numMsgCategories++;
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);
462 token =
cgi->Com_EParse(text, errhead,
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}
Share stuff between the different cgame implementations.
memPool_t * cp_campaignPool
Header file for single player campaign control.
const cgame_import_t * cgi
static bool MSO_ParseCategory(const char *blockName, const char **text)
Parses a messagecategory script section. These categories are used to group notification types.
static void MSO_SetAll_f(void)
Function callback that sets all message options settings for one option type to given value.
static int MSO_ParseOption(const char *blockName, const char **text)
parses message options settings from file.
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 const cmdList_t msgOptionsCmds[]
messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE]
bool MSO_SaveXML(xmlNode_t *p)
saves current notification and pause settings
static int MSO_ParseOptionType(const char *type)
Parse option type.
bool MSO_LoadXML(xmlNode_t *p)
Restores the notification and pause settings from savegame.
static int MSO_ParseNotifyType(const char *name)
Parse notify type.
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...
void MSO_ParseMessageSettings(const char *name, const char **text)
parses message options settings from file.
static void MSO_Set_f(void)
Function callback used to initialize values for messageoptions and for manual setting changes.
char const *const nt_strings[NT_NUM_NOTIFYTYPE]
valid notification types that may cause pause / notice
Header file for messageoptions related stuff.
#define MAX_MESSAGECATEGORIES
#define MSO_PAUSE
notification type: pause game
#define MSO_NOTIFY
notification type: add notification message
#define MSO_SOUND
notification type: play notification sound
void MSO_InitCallbacks(void)
void MSO_ShutdownCallbacks(void)
void MSO_SetMenuState(const msoMenuState_t newState, const bool callInit, const bool preserveIndex)
Header file for menu related console command callbacks.
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.
void CP_GameTimeStop(void)
Stop game time speed.
Campaign geoscape time header.
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
Shared parsing functions.
QGL_EXTERN GLint GLenum type
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
XML tag constants for savegame.
#define SAVE_MESSAGEOPTIONS_SOUND
#define SAVE_MESSAGEOPTIONS_NAME
#define SAVE_MESSAGEOPTIONS_TYPE
#define SAVE_MESSAGEOPTIONS_PAUSE
#define SAVE_MESSAGEOPTIONS_NOTIFY
#define SAVE_MESSAGEOPTIONS_MESSAGEOPTIONS
#define Q_strcaseeq(a, b)
structure holding pause and notify settings for a notify type.
msgCategoryEntry_t * first
msgCategoryEntry_t * last
struct msgCategoryEntry_s * previous
struct msgCategoryEntry_s * next
struct msgCategory_s * category
messageSettings_t * settings
This is the technology parsed from research.ufo.