GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/being/flooritem.h Lines: 0 14 0.0 %
Date: 2017-11-29 Branches: 0 0 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 BEING_FLOORITEM_H
24
#define BEING_FLOORITEM_H
25
26
#include "const/resources/item/cards.h"
27
28
#include "enums/resources/cursor.h"
29
30
#include "enums/resources/item/itemtype.h"
31
32
#include "enums/simpletypes/damaged.h"
33
#include "enums/simpletypes/identified.h"
34
#include "enums/simpletypes/itemcolor.h"
35
36
#include "being/actorsprite.h"
37
38
class ItemInfo;
39
40
/**
41
 * An item lying on the floor.
42
 */
43
class FloorItem final : public ActorSprite
44
{
45
    public:
46
        /**
47
         * Constructor.
48
         *
49
         * @param id     the unique ID of this item instance
50
         * @param itemId the item ID
51
         * @param x      the x position in tiles
52
         * @param y      the y position in tiles
53
         * @param amount the item amount
54
         * @param color  the item color
55
         */
56
        FloorItem(const BeingId id,
57
                  const int itemId,
58
                  const int x, const int y,
59
                  const ItemTypeT itemType,
60
                  const int amount,
61
                  const int refine,
62
                  const ItemColor color,
63
                  const Identified identified,
64
                  const Damaged damaged,
65
                  const int *const cards);
66
67
        A_DELETE_COPY(FloorItem)
68
69
        void postInit(Map *const map, int subX, int subY);
70
71
        ActorTypeT getType() const noexcept2 override final A_WARN_UNUSED
72
        { return ActorType::FloorItem; }
73
74
        void draw(Graphics *const graphics,
75
                  const int offsetX, const int offsetY)
76
                  const override final A_NONNULL(2);
77
78
        /**
79
         * Returns the item ID.
80
         */
81
        int getItemId() const noexcept2 A_WARN_UNUSED
82
        { return mItemId; }
83
84
        /**
85
         * Returns the item info for this floor item. Useful for adding an item
86
         * link for the floor item to chat.
87
         */
88
        const ItemInfo &getInfo() const A_WARN_UNUSED;
89
90
        std::string getName() const A_WARN_UNUSED;
91
92
        int getTileX() const override final A_WARN_UNUSED
93
        { return mX; }
94
95
        int getTileY() const override final A_WARN_UNUSED
96
        { return mY; }
97
98
        void incrementPickup() noexcept2
99
        { mPickupCount ++; }
100
101
        unsigned getPickupCount() const noexcept2 A_WARN_UNUSED
102
        { return mPickupCount; }
103
104
        ItemColor getColor() const noexcept2 A_WARN_UNUSED
105
        { return mColor; }
106
107
        bool getShowMsg() const noexcept2 A_WARN_UNUSED
108
        { return mShowMsg; }
109
110
        void setShowMsg(const bool n) noexcept2
111
        { mShowMsg = n; }
112
113
        void disableHightlight() noexcept2
114
        { mHighlight = false; }
115
116
        CursorT getHoverCursor() const noexcept2 A_WARN_UNUSED
117
        { return mCursor; }
118
119
        void setCards(const int *const cards, int sz);
120
121
        int getCard(const int index) const;
122
123
        int getRefine() const noexcept2 A_WARN_UNUSED
124
        { return mRefine; }
125
126
        ItemTypeT getItemType() const noexcept2 A_WARN_UNUSED
127
        { return mItemType; }
128
129
        Identified getIdentified() const noexcept2 A_WARN_UNUSED
130
        { return mIdentified; }
131
132
        Damaged getDamaged() const noexcept2 A_WARN_UNUSED
133
        { return mDamaged; }
134
135
    private:
136
        int mCards[maxCards];
137
        int mItemId;
138
        int mX, mY;
139
        time_t mDropTime;
140
        int mAmount;
141
        int mRefine;
142
        int mHeightPosDiff;
143
        ItemTypeT mItemType;
144
        unsigned int mPickupCount;
145
        CursorT mCursor;
146
        ItemColor mColor;
147
        Identified mIdentified;
148
        Damaged mDamaged;
149
        bool mShowMsg;
150
        bool mHighlight;
151
};
152
153
#endif  // BEING_FLOORITEM_H