Debian Codegraph @

src/gengine/Scripter.cpp

raw
1 /*
2 * Copyright (C) 2004 Ivo Danihelka ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9 #include "Scripter.h"
10
11 #include "ScriptState.h"
12
13 #include "def-script.h"
14
15 //-----------------------------------------------------------------
16 Scripter::Scripter()
17 {
18 m_script = new ScriptState();
19 m_script->registerLeader(this);
20
21 m_script->registerFunc("file_include", script_file_include);
22 m_script->registerFunc("file_exists", script_file_exists);
23 }
24 //-----------------------------------------------------------------
25 Scripter::~Scripter()
26 {
27 delete m_script;
28 }
29 //-----------------------------------------------------------------
30 /**
31 * Include this script file.
32 */
33 void
34 Scripter::scriptInclude(const Path &filename)
35 {
36 m_script->doFile(filename);
37 }
38 //-----------------------------------------------------------------
39 /**
40 * Run this command.
41 */
42 void
43 Scripter::scriptDo(const std::string &input)
44 {
45 m_script->doString(input);
46 }
47