Add infos into target window
[ryzomcore.git] / ryzom / server / src / monitor_service / client.h
blob8d02002dd33c6c94dbd9558161af6d74ecf83f80
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (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 Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef RY_CMS_CLIENT_H
20 #define RY_CMS_CLIENT_H
22 #include "game_share/ryzom_mirror_properties.h"
23 #include "nel/misc/smart_ptr.h"
25 // A monitor service client
26 class CMonitorClient : public NLMISC::CRefCount
28 protected:
30 // The socket id
31 NLNET::TSockId _Sock;
33 // The listening bounding box
34 NLMISC::CVector _WindowTopLeft, _WindowBottomRight;
36 public:
38 class CEntityEntry
40 public:
41 CEntityEntry ()
43 Flags = 0;
45 enum
47 Present = 1,
48 Pending = 2,
49 PosDirty = 4,
50 MiscPropDirty = 8,
51 DirtyAll = PosDirty | MiscPropDirty
53 uint8 Flags;
56 /// Constructor
57 CMonitorClient(NLNET::TSockId sock);
59 /// Destructor
60 ~CMonitorClient();
62 /// Update
63 void update ();
66 /// Add an entity
67 void add(const TDataSetRow &entity);
69 /// Remove an entity
70 void remove(const TDataSetRow &entity);
72 /// Reset vision
73 void resetVision();
76 void setWindow(float xmin, float ymin, float xmax, float ymax);
78 const NLMISC::CVector &getTopLeft() const
80 return _WindowTopLeft;
83 const NLMISC::CVector &getBottomRight() const
85 return _WindowBottomRight;
88 // returns the TSockID
89 NLNET::TSockId getSock() const {return _Sock;}
91 // Entities
92 std::vector<CEntityEntry> Entites;
94 // In vision
95 std::vector<uint32> InVision;
97 // Start point for entity update
98 uint StartOffset;
100 // Pending entities to be added
101 std::vector<uint32> PendingAdd;
103 // Pending entities to be removed
104 std::vector<uint32> PendingRemove;
106 // The data for the ADD message
107 class CAddData
109 public:
110 uint32 Id;
111 TYPE_NAME_STRING_ID StringId;
112 NLMISC::CEntityId EntityId;
113 NLMISC::CSheetId SheetId;
116 // ADD message queue
117 std::vector<CAddData> Add;
119 // RMV message queue
120 std::vector<uint32> Rmv;
122 // The data for the POS message
123 class CPosData
125 public:
126 uint32 Id;
127 float X, Y, Tetha;
129 // POS message queue
130 std::vector<CPosData> Pos;
132 // The data for the MISC_PROP message
133 class CMiscPropData
135 public:
136 uint32 Id;
137 sint32 CurrentHP;
138 sint32 MaxHP;
139 uint8 Mode;
140 uint8 Behaviour;
143 // MISC_PROP message queue
144 std::vector<CMiscPropData> MiscProp;
147 // STR message queue
148 std::vector<TYPE_NAME_STRING_ID> Str;
150 // Allowed Upload for this client (in bytes per second)
151 uint32 AllowedUploadBandwidth;
153 float AddWeight;
154 float RemoveWeight;
155 float PosWeight;
156 float StrWeight;
157 float MiscPropWeight;
159 bool Authentificated;
160 bool BadLogin; // The client has given a bad login
161 // As long as this flag is set, no login should be accepted
162 // for that client. The flag will be cleared in the main loop
163 // when enough time has ellapsed
167 extern std::vector<NLMISC::CSmartPtr<CMonitorClient> > Clients;
171 #endif // RY_CMS_CLIENT_H