GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/ea/inventoryitem.h Lines: 0 22 0.0 %
Date: 2021-03-17 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
 *  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
27
#include "const/resources/item/cards.h"
28
29
#include "enums/resources/item/itemtype.h"
30
31
#include "enums/simpletypes/damaged.h"
32
#include "enums/simpletypes/equipm.h"
33
#include "enums/simpletypes/favorite.h"
34
#include "enums/simpletypes/identified.h"
35
#include "enums/simpletypes/itemcolor.h"
36
37
#include "utils/vector.h"
38
39
#include "resources/item/itemoptionslist.h"
40
41
#include "localconsts.h"
42
43
namespace Ea
44
{
45
46
/**
47
 * Used to cache storage data until we get size data for it.
48
 */
49
class InventoryItem final
50
{
51
    public:
52
        int cards[maxCards];
53
        ItemOptionsList *options;
54
        int slot;
55
        int id;
56
        int quantity;
57
        int equipIndex;
58
        ItemTypeT type;
59
        ItemColor color;
60
        Identified identified;
61
        Damaged damaged;
62
        Favorite favorite;
63
        Equipm equip;
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
99
        InventoryItem(const InventoryItem &c) :
100
            cards(),
101
            options(ItemOptionsList::copy(c.options)),
102
            slot(c.slot),
103
            id(c.id),
104
            quantity(c.quantity),
105
            equipIndex(c.equipIndex),
106
            type(c.type),
107
            color(c.color),
108
            identified(c.identified),
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
118
        A_DEFAULT_COPY(InventoryItem)
119
120
        ~InventoryItem()
121
        {
122
            delete options;
123
        }
124
};
125
126
typedef STD_VECTOR<InventoryItem> InventoryItems;
127
128
}  // namespace Ea
129
130
#endif  // NET_EA_INVENTORYITEM_H