GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/ea/inventoryitem.h Lines: 0 22 0.0 %
Date: 2019-10-15 Branches: 0 34 0.0 %

Line Branch Exec Source
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
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#ifndef NET_EA_INVENTORYITEM_H
24
#define NET_EA_INVENTORYITEM_H
25
26
#include "const/resources/item/cards.h"
27
28
#include "enums/resources/item/itemtype.h"
29
30
#include "enums/simpletypes/damaged.h"
31
#include "enums/simpletypes/equipm.h"
32
#include "enums/simpletypes/favorite.h"
33
#include "enums/simpletypes/identified.h"
34
#include "enums/simpletypes/itemcolor.h"
35
36
#include "utils/vector.h"
37
38
#include "resources/item/itemoptionslist.h"
39
40
#include "localconsts.h"
41
42
namespace Ea
43
{
44
45
/**
46
 * Used to cache storage data until we get size data for it.
47
 */
48
class InventoryItem final
49
{
50
    public:
51
        int cards[maxCards];
52
        ItemOptionsList *options;
53
        int slot;
54
        int id;
55
        int quantity;
56
        int equipIndex;
57
        ItemTypeT type;
58
        ItemColor color;
59
        Identified identified;
60
        Damaged damaged;
61
        Favorite favorite;
62
        Equipm equip;
63
        uint8_t refine;
64
65
        InventoryItem(const int slot0,
66
                      const int id0,
67
                      const ItemTypeT type0,
68
                      const int *const cards0,
69
                      ItemOptionsList *options0,
70
                      const int quantity0,
71
                      const uint8_t refine0,
72
                      const ItemColor color0,
73
                      const Identified identified0,
74
                      const Damaged damaged0,
75
                      const Favorite favorite0,
76
                      Equipm equip0,
77
                      int equipIndex0) :
78
            cards(),
79
            options(ItemOptionsList::copy(options0)),
80
            slot(slot0),
81
            id(id0),
82
            quantity(quantity0),
83
            equipIndex(equipIndex0),
84
            type(type0),
85
            color(color0),
86
            identified(identified0),
87
            damaged(damaged0),
88
            favorite(favorite0),
89
            equip(equip0),
90
            refine(refine0)
91
        {
92
            if (cards0 == nullptr)
93
                return;
94
            for (int f = 0; f < 4; f ++)
95
                cards[f] = cards0[f];
96
        }
97
98
        InventoryItem(const InventoryItem &c) :
99
            cards(),
100
            options(ItemOptionsList::copy(c.options)),
101
            slot(c.slot),
102
            id(c.id),
103
            quantity(c.quantity),
104
            equipIndex(c.equipIndex),
105
            type(c.type),
106
            color(c.color),
107
            identified(c.identified),
108
            damaged(c.damaged),
109
            favorite(c.favorite),
110
            equip(c.equip),
111
            refine(c.refine)
112
        {
113
            for (int f = 0; f < 4; f ++)
114
                cards[f] = c.cards[f];
115
        }
116
117
        A_DEFAULT_COPY(InventoryItem)
118
119
        ~InventoryItem()
120
        {
121
            delete options;
122
        }
123
};
124
125
typedef STD_VECTOR<InventoryItem> InventoryItems;
126
127
}  // namespace Ea
128
129
#endif  // NET_EA_INVENTORYITEM_H