1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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 NL_ACTION_SYNC_H
20 #define NL_ACTION_SYNC_H
22 #include "nel/misc/types_nl.h"
23 #include "nel/misc/time_nl.h"
26 //#include "../frontend_service/fe_types.h"
29 namespace CLFECOMMON
{
33 * \author Benjamin Legros
34 * \author Nevrax France
37 class CActionSync
: public CAction
40 /** This function creates initializes its fields using the buffer.
41 * \param buffer pointer to the buffer where the data are
42 * \size size of the buffer
44 virtual void unpack (NLMISC::CBitMemStream
&message
) { message
.serial(Sync
); message
.serial(BKEntityId
); }
46 /// This functions is used when you want to transform an action into an IStream.
47 virtual void serial (NLMISC::IStream
&f
) { f
.serial(Sync
); f
.serial(BKEntityId
); }
49 /** Returns the size of this action when it will be send to the UDP connection:
50 * the size is IN BITS, not in bytes (the actual size is this one plus the header size)
52 virtual uint32
size () { return 8*sizeof(Sync
)+64; }
54 /// Sets the value of the action
55 virtual void setValue(const TValue
&value
) { Sync
= (NLMISC::TGameCycle
)value
; }
57 /// Sets the value of the action
58 virtual TValue
getValue() const { return CAction::TValue((sint64
)Sync
); }
60 /// Returns true if the property is continuous
61 virtual bool isContinuous() const { return false; }
63 static CAction
*create () { return new CActionSync
; }
67 NLMISC::TGameCycle Sync
;
70 NLMISC::CEntityId BKEntityId
;
74 /** This function transform the internal field and transform them into a buffer for the UDP connection.
75 * \param buffer pointer to the buffer where the data will be written
76 * \size size of the buffer
78 virtual void pack (NLMISC::CBitMemStream
&message
) { message
.serial(Sync
); message
.serial(BKEntityId
); }
80 virtual void reset() { Sync
= 0; }
82 friend class CActionFactory
;
87 #endif // NL_ACTION_SYNC_H
89 /* End of action_sync.h */