Crossfire Server, Trunk
CREMapInformationManager.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 CLASS_CRE_MAP_INFORMATION_MANAGER_H
14 #define CLASS_CRE_MAP_INFORMATION_MANAGER_H
15 
16 #include <QtCore>
17 #include "CREMapInformation.h"
18 
19 #include "global.h"
20 #include "quest.h"
21 
22 class MessageManager;
23 class ScriptFileManager;
24 class HookInformation;
25 class RandomMap;
26 
27 class CREMapInformationManager : public QObject
28 {
29  Q_OBJECT
30 
31  public:
32  CREMapInformationManager(QObject* parent, MessageManager* messageManager, ScriptFileManager* scriptManager);
33  virtual ~CREMapInformationManager();
34 
35  bool browseFinished() const;
36  void start();
37  void cancel();
38  void clearCache();
39 
40  QList<CREMapInformation*> allMaps();
41  QList<CREMapInformation*> getArchetypeUse(const archetype* arch);
42  QList<CREMapInformation*> getFaceUse(const Face* face);
43  QList<CREMapInformation*> getAnimationUse(const Animations* anim);
44  QList<CREMapInformation*> getMapsForRegion(const QString& region);
45  QList<CREMapInformation*> getMapsForQuest(const quest_definition *quest);
46  QList<RandomMap*> randomMaps();
47 
48  signals:
49  void browsingMap(const QString& path);
50  void finished();
51  void addHook(const QString &file, HookInformation *hook);
53 
54  protected:
57  QHash<QString, CREMapInformation*> myInformation;
58  QMultiHash<QString, CREMapInformation*> myArchetypeUse;
59  QMultiHash<QString, CREMapInformation*> myFaceUse;
60  QMultiHash<QString, CREMapInformation*> myAnimationUse;
61  QMultiHash<QString, CREMapInformation*> myQuestUse;
62  QStringList myToProcess;
64  QFuture<void> myWorker;
66  QMutex myLock;
67  QHash<QString, qint64> myExperience;
68 
69  void browseMaps();
70  void process(const QString& path);
71  void checkItem(const object* item, CREMapInformation* information, const object* env);
72  void loadCache();
73  void storeCache();
75  void addArchetypeUse(const QString& name, CREMapInformation* map);
76  void addFaceUse(const QString& name, CREMapInformation* map);
77  void addAnimationUse(const QString& name, CREMapInformation* map);
78  void addQuestUse(const QString &name, CREMapInformation *map);
79  void checkEvent(const object* item, CREMapInformation* map, const object* env);
80  void recurseStyleDirectory(const QString& from);
81 };
82 
83 #endif // CLASS_CRE_MAP_INFORMATION_MANAGER_H
ScriptFileManager
Definition: ScriptFileManager.h:26
Face
Definition: face.h:14
RandomMap
Definition: RandomMap.h:24
CREMapInformationManager::finished
void finished()
global.h
CREMapInformationManager::~CREMapInformationManager
virtual ~CREMapInformationManager()
Definition: CREMapInformationManager.cpp:76
CREMapInformationManager::myCurrentMap
int myCurrentMap
Definition: CREMapInformationManager.h:63
CREMapInformationManager::randomMaps
QList< RandomMap * > randomMaps()
Definition: CREMapInformationManager.cpp:813
CREMapInformationManager::checkItem
void checkItem(const object *item, CREMapInformation *information, const object *env)
Definition: CREMapInformationManager.cpp:94
CREMapInformationManager::browsingMap
void browsingMap(const QString &path)
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
CREMapInformation.h
CREMapInformationManager::start
void start()
Definition: CREMapInformationManager.cpp:86
CREMapInformationManager::addHook
void addHook(const QString &file, HookInformation *hook)
CREMapInformationManager::clearCache
void clearCache()
Definition: CREMapInformationManager.cpp:806
CREMapInformationManager::myWorker
QFuture< void > myWorker
Definition: CREMapInformationManager.h:64
mad_mage_user.file
file
Definition: mad_mage_user.py:15
CREMapInformationManager::getAnimationUse
QList< CREMapInformation * > getAnimationUse(const Animations *anim)
Definition: CREMapInformationManager.cpp:392
CREMapInformationManager::allMaps
QList< CREMapInformation * > allMaps()
Definition: CREMapInformationManager.cpp:374
CREMapInformationManager::getArchetypeUse
QList< CREMapInformation * > getArchetypeUse(const archetype *arch)
Definition: CREMapInformationManager.cpp:380
CREMapInformationManager::myCancelled
bool myCancelled
Definition: CREMapInformationManager.h:65
CREMapInformationManager::process
void process(const QString &path)
Definition: CREMapInformationManager.cpp:193
CREMapInformationManager::addArchetypeUse
void addArchetypeUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:719
CREMapInformationManager::myExperience
QHash< QString, qint64 > myExperience
Definition: CREMapInformationManager.h:67
CREMapInformationManager::addAnimationUse
void addAnimationUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:733
CREMapInformationManager::recurseStyleDirectory
void recurseStyleDirectory(const QString &from)
Definition: CREMapInformationManager.cpp:823
CREMapInformation
Definition: CREMapInformation.h:27
quest
Definition: quest.py:1
CREMapInformationManager::CREMapInformationManager
CREMapInformationManager(QObject *parent, MessageManager *messageManager, ScriptFileManager *scriptManager)
Definition: CREMapInformationManager.cpp:67
disinfect.map
map
Definition: disinfect.py:4
python_init.path
path
Definition: python_init.py:8
CREMapInformationManager::myAnimationUse
QMultiHash< QString, CREMapInformation * > myAnimationUse
Definition: CREMapInformationManager.h:60
MessageManager
Definition: MessageManager.h:25
archetype
Definition: object.h:483
animate.anim
string anim
Definition: animate.py:20
CREMapInformationManager::myScriptManager
ScriptFileManager * myScriptManager
Definition: CREMapInformationManager.h:56
CREMapInformationManager::myArchetypeUse
QMultiHash< QString, CREMapInformation * > myArchetypeUse
Definition: CREMapInformationManager.h:58
CREMapInformationManager::browseFinished
bool browseFinished() const
Definition: CREMapInformationManager.cpp:81
env
static std::shared_ptr< inja::Environment > env
Definition: mapper.cpp:2168
CREMapInformationManager::getMapsForRegion
QList< CREMapInformation * > getMapsForRegion(const QString &region)
Definition: CREMapInformationManager.cpp:793
region
Definition: map.h:272
quest.h
CREMapInformationManager::myLock
QMutex myLock
Definition: CREMapInformationManager.h:66
CREMapInformationManager::myFaceUse
QMultiHash< QString, CREMapInformation * > myFaceUse
Definition: CREMapInformationManager.h:59
CREMapInformationManager::getOrCreateMapInformation
CREMapInformation * getOrCreateMapInformation(const QString &path)
Definition: CREMapInformationManager.cpp:709
CREMapInformationManager::myToProcess
QStringList myToProcess
Definition: CREMapInformationManager.h:62
CREMapInformationManager::addQuestUse
void addQuestUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:740
CREMapInformationManager::browseMaps
void browseMaps()
Definition: CREMapInformationManager.cpp:310
item
Definition: item.py:1
CREMapInformationManager::addFaceUse
void addFaceUse(const QString &name, CREMapInformation *map)
Definition: CREMapInformationManager.cpp:726
Animations
Definition: face.h:25
quest_definition
Definition: quest.h:37
CREMapInformationManager::checkEvent
void checkEvent(const object *item, CREMapInformation *map, const object *env)
Definition: CREMapInformationManager.cpp:747
CREMapInformationManager::cancel
void cancel()
Definition: CREMapInformationManager.cpp:368
CREMapInformationManager::loadCache
void loadCache()
Definition: CREMapInformationManager.cpp:404
CREMapInformationManager::myInformation
QHash< QString, CREMapInformation * > myInformation
Definition: CREMapInformationManager.h:57
CREMapInformationManager::mapAdded
void mapAdded(CREMapInformation *map)
CREMapInformationManager::getMapsForQuest
QList< CREMapInformation * > getMapsForQuest(const quest_definition *quest)
Definition: CREMapInformationManager.cpp:398
CREMapInformationManager::myMessageManager
MessageManager * myMessageManager
Definition: CREMapInformationManager.h:55
CREMapInformationManager::getFaceUse
QList< CREMapInformation * > getFaceUse(const Face *face)
Definition: CREMapInformationManager.cpp:386
CREMapInformationManager::myQuestUse
QMultiHash< QString, CREMapInformation * > myQuestUse
Definition: CREMapInformationManager.h:61
CREMapInformationManager
Definition: CREMapInformationManager.h:27
HookInformation
Definition: ScriptFile.h:25
CREMapInformationManager::storeCache
void storeCache()
Definition: CREMapInformationManager.cpp:584
give.name
name
Definition: give.py:27