xoreos  0.0.5
functions_game.cpp
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 #include "src/common/util.h"
26 
28 
29 #include "src/engines/jade/game.h"
30 
32 
33 namespace Engines {
34 
35 namespace Jade {
36 
40 
42  ctx.getReturn() = _game->getVariable(ctx.getParams()[0].getString(), kTypeInt).getInt();
43 }
44 
46  ctx.getReturn() = _game->getVariable(ctx.getParams()[0].getString(), kTypeInt).getInt() != 0;
47 }
48 
50  ctx.getReturn() = _game->getVariable(ctx.getParams()[0].getString(), kTypeString).getString();
51 }
52 
54  ctx.getReturn() = _game->getVariable(ctx.getParams()[0].getString(), kTypeFloat).getFloat();
55 }
56 
58  _game->setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt());
59 }
60 
62  _game->setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt() != 0);
63 }
64 
66  _game->setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getString());
67 }
68 
70  _game->setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getFloat());
71 }
72 
73 } // End of namespace Jade
74 
75 } // End of namespace Engines
void getGlobalBool(Aurora::NWScript::FunctionContext &ctx)
Context of an NWScript function.
Jade Empire engine functions.
The context handling the gameplay in Jade Empire.
void setGlobalInt(Aurora::NWScript::FunctionContext &ctx)
void getGlobalString(Aurora::NWScript::FunctionContext &ctx)
void getGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Utility templates and functions.
Variable & getVariable(const Common::UString &var, Type type=kTypeVoid)
void setGlobalString(Aurora::NWScript::FunctionContext &ctx)
void setGlobalBool(Aurora::NWScript::FunctionContext &ctx)
void getGlobalInt(Aurora::NWScript::FunctionContext &ctx)
void setVariable(const Common::UString &var, const Variable &value)
void setGlobalFloat(Aurora::NWScript::FunctionContext &ctx)