ManaPlus
textskilllistener.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2018 The ManaPlus Developers
4  *
5  * This file is part of The ManaPlus Client.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
22 
23 #include "gui/windows/textdialog.h"
24 
25 #include "net/skillhandler.h"
26 
27 #include "debug.h"
28 
32  mSkillId(0),
33  mX(0),
34  mY(0),
35  mLevel(0)
36 {
37 }
38 
39 void TextSkillListener::setSkill(const int skillId,
40  const int x,
41  const int y,
42  const int level)
43 {
44  mSkillId = skillId;
45  mX = x;
46  mY = y;
47  mLevel = level;
48 }
49 
51 {
52  if (event.getId() == "ok" && (mDialog != nullptr))
53  {
54  const std::string text = mDialog->getText();
55  if (text.empty())
56  return;
58  mLevel,
59  mX, mY,
60  text);
61  }
62  mDialog = nullptr;
63 }
NpcDialog * mDialog
Definition: npcrecv.cpp:41
void setSkill(const int skillId, const int x, const int y, const int level)
TextDialog * mDialog
Net::SkillHandler * skillHandler
Definition: net.cpp:94
const std::string & getText() const
Definition: textdialog.cpp:123
const std::string & getId() const
Definition: actionevent.h:121
#define nullptr
Definition: localconsts.h:44
virtual void usePos(const int id, const int level, const int x, const int y) const =0
void action(const ActionEvent &event)