Crossfire Server, Trunk
TreasuresWrapper.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 TREASURES_WRAPPER_H
14 #define TREASURES_WRAPPER_H
15 
16 extern "C" {
17 #include "global.h"
18 }
19 
20 #include "AssetsManager.h"
21 #include "assets.h"
22 #include "../assets/AssetsCollectionWrapper.h"
23 #include "../archetypes/ArchetypeWrapper.h"
24 #include "TreasureListWrapper.h"
25 
26 class ResourcesManager;
27 
28 class TreasuresWrapper : public AssetsCollectionWrapper<treasurelist> {
29  Q_OBJECT
30 public:
31  TreasuresWrapper(AssetWrapper *parent, ResourcesManager *resourcesManager) : AssetsCollectionWrapper(parent, tr("Treasures"), getManager()->treasures(), resourcesManager, tr("Display all treasures.")) {
32  }
33 
34  virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override {
35  return dynamic_cast<const ArchetypeWrapper *>(asset) || dynamic_cast<const TreasureListWrapper *>(asset) ? ChildrenMayUse : DoesntUse;
36  }
37 };
38 
39 #endif /* TREASURES_WRAPPER_H */
global.h
ResourcesManager
Definition: ResourcesManager.h:80
AssetsManager.h
TreasuresWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: TreasuresWrapper.h:34
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:31
TreasureListWrapper
Definition: TreasureListWrapper.h:27
getManager
AssetsManager * getManager()
Definition: assets.cpp:309
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition: AssetWrapper.h:31
AssetWrapper
Definition: AssetWrapper.h:25
TreasuresWrapper
Definition: TreasuresWrapper.h:28
TreasuresWrapper::TreasuresWrapper
TreasuresWrapper(AssetWrapper *parent, ResourcesManager *resourcesManager)
Definition: TreasuresWrapper.h:31
ArchetypeWrapper
Definition: ArchetypeWrapper.h:25
TreasureListWrapper.h
assets.h
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:31
AssetsCollectionWrapper
Definition: AssetsCollectionWrapper.h:21