1 /** 2 * @file 3 * @brief Header file for messageoptions related stuff 4 */ 5 6 /* 7 Copyright (C) 2002-2013 UFO: Alien Invasion. 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License 11 as published by the Free Software Foundation; either version 2 12 of the License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 18 See the GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 */ 24 25 #pragma once 26 27 #include "cp_messages.h" 28 29 /** @brief Notify types */ 30 typedef enum nt_s { 31 NT_INSTALLATION_INSTALLED, 32 NT_INSTALLATION_REMOVED, 33 NT_INSTALLATION_REPLACE, 34 NT_AIRCRAFT_REFUELED, 35 NT_AIRCRAFT_CANNOTREFUEL, 36 NT_AIRCRAFT_ARRIVEDHOME, 37 NT_INSTALLATION_BUILDSTART, 38 NT_INSTALLATION_BUILDFINISH, 39 NT_INSTALLATION_DESTROY, 40 NT_RESEARCH_PROPOSED, 41 NT_RESEARCH_HALTED, 42 NT_RESEARCH_COMPLETED, 43 NT_PRODUCTION_STARTED, 44 NT_PRODUCTION_FINISHED, 45 NT_PRODUCTION_FAILED, 46 NT_PRODUCTION_QUEUE_EMPTY, 47 NT_HAPPINESS_CHANGED, 48 NT_HAPPINESS_MIN, 49 NT_HAPPINESS_PLEASED, 50 NT_TRANSFER_STARTED, 51 NT_TRANSFER_COMPLETED_SUCCESS, 52 NT_TRANSFER_LOST, 53 NT_TRANSFER_ALIENBODIES_DEFERED, 54 NT_TRANSFER_UFORECOVERY_FINISHED, 55 NT_UFO_SPOTTED, 56 NT_UFO_SIGNAL_LOST, 57 NT_UFO_ATTACKING, 58 NT_BASE_ATTACK, 59 NT_BUILDING_FINISHED, 60 61 NT_NUM_NOTIFYTYPE 62 } notify_t; 63 64 /** @brief bitmask values for storing msgoptions */ 65 typedef enum ntmask_s { 66 NTMASK_NOTIFY = 1 << 0, 67 NTMASK_PAUSE = 1 << 1, 68 NTMASK_SOUND = 1 << 2 69 } notifyMask_t; 70 71 /** @brief bitmask values for storing msgcategory state */ 72 typedef enum msgcategorymask_s { 73 MSGCATMASK_FOLDED = 1 << 0 74 } msgCategoryMask_t; 75 76 /** @brief notification type: pause game */ 77 #define MSO_PAUSE (NTMASK_PAUSE | NTMASK_NOTIFY) 78 /** @brief notification type: add notification message */ 79 #define MSO_NOTIFY (NTMASK_NOTIFY) 80 /** @brief notification type: play notification sound */ 81 #define MSO_SOUND (NTMASK_SOUND | NTMASK_NOTIFY) 82 83 /** 84 * @brief structure holding pause and notify settings for a notify type. 85 */ 86 typedef struct messageSettings_s { 87 bool doPause; /**< flag whether game should pause */ 88 bool doNotify; /**< flag whether game should notify */ 89 bool doSound; /**< flag whether game should play sound notification */ 90 } messageSettings_t; 91 92 #define MAX_MESSAGECATEGORIES 16 93 typedef struct msgCategoryEntry_s { 94 const char* notifyType; /**< notification type or category name */ 95 struct msgCategory_s* category; /**< associated category */ 96 struct msgCategoryEntry_s* next; /**< pointer to next in category */ 97 struct msgCategoryEntry_s* previous; /**< pointer to previous in category */ 98 messageSettings_t* settings; /**< associated settings */ 99 bool isCategory; /**< flag indicating that this is a category and no notification type */ 100 } msgCategoryEntry_t; 101 102 typedef struct msgCategory_s { 103 int idx; /**< self-link */ 104 const char* name; /**< script file id / translatable category name */ 105 msgCategoryEntry_t* first; 106 msgCategoryEntry_t* last; 107 } msgCategory_t; 108 109 extern messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE]; 110 extern char const* const nt_strings[NT_NUM_NOTIFYTYPE]; 111 112 uiMessageListNodeMessage_t* MSO_CheckAddNewMessage(const notify_t messagecategory, const char* title, const char* text, messageType_t type = MSG_STANDARD, technology_t* pedia = nullptr, bool popup = false); 113 void MSO_ParseMessageSettings(const char* name, const char** text); 114 void MSO_Set(const int listIndex, const notify_t type, const int optionType, const bool activate, const bool sendCommands); 115 void MSO_Init(void); 116 void MSO_Shutdown(void); 117