Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / far_position.h
blobf6b46fab33e90b8540f5592d0c09a3f82ab6a75d
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/>.
17 #include "nel/misc/types_nl.h"
18 #include "game_share/r2_basic_types.h"
19 //#include "game_share/r2_types.h"
20 #include "persistent_data.h"
23 #ifndef NL_FAR_POSITION_H
24 #define NL_FAR_POSITION_H
27 class CEntityState;
29 /** Define the online state of a character */
30 enum TCharConnectionState
32 /// the character is offline
33 ccs_offline =0,
34 /// the character is online on the same shard
35 ccs_online =1,
36 /// the character is online, but on another shard in the domain.
37 ccs_online_abroad =2
40 /**
41 * COfflineEntityState
42 * \author Stephane Coutelas
43 * \author Nevrax France
44 * \date 2002
46 class COfflineEntityState
48 public:
49 // Start by declaring methods for persistent load/ save operations
50 // The following macro is defined in persistent_data.h
51 // At time of writing it evaluated to:
52 // void store(CPersistentDataRecord &pdr) const;
53 // void apply(CPersistentDataRecord &pdr);
55 DECLARE_PERSISTENCE_METHODS
57 sint32 X;
58 sint32 Y;
59 sint32 Z;
61 float Heading;
63 /**
64 * Constructor
66 COfflineEntityState()
68 clear();
71 void clear()
73 X = 0;
74 Y = 0;
75 Z = 0;
76 Heading = 0;
79 COfflineEntityState(const CEntityState& state);
81 // Comparison
82 bool operator== (const COfflineEntityState &other ) const;
84 // Assignment
85 COfflineEntityState& operator= (const COfflineEntityState &src)
87 X = src.X;
88 Y = src.Y;
89 Z = src.Z;
90 Heading = src.Heading;
91 return *this;
94 /**
95 * Serial
97 void serial(NLMISC::IStream &f)
99 f.serial(X);
100 f.serial(Y);
101 f.serial(Z);
102 f.serial(Heading);
105 // Return as string
106 std::string toString() const;
111 * Session identifier.
112 * On a mainland shard, there is a main fixed TSessionId for the whole EGS.
113 * On a ring shard (adventures, outlands), the DSS manages several sessions.
114 * Each character is in a session.
116 //typedef uint32 TSessionId;
118 // Special value to force saving the position stack without updating it from the outside anymore
119 const TSessionId SessionLockPositionStack(~0u);
123 * Session Id + Entity State (X,Y,Z,Theta)
124 * \author Olivier Cado
125 * \author Nevrax France
126 * \date 2006
128 class CFarPosition
130 public:
132 DECLARE_PERSISTENCE_METHODS
134 TSessionId SessionId;
135 COfflineEntityState PosState;
137 CFarPosition();
139 // Comparison
140 bool operator== (const CFarPosition &other) const;
142 // Assignment
143 CFarPosition& operator= (const CFarPosition &src)
145 SessionId = src.SessionId;
146 PosState = src.PosState;
147 return *this;
151 * Serial
153 void serial(NLMISC::IStream &f)
155 f.serial(SessionId);
156 f.serial(PosState);
163 #endif // NL_FAR_POSITION_H
165 /* End of far_position.h */