1 /*!
2  *  Copyright (C) 2011-2016  OpenDungeons Team
3  *
4  *  This program is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation, either version 3 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CLIENTNOTIFICATION_H
19 #define CLIENTNOTIFICATION_H
20 
21 #include "network/ODPacket.h"
22 
23 #include <deque>
24 
25 enum class ClientNotificationType
26 {
27     // Communication with server
28     hello,
29     levelOK, // Tells the server the level loading was ok.
30     setNick,
31     readyForSeatConfiguration,
32     // Messages that should be sent only by the client side of the server
33     // (where the game configuration is done)
34     seatConfigurationSet,
35     seatConfigurationRefresh,
36 
37     chat,
38 
39     // Notification in game
40     askEntityPickUp,
41     askHandDrop,
42     askMarkTiles,
43     askBuildRoom,
44     askSellRoomTiles,
45     askBuildTrap,
46     askSellTrapTiles,
47     ackNewTurn,
48     askCreatureInfos,
49     askPickupWorker,
50     askPickupFighter,
51     askSlapEntity,
52     askCastSpell,
53     askSetSkillTree,
54     askSetPlayerSettings,
55 
56     askSaveMap,
57     askExecuteConsoleCommand,
58 
59     //  Editor
60     editorAskChangeTiles,
61     editorAskBuildRoom,
62     editorAskBuildTrap,
63     editorAskDestroyRoomTiles,
64     editorAskDestroyTrapTiles,
65     editorCreateWorker,
66     editorCreateFighter,
67     editorAskCreateMapLight
68 };
69 
70 ODPacket& operator<<(ODPacket& os, const ClientNotificationType& nt);
71 ODPacket& operator>>(ODPacket& is, ClientNotificationType& nt);
72 
73 /*! \brief A data structure used to pass messages to the clientNotificationProcessor thread.
74  *
75  */
76 class ClientNotification
77 {
78     friend class ODClient;
79 
80 public:
81     ClientNotification(ClientNotificationType type);
~ClientNotification()82     virtual ~ClientNotification()
83     {}
84 
85     ODPacket mPacket;
86 
87     static std::string typeString(ClientNotificationType type);
88 
89 private:
90     ClientNotificationType mType;
91 };
92 
93 #endif // CLIENTNOTIFICATION_H
94