Crossfire Server, Trunk
RegionsWrapper.cpp
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 #include "RegionsWrapper.h"
14 #include "../ResourcesManager.h"
15 #include "../scripts/ScriptFile.h"
16 #include "../archetypes/ArchetypeWrapper.h"
17 
19  for (auto reg : all_regions) {
20  myRegions.push_front(resources->wrap(reg, this));
21  }
22  std::sort(myRegions.begin(), myRegions.end(), compareByDisplayName);
23  setProperty(tipProperty, tr("Display all maps and regions."));
24 }
25 
26 AssetWrapper::PossibleUse RegionsWrapper::uses(const AssetWrapper *asset, std::string &) const {
27  return (dynamic_cast<const QuestWrapper *>(asset)
28  || dynamic_cast<const FaceWrapper *>(asset)
29  || dynamic_cast<const AnimationWrapper *>(asset)
30  || dynamic_cast<const ScriptFile *>(asset)
31  || dynamic_cast<const ArchetypeWrapper *>(asset)
33 }
ResourcesManager
Definition: ResourcesManager.h:80
AnimationWrapper
Definition: AnimationWrapper.h:24
ResourcesManager::wrap
ArchetypeWrapper * wrap(archetype *arch, AssetWrapper *parent)
Definition: ResourcesManager.h:132
QuestWrapper
Definition: QuestWrapper.h:66
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:32
AssetWrapper::tipProperty
static const char * tipProperty
Definition: AssetWrapper.h:34
RegionsWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: RegionsWrapper.cpp:26
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition: AssetWrapper.h:32
FaceWrapper
Definition: FaceWrapper.h:24
AssetWrapper
Definition: AssetWrapper.h:25
RegionsWrapper::RegionsWrapper
RegionsWrapper(AssetWrapper *parent, ResourcesManager *resources)
Definition: RegionsWrapper.cpp:18
RegionsWrapper.h
RegionsWrapper::myRegions
QVector< AssetWrapper * > myRegions
Definition: RegionsWrapper.h:33
ScriptFile
Definition: ScriptFile.h:48
all_regions
std::vector< region * > all_regions
Definition: init.cpp:108
ArchetypeWrapper
Definition: ArchetypeWrapper.h:25
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:32
AssetWrapper::compareByDisplayName
static bool compareByDisplayName(const AssetWrapper *left, const AssetWrapper *right)
Definition: AssetWrapper.h:66