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
58 // clear out the contents before filling with new data...
65 // List Of SBricks composing the phrase.
66 std::vector
<NLMISC::CSheetId
> Bricks
;
68 // Name Of the Phrase. Saved on server, read on client.
69 ucstring Name
; // FIXME: UTF-8 (serial)
71 /// The comparison is made only on Bricks
72 bool operator==(const CSPhraseCom
&p
) const;
73 bool operator!=(const CSPhraseCom
&p
) const {return !operator==(p
);}
74 bool operator<(const CSPhraseCom
&p
) const;
76 /// consider empty if Bricks.empty() or if brick 0 is 0.
77 bool empty() const {return Bricks
.empty() || Bricks
[0].asInt()==0;}
79 /// This serial is made for server->client com. NB: SheetId must be init.
80 void serial(NLMISC::IStream
&impulse
);
84 // ***************************************************************************
86 * Tuple Sabrina / Known Slot.
87 * \author Lionel Berenguier
88 * \author Nevrax France
96 NLMISC::CSheetId PhraseSheetId
;
98 /// This serial is made for server->client com.
99 void serial(NLMISC::IStream
&impulse
);
103 // ***************************************************************************
104 class CSPhraseMemorySlot
111 /// This serial is made for server->client com.
112 void serial(NLMISC::IStream
&impulse
);
115 // ***************************************************************************
118 uint8 InvId
; // matchs INVENTORIES::EInventory
120 uint16 IndexInInv
; // index in the inventory
121 uint16 Quantity
; // quantity of mp selected
123 void setInvId(INVENTORIES::TInventory invId
)
127 INVENTORIES::TInventory
getInvId()
129 return INVENTORIES::TInventory(InvId
);
131 /// This serial is made for server->client com.
132 void serial(NLMISC::IStream
&impulse
);
135 #endif // NL_SPHRASE_H
137 /* End of sphrase_com.h */