Crossfire Server, Trunk
QuestsWrapper.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef QUESTS_WRAPPER_H
14 #define QUESTS_WRAPPER_H
15 
16 #include "assets.h"
17 #include "AssetsManager.h"
19 
23 class QuestsWrapper : public AssetsCollectionWrapper<quest_definition> {
24  Q_OBJECT
25 public:
26  QuestsWrapper(AssetWrapper *parent, ResourcesManager *resources) : AssetsCollectionWrapper(parent, tr("Quests"), getManager()->quests(), resources, tr("Display all quests.")) {
27  myResources = resources;
28  }
29 
30  virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override {
31  if (dynamic_cast<const FaceWrapper *>(asset)) {
32  return ChildrenMayUse;
33  }
34  return DoesntUse;
35  }
36 
37  virtual void fillMenu(QMenu *menu) override;
38 
39 protected:
45  void addQuest();
46 };
47 
48 #endif /* QUESTS_WRAPPER_H */
QuestsWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: QuestsWrapper.h:30
ResourcesManager
Definition: ResourcesManager.h:80
AssetsManager.h
QuestsWrapper::addQuest
void addQuest()
Definition: QuestsWrapper.cpp:23
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:32
getManager
AssetsManager * getManager()
Definition: assets.cpp:305
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition: AssetWrapper.h:32
FaceWrapper
Definition: FaceWrapper.h:24
AssetWrapper
Definition: AssetWrapper.h:25
QuestsWrapper::myResources
ResourcesManager * myResources
Definition: QuestsWrapper.h:40
QuestsWrapper::QuestsWrapper
QuestsWrapper(AssetWrapper *parent, ResourcesManager *resources)
Definition: QuestsWrapper.h:26
QuestsWrapper
Definition: QuestsWrapper.h:23
AssetsCollectionWrapper.h
assets.h
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:32
AssetsCollectionWrapper
Definition: AssetsCollectionWrapper.h:21
quests
static struct_quest ** quests
Definition: mapper.cpp:892
QuestsWrapper::fillMenu
virtual void fillMenu(QMenu *menu) override
Definition: QuestsWrapper.cpp:19