1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "nel/misc/types_nl.h"
26 #include "nel/misc/sheet_id.h"
27 #include "nel/misc/stream.h"
28 #include "persistent_data.h"
29 #include "persistent_data.h"
30 #include "inventories.h"
33 // ***************************************************************************
35 * Description of a Sabrina Phrase. (ie set of brick, and other client side infos)
36 * For communication Client/Server (NB: CSPhrase name already exist...)
37 * \author Lionel Berenguier
38 * \author Nevrax France
44 static const CSPhraseCom EmptyPhrase
;
47 // Start by declaring methods for persistent load/ save operations
48 // The following macro is defined in persistent_data.h
49 // At time of writing it evaluated to:
50 // void store(CPersistentDataRecord &pdr) const;
51 // void apply(CPersistentDataRecord &pdr);
53 DECLARE_PERSISTENCE_METHODS
56 CSPhraseCom(): IconIndex(std::numeric_limits
<uint8
>::max())
59 // clear out the contents before filling with new data...
64 IconIndex
= std::numeric_limits
<uint8
>::max();
67 // List Of SBricks composing the phrase.
68 std::vector
<NLMISC::CSheetId
> Bricks
;
70 // Name Of the Phrase. Saved on server, read on client.
71 ucstring Name
; // FIXME: UTF-8 (serial)
73 // Index into Bricks to use as icon (if out of range, then automatic icon selection)
76 /// The comparison is made only on Bricks
77 bool operator==(const CSPhraseCom
&p
) const;
78 bool operator!=(const CSPhraseCom
&p
) const {return !operator==(p
);}
79 bool operator<(const CSPhraseCom
&p
) const;
81 /// consider empty if Bricks.empty() or if brick 0 is 0.
82 bool empty() const {return Bricks
.empty() || Bricks
[0].asInt()==0;}
84 /// This serial is made for server->client com. NB: SheetId must be init.
85 void serial(NLMISC::IStream
&impulse
);
89 // ***************************************************************************
91 * Tuple Sabrina / Known Slot.
92 * \author Lionel Berenguier
93 * \author Nevrax France
101 NLMISC::CSheetId PhraseSheetId
;
103 /// This serial is made for server->client com.
104 void serial(NLMISC::IStream
&impulse
);
108 // ***************************************************************************
109 class CSPhraseMemorySlot
116 /// This serial is made for server->client com.
117 void serial(NLMISC::IStream
&impulse
);
120 // ***************************************************************************
123 uint8 InvId
; // matchs INVENTORIES::EInventory
125 uint16 IndexInInv
; // index in the inventory
126 uint16 Quantity
; // quantity of mp selected
128 void setInvId(INVENTORIES::TInventory invId
)
132 INVENTORIES::TInventory
getInvId()
134 return INVENTORIES::TInventory(InvId
);
136 /// This serial is made for server->client com.
137 void serial(NLMISC::IStream
&impulse
);
140 #endif // NL_SPHRASE_H
142 /* End of sphrase_com.h */