ManaPlus
flooritem.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 BEING_FLOORITEM_H
25 #define BEING_FLOORITEM_H
26 
28 
29 #include "enums/resources/cursor.h"
30 
32 
36 
37 #include "being/actorsprite.h"
38 
39 class ItemInfo;
40 
44 class FloorItem final : public ActorSprite
45 {
46  public:
57  FloorItem(const BeingId id,
58  const int itemId,
59  const int x, const int y,
60  const ItemTypeT itemType,
61  const int amount,
62  const int refine,
63  const ItemColor color,
64  const Identified identified,
65  const Damaged damaged,
66  const int *const cards);
67 
69 
70  void postInit(Map *const map, int subX, int subY);
71 
73  { return ActorType::FloorItem; }
74 
75  void draw(Graphics *const graphics,
76  const int offsetX, const int offsetY)
77  const override final A_NONNULL(2);
78 
83  { return mItemId; }
84 
89  const ItemInfo &getInfo() const A_WARN_UNUSED;
90 
91  std::string getName() const A_WARN_UNUSED;
92 
94  { return mX; }
95 
97  { return mY; }
98 
100  { mPickupCount ++; }
101 
103  { return mPickupCount; }
104 
106  { return mColor; }
107 
109  { return mShowMsg; }
110 
111  void setShowMsg(const bool n) noexcept2
112  { mShowMsg = n; }
113 
115  { mHighlight = false; }
116 
118  { return mCursor; }
119 
120  void setCards(const int *const cards, int sz);
121 
122  int getCard(const int index) const;
123 
125  { return mRefine; }
126 
128  { return mItemType; }
129 
131  { return mIdentified; }
132 
134  { return mDamaged; }
135 
136  private:
138  int mItemId;
139  int mX, mY;
140  time_t mDropTime;
141  int mAmount;
142  int mRefine;
145  unsigned int mPickupCount;
150  bool mShowMsg;
152 };
153 
154 #endif // BEING_FLOORITEM_H
ActorType ::T ActorTypeT
Definition: actortype.h:43
int BeingId
Definition: beingid.h:30
#define maxCards
Definition: cards.h:25
int getRefine() const
Definition: flooritem.h:124
int mCards[4]
Definition: flooritem.h:137
void draw(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: flooritem.cpp:159
int mAmount
Definition: flooritem.h:141
CursorT getHoverCursor() const
Definition: flooritem.h:117
int mHeightPosDiff
Definition: flooritem.h:143
bool getShowMsg() const
Definition: flooritem.h:108
void disableHightlight()
Definition: flooritem.h:114
Damaged getDamaged() const
Definition: flooritem.h:133
int mRefine
Definition: flooritem.h:142
ItemTypeT mItemType
Definition: flooritem.h:144
unsigned getPickupCount() const
Definition: flooritem.h:102
void setShowMsg(const bool n)
Definition: flooritem.h:111
ItemTypeT getItemType() const
Definition: flooritem.h:127
std::string getName() const
Definition: flooritem.cpp:146
int getItemId() const
Definition: flooritem.h:82
ItemColor getColor() const
Definition: flooritem.h:105
FloorItem(const BeingId id, const int itemId, const int x, const int y, const ItemTypeT itemType, const int amount, const int refine, const ItemColor color, const Identified identified, const Damaged damaged, const int *const cards)
Definition: flooritem.cpp:50
Identified mIdentified
Definition: flooritem.h:148
bool mShowMsg
Definition: flooritem.h:150
time_t mDropTime
Definition: flooritem.h:140
const ItemInfo & getInfo() const
Definition: flooritem.cpp:141
int getCard(const int index) const
Definition: flooritem.cpp:222
void setCards(const int *const cards, int sz)
Definition: flooritem.cpp:130
int getTileY() const
Definition: flooritem.h:96
ItemColor mColor
Definition: flooritem.h:147
bool mHighlight
Definition: flooritem.h:151
ActorTypeT getType() const
Definition: flooritem.h:72
int getTileX() const
Definition: flooritem.h:93
unsigned int mPickupCount
Definition: flooritem.h:145
void postInit(Map *const map, int subX, int subY)
Definition: flooritem.cpp:81
void incrementPickup()
Definition: flooritem.h:99
Damaged mDamaged
Definition: flooritem.h:149
int mItemId
Definition: flooritem.h:138
Identified getIdentified() const
Definition: flooritem.h:130
CursorT mCursor
Definition: flooritem.h:146
Definition: map.h:75
Cursor ::T CursorT
Definition: cursor.h:44
bool Damaged
Definition: damaged.h:30
bool Identified
Definition: identified.h:30
uint16_t ItemColor
Definition: itemcolor.h:30
ItemType ::T ItemTypeT
Definition: itemtype.h:43
#define override
Definition: localconsts.h:47
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULL(...)
Definition: localconsts.h:168
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
@ FloorItem
Definition: actortype.h:34