ManaPlus
inventoryitem.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef NET_EA_INVENTORYITEM_H
25 #define NET_EA_INVENTORYITEM_H
26 
28 
30 
36 
37 #include "utils/vector.h"
38 
40 
41 #include "localconsts.h"
42 
43 namespace Ea
44 {
45 
50 {
51  public:
54  int slot;
55  int id;
56  int quantity;
64  uint8_t refine;
65 
66  InventoryItem(const int slot0,
67  const int id0,
68  const ItemTypeT type0,
69  const int *const cards0,
70  ItemOptionsList *options0,
71  const int quantity0,
72  const uint8_t refine0,
73  const ItemColor color0,
74  const Identified identified0,
75  const Damaged damaged0,
76  const Favorite favorite0,
77  Equipm equip0,
78  int equipIndex0) :
79  cards(),
80  options(ItemOptionsList::copy(options0)),
81  slot(slot0),
82  id(id0),
83  quantity(quantity0),
84  equipIndex(equipIndex0),
85  type(type0),
86  color(color0),
87  identified(identified0),
88  damaged(damaged0),
89  favorite(favorite0),
90  equip(equip0),
91  refine(refine0)
92  {
93  if (cards0 == nullptr)
94  return;
95  for (int f = 0; f < 4; f ++)
96  cards[f] = cards0[f];
97  }
98 
100  cards(),
101  options(ItemOptionsList::copy(c.options)),
102  slot(c.slot),
103  id(c.id),
104  quantity(c.quantity),
106  type(c.type),
107  color(c.color),
109  damaged(c.damaged),
110  favorite(c.favorite),
111  equip(c.equip),
112  refine(c.refine)
113  {
114  for (int f = 0; f < 4; f ++)
115  cards[f] = c.cards[f];
116  }
117 
119 
121  {
122  delete options;
123  }
124 };
125 
126 typedef STD_VECTOR<InventoryItem> InventoryItems;
127 
128 } // namespace Ea
129 
130 #endif // NET_EA_INVENTORYITEM_H
#define maxCards
Definition: cards.h:25
InventoryItem(const int slot0, const int id0, const ItemTypeT type0, const int *const cards0, ItemOptionsList *options0, const int quantity0, const uint8_t refine0, const ItemColor color0, const Identified identified0, const Damaged damaged0, const Favorite favorite0, Equipm equip0, int equipIndex0)
Definition: inventoryitem.h:66
InventoryItem(const InventoryItem &c)
Definition: inventoryitem.h:99
Identified identified
Definition: inventoryitem.h:60
ItemOptionsList * options
Definition: inventoryitem.h:53
bool Damaged
Definition: damaged.h:30
bool Equipm
Definition: equipm.h:30
bool Favorite
Definition: favorite.h:30
bool Identified
Definition: identified.h:30
uint16_t ItemColor
Definition: itemcolor.h:30
ItemType ::T ItemTypeT
Definition: itemtype.h:43
#define final
Definition: localconsts.h:46
#define A_DEFAULT_COPY(func)
Definition: localconsts.h:41
std::vector< InventoryItem > InventoryItems