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 
25  Q_OBJECT
26 
27  public:
29  virtual ~ScriptFileManager();
30 
31  virtual QString displayName() const override { return "Scripts"; }
32  virtual int childrenCount() const { return myScripts.size(); }
33  virtual AssetWrapper *child(int child) { return myScripts.values()[child]; }
34  virtual int childIndex(AssetWrapper *child) { return myScripts.values().indexOf(dynamic_cast<ScriptFile *>(child)); }
35 
36  QList<ScriptFile*> scriptsForMap(CREMapInformation* map);
37 
43  ScriptFile* getFile(const QString& path);
44 
50 
51  QList<ScriptFile*> scripts() const;
52 
53  public slots:
54  void addHook(const QString &file, HookInformation *hook);
55 
56  private:
57  QHash<QString, ScriptFile*> myScripts;
58 };
59 
60 #endif /* SCRIPT_FILE_MANAGER_H */
ScriptFileManager
Definition: ScriptFileManager.h:24
ScriptFileManager::displayName
virtual QString displayName() const override
Definition: ScriptFileManager.h:31
AssetWrapper.h
ScriptFileManager::myScripts
QHash< QString, ScriptFile * > myScripts
Definition: ScriptFileManager.h:57
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:22
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:32
ScriptFileManager::ScriptFileManager
ScriptFileManager(AssetWrapper *parent)
Definition: ScriptFileManager.cpp:17
ScriptFileManager::scripts
QList< ScriptFile * > scripts() const
Definition: ScriptFileManager.cpp:68
ScriptFile
Definition: ScriptFile.h:44
ScriptFileManager::getFile
ScriptFile * getFile(const QString &path)
Definition: ScriptFileManager.cpp:39
ScriptFileManager::child
virtual AssetWrapper * child(int child)
Definition: ScriptFileManager.h:33
HookInformation
Definition: ScriptFile.h:23
ScriptFileManager::~ScriptFileManager
virtual ~ScriptFileManager()
Definition: ScriptFileManager.cpp:21
ScriptFileManager::childIndex
virtual int childIndex(AssetWrapper *child)
Definition: ScriptFileManager.h:34
ScriptFileManager::addHook
void addHook(const QString &file, HookInformation *hook)
Definition: ScriptFileManager.cpp:73