Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / property_decoder.h
blobde018a5a04e5d535cbe93c91c27476617f46b7ce
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_PROPERTY_DECODER_H
20 #define NL_PROPERTY_DECODER_H
22 #include <vector>
23 #include <deque>
25 #include "nel/misc/types_nl.h"
26 #include "nel/misc/vector.h"
27 #include "nel/misc/vectord.h"
29 #include "game_share/entity_types.h"
30 #include "game_share/action.h"
32 /**
33 * An engine that allows to encode/decode continuous properties using delta values.
34 * \author Benjamin Legros
35 * \author Nevrax France
36 * \date 2001
38 class CPropertyDecoder
40 private:
42 /// A property entry, containing Garanted, ToGaranty and LastReceived values of action
43 class CPropertyEntry
45 public:
46 CLFECOMMON::CAction::TValue LastReceived;
47 CLFECOMMON::TPacketNumber Packet;
48 void init() { Packet = 0xFFFFFFFF; LastReceived = 0; }
52 /// An entity entry, containing properties for this entity
53 class CEntityEntry
55 public:
56 CEntityEntry() : AssociationBits(0), EntryUsed(false), PosIsRelative(false), PosIsInterior(false) {}
57 CLFECOMMON::TSheetId Sheet;
58 uint16 AssociationBits;
59 bool EntryUsed;
60 bool PosIsRelative;
61 bool PosIsInterior;
62 // CPropertyEntry Properties[CLFECOMMON::LAST_CONTINUOUS_PROPERTY+1];
65 /// The entity entries
66 std::vector<CEntityEntry> _Entities;
69 uint16 _RefBitsX,
70 _RefBitsY,
71 _RefBitsZ;
73 sint32 _RefPosX,
74 _RefPosY;
75 // _RefPosZ;
77 public:
78 /// Constructor
79 CPropertyDecoder();
82 void init(uint maximum) { setMaximumEntities(maximum); clear (); }
83 void setMaximumEntities(uint maximum);
84 void clear();
85 void addEntity(CLFECOMMON::TCLEntityId entity, CLFECOMMON::TSheetId sheet);
86 bool removeEntity(CLFECOMMON::TCLEntityId entity);
87 uint16& associationBits( CLFECOMMON::TCLEntityId entity ) { return _Entities[entity].AssociationBits; }
89 bool isUsed(CLFECOMMON::TCLEntityId entity) const { return _Entities[entity].EntryUsed; }
90 CLFECOMMON::TSheetId sheet(CLFECOMMON::TCLEntityId entity) const { return _Entities[entity].Sheet; }
93 /** Receives actions from the front end. Actually transmits actions received
94 * by the client to the property decoder.
95 * \param packetNumber the number of the packet received
96 * \param ack the number of the acknowledged packet by the front end
97 * \param actions the actions sent to the client by the front end
99 void receive(CLFECOMMON::TPacketNumber packetNumber, CLFECOMMON::TPacketNumber ack, std::vector<CLFECOMMON::CAction *> &actions);
101 /** Receives single action from the front end. Actually transmits action received
102 * by the client to the property decoder.
103 * \param packetNumber the number of the packet received
104 * \param ack the number of the acknowledged packet by the front end
105 * \param action the action sent to the client by the front end
107 void receive(CLFECOMMON::TPacketNumber packetNumber, CLFECOMMON::CAction *action);
109 /// Decode x and y
110 void decodeAbsPos2D( sint32& x, sint32& y, uint16 x16, uint16 y16 )
112 x = _RefPosX + (((sint32)((sint16)(x16 - _RefBitsX))) << 4);
113 y = _RefPosY + (((sint32)((sint16)(y16 - _RefBitsY))) << 4);
116 /// Set player's reference position
117 void setReferencePosition(const NLMISC::CVectorD &position);
120 /// Retrieves a property value.
121 // const CLFECOMMON::CAction::TValue &getProperty(CLFECOMMON::TCLEntityId entity, CLFECOMMON::TProperty property) const;
123 /// Retrieves an entity position.
124 // void getPosition(CLFECOMMON::TCLEntityId entity, CLFECOMMON::CAction::TValue &posx, CLFECOMMON::CAction::TValue &posy, CLFECOMMON::CAction::TValue &posz) const;
128 #endif // NL_PROPERTY_DECODER_H
130 /* End of property_decoder.h */