xoreos  0.0.5
container.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_DRAGONAGE_SCRIPT_CONTAINER_H
26 #define ENGINES_DRAGONAGE_SCRIPT_CONTAINER_H
27 
28 #include <map>
29 
30 #include "src/common/types.h"
31 #include "src/common/ustring.h"
32 
33 #include "src/aurora/types.h"
34 
36 
38 
39 namespace Aurora {
40  namespace NWScript {
41  class Object;
42  struct ScriptState;
43  }
44 }
45 namespace Engines {
46 
47 namespace DragonAge {
48 
49 class Event;
50 
52 public:
55 
56  const Common::UString &getScript() const;
57  bool hasScript() const;
58 
60  void enableEvent(EventType event, bool enabled);
62  void enableEvents(bool enabled);
63 
64  bool runScript(EventType event,
67 
68  bool runScript(Event &event);
69 
70  static bool runScript(const Common::UString &script, EventType event,
73  static bool runScript(const Common::UString &script, EventType event,
74  const Aurora::NWScript::ScriptState &state,
77 
78  static bool runScript(const Common::UString &script, Event &event);
79  static bool runScript(const Common::UString &script, Event &event,
80  const Aurora::NWScript::ScriptState &state);
81 
82 
83 protected:
84  void clearScript();
85 
86  void readScript(const Aurora::GFF3Struct &gff);
87  void readScript(const Aurora::GFF4Struct &gff);
88 
89 private:
91 
92  std::map<EventType, bool> _eventEnabled;
93 };
94 
95 } // End of namespace DragonAge
96 
97 } // End of namespace Engines
98 
99 #endif // ENGINES_DRAGONAGE_SCRIPT_CONTAINER_H
A class holding an UTF-8 string.
Definition: ustring.h:48
void enableEvent(EventType event, bool enabled)
Enable/Disable the handling of a specific event.
Definition: container.cpp:72
SDL_Event Event
Definition: types.h:42
std::map< EventType, bool > _eventEnabled
Definition: container.h:92
Low-level type definitions to handle fixed width types portably.
Unicode string handling.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
Reference to an NWScript object.
A struct within a GFF3.
Definition: gff3file.h:164
Basic Dragon Age: Origins type definitions.
void readScript(const Aurora::GFF3Struct &gff)
Definition: container.cpp:90
const Common::UString & getScript() const
Definition: container.cpp:64
bool runScript(EventType event, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
Definition: container.cpp:104
void enableEvents(bool enabled)
Enable/Disable the handling of all events.
Definition: container.cpp:76
EventType
Types for script events.
Definition: types.h:110