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/>.
18 #ifndef NL_ACTION_ASSOCIATION_H
19 #define NL_ACTION_ASSOCIATION_H
21 #include "nel/misc/types_nl.h"
23 #include "ryzom_entity_id.h"
24 #include "entity_types.h"
28 namespace CLFECOMMON
{
32 * \author Benjamin Legros
33 * \author Nevrax France
36 class CActionAssociation
: 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
)
46 message
.serial(IsNewAssociation
);
49 message
.serial(SheetId
);
50 message
.serial(Replace
);
54 /// This functions is used when you want to transform an action into an IStream.
55 virtual void serial (NLMISC::IStream
&f
) { f
.serial(IsNewAssociation
, SheetId
, Replace
); }
57 /** Returns the size of this action when it will be send to the UDP connection:
58 * the size is IN BITS, not in bytes (the actual size is this one plus the header size)
60 virtual uint32
size () { return IsNewAssociation
? 8*sizeof(CLFECOMMON::TSheetId
)+2 : 1; }
62 /// Sets the value of the action
63 virtual TValue
getValue() const { return (CAction::TValue
)SheetId
; }
65 static CAction
*create () { return new CActionAssociation(); }
70 CActionAssociation() {}
72 /** This function transform the internal field and transform them into a buffer for the UDP connection.
73 * \param buffer pointer to the buffer where the data will be written
74 * \size size of the buffer
76 virtual void pack (NLMISC::CBitMemStream
&message
)
78 message
.serial(IsNewAssociation
);
81 message
.serial(SheetId
);
82 message
.serial(Replace
);
86 friend class CActionFactory
;
90 /// The sheet id of the associated entity
91 bool IsNewAssociation
;
93 CLFECOMMON::TSheetId SheetId
;
98 #endif // NL_ACTION_ASSOCIATION_H
100 /* End of action_association.h */