Crossfire Server, Trunk
ScriptFile.cpp
Go to the documentation of this file.
1 #include "ScriptFile.h"
2 #include "CREMapInformation.h"
3 
4 ScriptFile::ScriptFile(AssetWrapper *parent, const QString& path) : AssetWrapper(parent, "Script") {
5  myPath = path;
6 }
7 
9 {
10  qDeleteAll(myHooks);
11 }
12 
14 {
15  myHooks.append(hook);
16 }
17 
19 {
20  foreach(HookInformation* hook, myHooks)
21  {
22  if (hook->map() == map)
23  {
24  return true;
25  }
26  }
27  return false;
28 }
29 
30 QList<HookInformation*> ScriptFile::hooks() const
31 {
32  return myHooks;
33 }
34 
35 const QString& ScriptFile::path() const
36 {
37  return myPath;
38 }
39 
41 {
42  QList<HookInformation*>::iterator hook = myHooks.begin();
43  while (hook != myHooks.end())
44  {
45  if ((*hook)->map() == map)
46  {
47  HookInformation* h = *hook;
48  hook = myHooks.erase(hook);
49  delete h;
50  }
51  else
52  {
53  hook++;
54  }
55  }
56  return myHooks.empty();
57 }
58 
59 HookInformation::HookInformation(CREMapInformation* map, int x, int y, const QString& itemName, const QString& pluginName, const QString& eventName)
60 {
61  myMap = map;
62  myX = x;
63  myY = y;
67 }
68 
70 {
71  return myMap;
72 }
73 
74 int HookInformation::x() const
75 {
76  return myX;
77 }
78 
79 int HookInformation::y() const
80 {
81  return myY;
82 }
83 
85 {
86  return myItemName;
87 }
88 
90 {
91  return myPluginName;
92 }
93 
95 {
96  return myEventName;
97 }
HookInformation::x
int x() const
Definition: ScriptFile.cpp:74
ScriptFile::removeMap
bool removeMap(CREMapInformation *map)
Definition: ScriptFile.cpp:40
diamondslots.x
x
Definition: diamondslots.py:15
CREMapInformation.h
HookInformation::myMap
CREMapInformation * myMap
Definition: ScriptFile.h:22
HookInformation::myItemName
QString myItemName
Definition: ScriptFile.h:25
HookInformation::map
const CREMapInformation * map() const
Definition: ScriptFile.cpp:69
python_event.path
path
Definition: python_event.py:11
ScriptFile::myHooks
QList< HookInformation * > myHooks
Definition: ScriptFile.h:55
ScriptFile::forMap
bool forMap(CREMapInformation *map) const
Definition: ScriptFile.cpp:18
HookInformation::itemName
QString itemName() const
Definition: ScriptFile.cpp:84
HookInformation::myY
int myY
Definition: ScriptFile.h:24
HookInformation::y
int y() const
Definition: ScriptFile.cpp:79
CREMapInformation
Definition: CREMapInformation.h:16
disinfect.map
map
Definition: disinfect.py:4
ScriptFile::path
const QString & path() const
Definition: ScriptFile.cpp:35
ScriptFile.h
AssetWrapper
Definition: AssetWrapper.h:11
HookInformation::myEventName
QString myEventName
Definition: ScriptFile.h:27
HookInformation::pluginName
QString pluginName() const
Definition: ScriptFile.cpp:89
ScriptFile::ScriptFile
ScriptFile(AssetWrapper *parent, const QString &path)
Definition: ScriptFile.cpp:4
HookInformation::HookInformation
HookInformation(CREMapInformation *map, int x, int y, const QString &itemName, const QString &pluginName, const QString &eventName)
Definition: ScriptFile.cpp:59
ScriptFile::addHook
void addHook(HookInformation *hook)
Definition: ScriptFile.cpp:13
diamondslots.y
y
Definition: diamondslots.py:16
HookInformation::myX
int myX
Definition: ScriptFile.h:23
HookInformation::myPluginName
QString myPluginName
Definition: ScriptFile.h:26
ScriptFile::myPath
QString myPath
Definition: ScriptFile.h:54
ScriptFile::hooks
QList< HookInformation * > hooks() const
Definition: ScriptFile.cpp:30
ScriptFile::~ScriptFile
virtual ~ScriptFile()
Definition: ScriptFile.cpp:8
HookInformation
Definition: ScriptFile.h:10
HookInformation::eventName
QString eventName() const
Definition: ScriptFile.cpp:94