Crossfire Server, Trunk
ArtifactsWrapper.cpp
Go to the documentation of this file.
1 #include "ArtifactsWrapper.h"
2 #include "ResourcesManager.h"
3 #include "CREPixmap.h"
4 #include "faces/FaceWrapper.h"
5 
7  : AssetWrapper(parent), myResourcesManager(resourcesManager) {
8  setProperty(tipProperty, tr("Display all artifacts."));
9 }
10 
12  int count = 0;
13  auto list = first_artifactlist;
14  while (list) {
15  count++;
16  list = list->next;
17  }
18  return count;
19 }
20 
22  auto list = first_artifactlist;
23  while (index > 0) {
24  index--;
25  list = list->next;
26  }
27  return myResourcesManager->wrap(list, this);
28 }
29 
31  auto list = first_artifactlist;
32  int index = 0;
33  while (list) {
34  if (myResourcesManager->wrap(list, this) == child) {
35  return index;
36  }
37  list = list->next;
38  index++;
39  }
40  return -1;
41 }
42 
44  if (dynamic_cast<const FaceWrapper *>(asset) || dynamic_cast<const AnimationWrapper *>(asset)) {
45  return ChildrenMayUse;
46  }
47  return DoesntUse;
48 }
ArtifactsWrapper::childIndex
virtual int childIndex(AssetWrapper *) override
Definition: ArtifactsWrapper.cpp:30
ResourcesManager
Definition: ResourcesManager.h:67
AnimationWrapper
Definition: AnimationWrapper.h:15
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:14
ArtifactsWrapper::myResourcesManager
ResourcesManager * myResourcesManager
Definition: ArtifactsWrapper.h:29
guildoracle.list
list
Definition: guildoracle.py:87
ResourcesManager::wrap
ArchetypeWrapper * wrap(archt *arch, AssetWrapper *parent)
Definition: ResourcesManager.h:112
first_artifactlist
EXTERN artifactlist * first_artifactlist
Definition: global.h:118
ArtifactsWrapper::childrenCount
virtual int childrenCount() const override
Definition: ArtifactsWrapper.cpp:11
AssetWrapper::tipProperty
static const char * tipProperty
Definition: AssetWrapper.h:16
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition: AssetWrapper.h:14
FaceWrapper
Definition: FaceWrapper.h:15
AssetWrapper
Definition: AssetWrapper.h:11
disinfect.count
int count
Definition: disinfect.py:7
FaceWrapper.h
ArtifactsWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: ArtifactsWrapper.cpp:43
ArtifactsWrapper.h
ResourcesManager.h
npc_dialog.index
int index
Definition: npc_dialog.py:102
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:14
CREPixmap.h
ArtifactsWrapper::child
virtual AssetWrapper * child(int) override
Definition: ArtifactsWrapper.cpp:21
ArtifactsWrapper::ArtifactsWrapper
ArtifactsWrapper(AssetWrapper *parent, ResourcesManager *resourcesManager)
Definition: ArtifactsWrapper.cpp:6