GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/ea/inventoryitem.h Lines: 0 21 0.0 %
Date: 2017-11-29 Branches: 0 26 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-2017  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 slot;
52
        int id;
53
        ItemTypeT type;
54
        int cards[maxCards];
55
        ItemOptionsList *options;
56
        int quantity;
57
        uint8_t refine;
58
        ItemColor color;
59
        Identified identified;
60
        Damaged damaged;
61
        Favorite favorite;
62
        Equipm equip;
63
64
        InventoryItem(const int slot0,
65
                      const int id0,
66
                      const ItemTypeT type0,
67
                      const int *const cards0,
68
                      ItemOptionsList *options0,
69
                      const int quantity0,
70
                      const uint8_t refine0,
71
                      const ItemColor color0,
72
                      const Identified identified0,
73
                      const Damaged damaged0,
74
                      const Favorite favorite0,
75
                      Equipm equip0) :
76
            slot(slot0),
77
            id(id0),
78
            type(type0),
79
            cards(),
80
            options(ItemOptionsList::copy(options0)),
81
            quantity(quantity0),
82
            refine(refine0),
83
            color(color0),
84
            identified(identified0),
85
            damaged(damaged0),
86
            favorite(favorite0),
87
            equip(equip0)
88
        {
89
            if (cards0 == nullptr)
90
                return;
91
            for (int f = 0; f < 4; f ++)
92
                cards[f] = cards0[f];
93
        }
94
95
        InventoryItem(const InventoryItem &c) :
96
            slot(c.slot),
97
            id(c.id),
98
            type(c.type),
99
            cards(),
100
            options(ItemOptionsList::copy(c.options)),
101
            quantity(c.quantity),
102
            refine(c.refine),
103
            color(c.color),
104
            identified(c.identified),
105
            damaged(c.damaged),
106
            favorite(c.favorite),
107
            equip(c.equip)
108
        {
109
            for (int f = 0; f < 4; f ++)
110
                cards[f] = c.cards[f];
111
        }
112
113
        A_DEFAULT_COPY(InventoryItem)
114
115
        ~InventoryItem()
116
        {
117
            delete options;
118
        }
119
};
120
121
typedef STD_VECTOR<InventoryItem> InventoryItems;
122
123
}  // namespace Ea
124
125
#endif  // NET_EA_INVENTORYITEM_H