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 (region* reg = first_region; reg; reg = reg->next) {
20  myRegions.push_front(resources->wrap(reg, this));
21  }
22  qSort(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 }
first_region
region * first_region
Definition: init.cpp:108
ResourcesManager
Definition: ResourcesManager.h:80
AnimationWrapper
Definition: AnimationWrapper.h:24
QuestWrapper
Definition: QuestWrapper.h:66
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:31
ResourcesManager::wrap
ArchetypeWrapper * wrap(archt *arch, AssetWrapper *parent)
Definition: ResourcesManager.h:126
AssetWrapper::tipProperty
static const char * tipProperty
Definition: AssetWrapper.h:33
RegionsWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: RegionsWrapper.cpp:26
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition: AssetWrapper.h:31
regiondef::next
struct regiondef * next
Definition: map.h:276
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:32
ScriptFile
Definition: ScriptFile.h:48
ArchetypeWrapper
Definition: ArchetypeWrapper.h:25
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:31
AssetWrapper::compareByDisplayName
static bool compareByDisplayName(const AssetWrapper *left, const AssetWrapper *right)
Definition: AssetWrapper.h:65
regiondef
Definition: map.h:275