Crossfire Server, Trunk
ScriptFileManager.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 SCRIPT_FILE_MANAGER_H
14 #define SCRIPT_FILE_MANAGER_H
15 
16 #include <QHash>
17 #include "assets/AssetWrapper.h"
18 #include "scripts/ScriptFile.h"
19 
20 class HookInformation;
21 class CREMapInformation;
22 
27  Q_OBJECT
28 
29  public:
31  virtual ~ScriptFileManager();
32 
33  virtual QString displayName() const override { return tr("Scripts"); }
34  virtual int childrenCount() const { return myScripts.size(); }
35  virtual AssetWrapper *child(int child) { return myScripts.values()[child]; }
36  virtual int childIndex(AssetWrapper *child) { return myScripts.values().indexOf(dynamic_cast<ScriptFile *>(child)); }
37 
38  QList<ScriptFile*> scriptsForMap(CREMapInformation* map);
39 
45  ScriptFile* getFile(const QString& path);
46 
52 
53  QList<ScriptFile*> scripts() const;
54 
55  public slots:
56  void addHook(const QString &file, HookInformation *hook);
57 
58  private:
59  QHash<QString, ScriptFile*> myScripts;
60 };
61 
62 #endif /* SCRIPT_FILE_MANAGER_H */
ScriptFileManager
Definition: ScriptFileManager.h:26
ScriptFileManager::displayName
virtual QString displayName() const override
Definition: ScriptFileManager.h:33
AssetWrapper.h
ScriptFileManager::myScripts
QHash< QString, ScriptFile * > myScripts
Definition: ScriptFileManager.h:59
mad_mage_user.file
file
Definition: mad_mage_user.py:15
CREMapInformation
Definition: CREMapInformation.h:27
disinfect.map
map
Definition: disinfect.py:4
ScriptFile.h
ScriptFileManager::scriptsForMap
QList< ScriptFile * > scriptsForMap(CREMapInformation *map)
Definition: ScriptFileManager.cpp:26
AssetWrapper
Definition: AssetWrapper.h:25
python_init.path
path
Definition: python_init.py:8
ScriptFileManager::removeMap
void removeMap(CREMapInformation *map)
Definition: ScriptFileManager.cpp:50
ScriptFileManager::childrenCount
virtual int childrenCount() const
Definition: ScriptFileManager.h:34
ScriptFileManager::ScriptFileManager
ScriptFileManager(AssetWrapper *parent)
Definition: ScriptFileManager.cpp:17
ScriptFileManager::scripts
QList< ScriptFile * > scripts() const
Definition: ScriptFileManager.cpp:68
ScriptFile
Definition: ScriptFile.h:48
ScriptFileManager::getFile
ScriptFile * getFile(const QString &path)
Definition: ScriptFileManager.cpp:39
ScriptFileManager::child
virtual AssetWrapper * child(int child)
Definition: ScriptFileManager.h:35
HookInformation
Definition: ScriptFile.h:25
ScriptFileManager::~ScriptFileManager
virtual ~ScriptFileManager()
Definition: ScriptFileManager.cpp:21
ScriptFileManager::childIndex
virtual int childIndex(AssetWrapper *child)
Definition: ScriptFileManager.h:36
ScriptFileManager::addHook
void addHook(const QString &file, HookInformation *hook)
Definition: ScriptFileManager.cpp:73