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/>.
23 #include "nel/misc/vectord.h"
25 #include "game_item_manager/game_item.h"
26 #include "game_share/constants.h"
45 // Specialized part of trading struct for item
48 NL_INSTANCE_COUNTER_DECL(SItemTrade
);
52 SItemTrade() { ItemPtr
= 0; Quality
= 0; Level
= 0; }
58 void copy( SItemTrade
* i
)
70 ///////////////////////////////////////////////////////
71 // User interface : Common interface for trading struct
72 ///////////////////////////////////////////////////////
78 NLMISC::CSheetId Sheet
;
81 CTradeBase() { Type
= unknown
; Specialized
= 0; Price
= 0; }
83 CTradeBase( TTradeType type
)
86 if ( Type
== item
|| Type
== plan
)
88 Specialized
= new SItemTrade();
97 if( (Specialized
&& Type
== item
|| Type
== plan
) && Specialized
!= 0 )
99 delete ( (SItemTrade
*) Specialized
);
104 CTradeBase( const CTradeBase
& t
)
109 if ( (Type
== item
|| Type
== plan
) && t
.Specialized
!= 0)
111 Specialized
= new SItemTrade();
112 ( (SItemTrade
*) Specialized
)->copy( (SItemTrade
*) t
.Specialized
);
119 const CTradeBase
&operator = (const CTradeBase
&a
)
124 if ( ( Type
== item
|| Type
== plan
) && a
.Specialized
!= 0 )
127 delete (SItemTrade
*) Specialized
;
129 Specialized
= new SItemTrade();
130 ( (SItemTrade
*) Specialized
)->copy( (SItemTrade
*) a
.Specialized
);
135 // Common part of CTrade for serial management
136 struct CTradeUnserial
140 NLMISC::CSheetId Sheet
;
143 void init( CTradeUnserial
& s
)
148 if ( Type
== item
|| Type
== plan
)
150 Specialized
= new SItemTrade();
155 typedef std::vector
< RYZOM_TRADE::CTradeBase
* > TTradeList
;