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-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 
27 
28 #include "enums/resources/cursor.h"
29 
31 
35 
36 #include "being/actorsprite.h"
37 
38 class ItemInfo;
39 
43 class FloorItem final : public ActorSprite
44 {
45  public:
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 
68 
69  void postInit(Map *const map, int subX, int subY);
70 
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 
82  { return mItemId; }
83 
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 
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 
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:
137  int mItemId;
138  int mX, mY;
139  time_t mDropTime;
140  int mAmount;
141  int mRefine;
144  unsigned int mPickupCount;
149  bool mShowMsg;
151 };
152 
153 #endif // BEING_FLOORITEM_H
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
int getTileY() const
Definition: flooritem.h:95
int getRefine() const
Definition: flooritem.h:123
void postInit(Map *const map, int subX, int subY)
Definition: flooritem.cpp:80
ItemTypeT getItemType() const
Definition: flooritem.h:126
int getTileX() const
Definition: flooritem.h:92
unsigned int mPickupCount
Definition: flooritem.h:144
#define A_WARN_UNUSED
Definition: localconsts.h:172
#define final
Definition: localconsts.h:45
int BeingId
Definition: beingid.h:29
bool mHighlight
Definition: flooritem.h:150
bool mShowMsg
Definition: flooritem.h:149
ItemColor mColor
Definition: flooritem.h:146
ActorType ::T ActorTypeT
Definition: actortype.h:42
Identified getIdentified() const
Definition: flooritem.h:129
uint16_t ItemColor
Definition: itemcolor.h:29
Identified mIdentified
Definition: flooritem.h:147
#define A_NONNULL(...)
Definition: localconsts.h:179
ItemColor getColor() const
Definition: flooritem.h:104
Damaged getDamaged() const
Definition: flooritem.h:132
std::string getName() const
Definition: flooritem.cpp:145
int mRefine
Definition: flooritem.h:141
Damaged mDamaged
Definition: flooritem.h:148
bool getShowMsg() const
Definition: flooritem.h:107
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:49
void setShowMsg(const bool n)
Definition: flooritem.h:110
int mItemId
Definition: flooritem.h:137
int mCards[4]
Definition: flooritem.h:136
Definition: map.h:68
ActorTypeT getType() const
Definition: flooritem.h:71
time_t mDropTime
Definition: flooritem.h:139
ItemType ::T ItemTypeT
Definition: itemtype.h:42
Cursor ::T CursorT
Definition: cursor.h:43
void incrementPickup()
Definition: flooritem.h:98
CursorT mCursor
Definition: flooritem.h:145
int mAmount
Definition: flooritem.h:140
void draw(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: flooritem.cpp:158
#define override
Definition: localconsts.h:46
unsigned getPickupCount() const
Definition: flooritem.h:101
ItemTypeT mItemType
Definition: flooritem.h:143
const ItemInfo & getInfo() const
Definition: flooritem.cpp:140
void setCards(const int *const cards, int sz)
Definition: flooritem.cpp:129
#define noexcept2
Definition: localconsts.h:49
int mHeightPosDiff
Definition: flooritem.h:142
void disableHightlight()
Definition: flooritem.h:113
CursorT getHoverCursor() const
Definition: flooritem.h:116
#define maxCards
Definition: cards.h:24
int getCard(const int index) const
Definition: flooritem.cpp:220
int getItemId() const
Definition: flooritem.h:81