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