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 |
|
|
|
32 |
|
|
class MapItem final |
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 |
|
|
|
51 |
|
|
A_DELETE_COPY(MapItem) |
52 |
|
|
|
53 |
|
|
~MapItem(); |
54 |
|
|
|
55 |
|
|
int getType() const noexcept2 A_WARN_UNUSED |
56 |
|
|
{ return mType; } |
57 |
|
|
|
58 |
|
|
void setType(const int type); |
59 |
|
|
|
60 |
|
|
void setPos(const int x, const int y); |
61 |
|
|
|
62 |
|
|
int getX() const noexcept2 A_WARN_UNUSED |
63 |
|
|
{ return mX; } |
64 |
|
|
|
65 |
|
|
int getY() const noexcept2 A_WARN_UNUSED |
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: |
85 |
|
|
Image *mImage; |
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 |