Crossfire Server, Trunk
RegionWrapper.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 "RegionWrapper.h"
14 #include "../ResourcesManager.h"
15 #include "../CREMapInformationManager.h"
16 #include "../scripts/ScriptFile.h"
17 #include "../archetypes/ArchetypeWrapper.h"
18 
19 RegionWrapper::RegionWrapper(AssetWrapper *parent, region *reg, ResourcesManager *resources) : AssetTWrapper(parent, "Region", reg),
20  myResourcesManager(resources) {
21  connect(resources->getMapInformationManager(), SIGNAL(mapAdded(CREMapInformation *)), this, SLOT(mapAdded(CREMapInformation *)));
22 }
23 
25  return myMaps.size();
26 }
27 
29  return myMaps[index];
30 }
31 
33  for (int idx = 0; idx < myMaps.size(); idx++) {
34  if (myMaps[idx] == child) {
35  return idx;
36  }
37  }
38  return -1;
39 }
40 
41 AssetWrapper::PossibleUse RegionWrapper::uses(const AssetWrapper *asset, std::string &) const {
42  return (dynamic_cast<const QuestWrapper *>(asset)
43  || dynamic_cast<const FaceWrapper *>(asset)
44  || dynamic_cast<const AnimationWrapper *>(asset)
45  || dynamic_cast<const ScriptFile *>(asset)
46  || dynamic_cast<const ArchetypeWrapper *>(asset)
48 }
49 
51  if (map->region() == myWrappedItem->name) {
55  }
56 }
AssetTWrapper< region >::myWrappedItem
region * myWrappedItem
Definition: AssetWrapper.h:104
AssetWrapper::AfterLayoutChange
@ AfterLayoutChange
Definition: AssetWrapper.h:33
RegionWrapper::RegionWrapper
RegionWrapper(AssetWrapper *parent, region *reg, ResourcesManager *resources)
Definition: RegionWrapper.cpp:19
ResourcesManager
Definition: ResourcesManager.h:80
AnimationWrapper
Definition: AnimationWrapper.h:24
QuestWrapper
Definition: QuestWrapper.h:66
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:32
region::name
char * name
Definition: map.h:276
RegionWrapper::child
virtual AssetWrapper * child(int index) override
Definition: RegionWrapper.cpp:28
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition: AssetWrapper.h:32
RegionWrapper::mapAdded
void mapAdded(CREMapInformation *map)
Definition: RegionWrapper.cpp:50
ResourcesManager::getMapInformationManager
CREMapInformationManager * getMapInformationManager()
Definition: ResourcesManager.h:91
CREMapInformation
Definition: CREMapInformation.h:27
RegionWrapper::childIndex
virtual int childIndex(AssetWrapper *child) override
Definition: RegionWrapper.cpp:32
FaceWrapper
Definition: FaceWrapper.h:24
disinfect.map
map
Definition: disinfect.py:4
AssetWrapper
Definition: AssetWrapper.h:25
RegionWrapper::myMaps
QList< CREMapInformation * > myMaps
Definition: RegionWrapper.h:53
RegionWrapper.h
CREMapInformationManager::getMapsForRegion
QList< CREMapInformation * > getMapsForRegion(const QString &region)
Definition: CREMapInformationManager.cpp:784
ScriptFile
Definition: ScriptFile.h:48
region
Definition: map.h:275
ArchetypeWrapper
Definition: ArchetypeWrapper.h:25
AssetWrapper::BeforeLayoutChange
@ BeforeLayoutChange
Definition: AssetWrapper.h:33
npc_dialog.index
int index
Definition: npc_dialog.py:102
RegionWrapper::childrenCount
virtual int childrenCount() const override
Definition: RegionWrapper.cpp:24
RegionWrapper::myResourcesManager
ResourcesManager * myResourcesManager
Definition: RegionWrapper.h:52
AssetWrapper::markModified
void markModified(ChangeType change, int extra=0)
Definition: AssetWrapper.h:55
RegionWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: RegionWrapper.cpp:41
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:32
connect
Definition: connect.py:1
AssetTWrapper
Definition: AssetWrapper.h:94