ManaPlus
textcommand.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2009 The Mana World Development Team
4  * Copyright (C) 2011-2019 The ManaPlus Developers
5  * Copyright (C) 2009-2021 Andrei Karas
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 TEXTCOMMAND_H
24 #define TEXTCOMMAND_H
25 
26 #include "enums/commandtarget.h"
27 #ifdef TMWA_SUPPORT
28 #include "enums/magicschool.h"
29 #include "enums/textcommandtype.h"
30 #endif
31 
32 #include <string>
33 
34 #include "localconsts.h"
35 
36 class Image;
37 
42 {
43  public:
44 #ifdef TMWA_SUPPORT
48  TextCommand(const int id,
49  const std::string &symbol,
50  const std::string &command,
51  const std::string &comment,
52  const CommandTargetT type,
53  const std::string &icon,
54  const unsigned int basicLvl,
55  const MagicSchoolT school,
56  const unsigned int schoolLvl,
57  const unsigned int mana);
58 #endif // TMWA_SUPPORT
59 
63  TextCommand(const int id,
64  const std::string &symbol,
65  const std::string &command,
66  const std::string &comment,
67  const CommandTargetT type,
68  const std::string &icon);
69 
73  explicit TextCommand(const int id);
74 
76 
77 
80  ~TextCommand();
81 
82  std::string getName() const noexcept2 A_WARN_UNUSED
83  { return mCommand; }
84 
85  std::string getCommand() const noexcept2 A_WARN_UNUSED
86  { return mCommand; }
87 
88  std::string getComment() const noexcept2 A_WARN_UNUSED
89  { return mComment; }
90 
91  std::string getSymbol() const noexcept2 A_WARN_UNUSED
92  { return mSymbol; }
93 
95  { return mId; }
96 
98  { return mTargetType; }
99 
100  std::string getIcon() const noexcept2 A_WARN_UNUSED
101  { return mIcon; }
102 
103 #ifdef TMWA_SUPPORT
104  unsigned int getMana() const noexcept2 A_WARN_UNUSED
105  { return mMana; }
106 
108  { return mSchool; }
109 
111  { return mBaseLvl; }
112 
114  { return mSchoolLvl; }
115 
116  void setMana(const unsigned int mana)
117  { mMana = mana; }
118 
119  void setSchool(const MagicSchoolT school)
120  { mSchool = school; }
121 
122  void setBaseLvl(const unsigned int baseLvl)
123  { mBaseLvl = baseLvl; }
124 
125  void setSchoolLvl(const unsigned int schoolLvl)
126  { mSchoolLvl = schoolLvl; }
127 
129  { return mCommandType; }
130 
131  void setCommandType(const TextCommandTypeT commandType)
132  { mCommandType = commandType; }
133 #endif // TMWA_SUPPORT
134 
135  void setCommand(const std::string &command)
136  { mCommand = command; }
137 
138  void setComment(const std::string &comment)
139  { mComment = comment; }
140 
141  void setSymbol(const std::string &symbol)
142  { mSymbol = symbol; }
143 
144  void setId(const int id)
145  { mId = id; }
146 
147  void setTargetType(const CommandTargetT targetType)
148  { mTargetType = targetType; }
149 
150  void setIcon(const std::string &icon)
151  { mIcon = icon; loadImage(); }
152 
154  { return mCommand.empty() && mSymbol.empty(); }
155 
157  { return mImage; }
158 
159  private:
160  void loadImage();
161 
162  protected:
163  std::string mCommand;
164  std::string mComment;
165  std::string mSymbol;
167  std::string mIcon;
168  int mId;
169 #ifdef TMWA_SUPPORT
170  unsigned int mMana;
172  unsigned mBaseLvl;
173  unsigned mSchoolLvl;
175 #endif // TMWA_SUPPORT
176 
178 };
179 
180 #endif // TEXTCOMMAND_H
unsigned int mMana
Definition: textcommand.h:170
unsigned getBaseLvl() const
Definition: textcommand.h:110
unsigned int getMana() const
Definition: textcommand.h:104
std::string getName() const
Definition: textcommand.h:82
std::string getCommand() const
Definition: textcommand.h:85
void setSchoolLvl(const unsigned int schoolLvl)
Definition: textcommand.h:125
int getId() const
Definition: textcommand.h:94
CommandTargetT mTargetType
Definition: textcommand.h:166
bool isEmpty() const
Definition: textcommand.h:153
std::string mCommand
Definition: textcommand.h:163
void loadImage()
unsigned getSchoolLvl() const
Definition: textcommand.h:113
void setBaseLvl(const unsigned int baseLvl)
Definition: textcommand.h:122
void setSchool(const MagicSchoolT school)
Definition: textcommand.h:119
void setId(const int id)
Definition: textcommand.h:144
TextCommandTypeT mCommandType
Definition: textcommand.h:174
MagicSchoolT getSchool() const
Definition: textcommand.h:107
void setTargetType(const CommandTargetT targetType)
Definition: textcommand.h:147
Image * mImage
Definition: textcommand.h:177
void setCommand(const std::string &command)
Definition: textcommand.h:135
std::string mSymbol
Definition: textcommand.h:165
std::string getSymbol() const
Definition: textcommand.h:91
unsigned mSchoolLvl
Definition: textcommand.h:173
void setComment(const std::string &comment)
Definition: textcommand.h:138
TextCommand(const int id, const std::string &symbol, const std::string &command, const std::string &comment, const CommandTargetT type, const std::string &icon, const unsigned int basicLvl, const MagicSchoolT school, const unsigned int schoolLvl, const unsigned int mana)
Definition: textcommand.cpp:40
MagicSchoolT mSchool
Definition: textcommand.h:171
TextCommandTypeT getCommandType() const
Definition: textcommand.h:128
void setIcon(const std::string &icon)
Definition: textcommand.h:150
std::string getComment() const
Definition: textcommand.h:88
CommandTargetT getTargetType() const
Definition: textcommand.h:97
void setSymbol(const std::string &symbol)
Definition: textcommand.h:141
std::string getIcon() const
Definition: textcommand.h:100
unsigned mBaseLvl
Definition: textcommand.h:172
std::string mIcon
Definition: textcommand.h:167
void setCommandType(const TextCommandTypeT commandType)
Definition: textcommand.h:131
Image * getImage() const
Definition: textcommand.h:156
void setMana(const unsigned int mana)
Definition: textcommand.h:116
std::string mComment
Definition: textcommand.h:164
CommandTarget ::T CommandTargetT
Definition: commandtarget.h:33
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
MagicSchool ::T MagicSchoolT
Definition: magicschool.h:38
TextCommandType ::T TextCommandTypeT