ManaPlus
questswindow.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-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 GUI_WINDOWS_QUESTSWINDOW_H
23 #define GUI_WINDOWS_QUESTSWINDOW_H
24 
25 #include "localconsts.h"
26 
28 
29 #include "gui/widgets/window.h"
30 
32 
33 #include "resources/questvar.h"
34 
35 class Being;
36 class BrowserBox;
37 class Button;
38 class ExtendedListBox;
39 class ItemLinkHandler;
40 class Map;
41 class ScrollArea;
42 class QuestsModel;
43 
44 struct QuestEffect;
45 struct QuestItem;
46 
47 typedef std::map<BeingTypeId, const QuestEffect*> NpcQuestEffectMap;
48 typedef NpcQuestEffectMap::const_iterator NpcQuestEffectMapCIter;
49 
50 class QuestsWindow final : public Window,
51  public ActionListener
52 {
53  public:
54  QuestsWindow();
55 
57 
58  ~QuestsWindow() override final;
59 
60  void action(const ActionEvent &event) override final;
61 
62  void updateQuest(const int var,
63  const int val1,
64  const int val2,
65  const int val3,
66  const int time1);
67 
68  void rebuild(const bool playSound);
69 
70  void showQuest(const QuestItem *const quest);
71 
72  void setMap(const Map *const map);
73 
74  void updateEffects();
75 
76  void addEffect(Being *const being);
77 
78  void selectQuest(const int varId);
79 
80  private:
90  STD_VECTOR<const QuestEffect*> mMapEffects;
92  std::map<int, STD_VECTOR<QuestItem*> > *mQuests;
93  STD_VECTOR<QuestEffect*> *mAllEffects;
94 
95  // npc effects for current map and values: npc, effect
97  STD_VECTOR<QuestItem*> mQuestLinks;
98  std::map<int, int> mQuestReverseLinks;
101  const Map *mMap;
102 };
103 
104 extern QuestsWindow *questsWindow;
105 
106 #endif // GUI_WINDOWS_QUESTSWINDOW_H
Definition: being.h:96
Definition: button.h:102
Definition: map.h:75
void updateEffects()
QuestsModel * mQuestsModel
Definition: questswindow.h:81
ScrollArea * mQuestScrollArea
Definition: questswindow.h:83
std::vector< const QuestEffect * > mMapEffects
Definition: questswindow.h:90
void addEffect(Being *const being)
Button * mCloseButton
Definition: questswindow.h:87
Image * mCompleteIcon
Definition: questswindow.h:88
NpcQuestEffectMap mNpcEffects
Definition: questswindow.h:96
void action(const ActionEvent &event)
int mCompleteQuestEffectId
Definition: questswindow.h:100
ExtendedListBox * mQuestsListBox
Definition: questswindow.h:82
ItemLinkHandler * mItemLinkHandler
Definition: questswindow.h:84
std::map< int, int > mQuestReverseLinks
Definition: questswindow.h:98
NpcQuestVarMap * mVars
Definition: questswindow.h:91
std::map< int, std::vector< QuestItem * > > * mQuests
Definition: questswindow.h:92
int mNewQuestEffectId
Definition: questswindow.h:99
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
std::vector< QuestItem * > mQuestLinks
Definition: questswindow.h:97
void rebuild(const bool playSound)
BrowserBox * mText
Definition: questswindow.h:85
ScrollArea * mTextScrollArea
Definition: questswindow.h:86
const Map * mMap
Definition: questswindow.h:101
void selectQuest(const int varId)
void showQuest(const QuestItem *const quest)
std::vector< QuestEffect * > * mAllEffects
Definition: questswindow.h:93
Image * mIncompleteIcon
Definition: questswindow.h:89
void setMap(const Map *const map)
Definition: window.h:102
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
QuestsWindow * questsWindow
std::map< BeingTypeId, const QuestEffect * > NpcQuestEffectMap
Definition: questswindow.h:45
NpcQuestEffectMap::const_iterator NpcQuestEffectMapCIter
Definition: questswindow.h:48
std::map< int, QuestVar > NpcQuestVarMap
Definition: questvar.h:58