ManaPlus
mapitem.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef RESOURCES_MAP_MAPITEM_H
23 #define RESOURCES_MAP_MAPITEM_H
24 
25 #include <string>
26 
27 #include "localconsts.h"
28 
29 class Graphics;
30 class Image;
31 
33 {
34  public:
35  friend class Map;
36  friend class MapLayer;
37  friend class SpecialLayer;
38 
39  MapItem();
40 
41  explicit MapItem(const int type);
42 
43  MapItem(const int type,
44  const std::string &comment);
45 
46  MapItem(const int type,
47  const std::string &comment,
48  const int x,
49  const int y);
50 
52 
53  ~MapItem();
54 
56  { return mType; }
57 
58  void setType(const int type);
59 
60  void setPos(const int x, const int y);
61 
63  { return mX; }
64 
66  { return mY; }
67 
68  const std::string &getComment() const noexcept2 A_WARN_UNUSED
69  { return mComment; }
70 
71  void setComment(const std::string &comment) noexcept2
72  { mComment = comment; }
73 
74  const std::string &getName() const noexcept2 A_WARN_UNUSED
75  { return mName; }
76 
77  void setName(const std::string &name) noexcept2
78  { mName = name; }
79 
80  void draw(Graphics *const graphics,
81  const int x, const int y,
82  const int dx, const int dy) const A_NONNULL(2);
83 
84  private:
86  std::string mComment;
87  std::string mName;
88  int mType;
89  int mX;
90  int mY;
91 };
92 
93 #endif // RESOURCES_MAP_MAPITEM_H
const std::string & getComment() const
Definition: mapitem.h:68
~MapItem()
Definition: mapitem.cpp:87
int mX
Definition: mapitem.h:89
std::string mName
Definition: mapitem.h:87
Image * mImage
Definition: mapitem.h:85
void setName(const std::string &name)
Definition: mapitem.h:77
int mType
Definition: mapitem.h:88
int getType() const
Definition: mapitem.h:55
const std::string & getName() const
Definition: mapitem.h:74
std::string mComment
Definition: mapitem.h:86
void setPos(const int x, const int y)
Definition: mapitem.cpp:127
int getY() const
Definition: mapitem.h:65
void setType(const int type)
Definition: mapitem.cpp:96
MapItem()
Definition: mapitem.cpp:39
int getX() const
Definition: mapitem.h:62
void setComment(const std::string &comment)
Definition: mapitem.h:71
void draw(Graphics *const graphics, const int x, const int y, const int dx, const int dy) const
Definition: mapitem.cpp:133
int mY
Definition: mapitem.h:90
Definition: map.h:75
#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