Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / action_target_slot.h
blobfcaa349878c4db0f0a20fd021f353a576b2e85c9
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 NL_ACTION_TARGET_SLOT_H
20 #define NL_ACTION_TARGET_SLOT_H
22 #include "nel/misc/types_nl.h"
23 #include "action.h"
26 namespace CLFECOMMON {
28 /**
29 * Special action for targetting
30 * \author Olivier Cado
31 * \author Nevrax France
32 * \date 2002
34 class CActionTargetSlot : public CAction
36 public:
38 /** This function creates initializes its fields using the buffer.
39 * \param buffer pointer to the buffer where the data are
40 * \size size of the buffer
42 virtual void unpack (NLMISC::CBitMemStream &message) { message.serial( Slot ); message.serial( TargetOrPickup, 2 ); }
44 /// This functions is used when you want to transform an action into an IStream.
45 virtual void serial (NLMISC::IStream &f) { f.serial( Slot ); f.serial( TargetOrPickup ); }
47 /** Returns the size of this action when it will be send to the UDP connection:
48 * the size is IN BITS, not in bytes (the actual size is this one plus the header size)
50 virtual uint32 size () { return sizeof(Slot)*8 + 2; }
52 static CAction *create () { return new CActionTargetSlot(); }
54 /// The slot value
55 TCLEntityId Slot;
57 /// Type of targetting ( LHSTATE::TLHState, only 2 bits are transmitted )
58 uint32 TargetOrPickup;
60 protected:
62 /** This function transform the internal field and transform them into a buffer for the UDP connection.
63 * \param buffer pointer to the buffer where the data will be written
64 * \size size of the buffer
66 virtual void pack (NLMISC::CBitMemStream &message) { message.serial( Slot ); message.serial( TargetOrPickup, 2 ); }
68 friend class CActionFactory;
74 #endif // NL_ACTION_TARGET_SLOT_H
76 /* End of action_target_slot.h */