xoreos
0.0.5
src
engines
kotor
script
functions_global.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/ustring.h
"
26
27
#include "
src/aurora/nwscript/functioncontext.h
"
28
29
#include "
src/engines/kotor/game.h
"
30
#include "
src/engines/kotor/module.h
"
31
32
#include "
src/engines/kotor/script/functions.h
"
33
34
namespace
Engines
{
35
36
namespace
KotOR {
37
38
void
Functions::getGlobalBoolean
(
Aurora::NWScript::FunctionContext
&ctx) {
39
Common::UString
id
= ctx.
getParams
()[0].getString();
40
41
ctx.
getReturn
() =
_game
->
getModule
().
getGlobalBoolean
(
id
);
42
}
43
44
void
Functions::setGlobalBoolean
(
Aurora::NWScript::FunctionContext
&ctx) {
45
Common::UString
id
= ctx.
getParams
()[0].getString();
46
bool
value = ctx.
getParams
()[1].getInt() != 0;
47
48
_game
->
getModule
().
setGlobalBoolean
(
id
, value);
49
}
50
51
void
Functions::getGlobalNumber
(
Aurora::NWScript::FunctionContext
&ctx) {
52
Common::UString
id
= ctx.
getParams
()[0].getString();
53
54
ctx.
getReturn
() =
_game
->
getModule
().
getGlobalNumber
(
id
);
55
}
56
57
void
Functions::setGlobalNumber
(
Aurora::NWScript::FunctionContext
&ctx) {
58
Common::UString
id
= ctx.
getParams
()[0].getString();
59
int
value = ctx.
getParams
()[1].getInt();
60
61
_game
->
getModule
().
setGlobalNumber
(
id
, value);
62
}
63
64
}
// End of namespace KotOR
65
66
}
// End of namespace Engines
Engines::KotOR::Module::setGlobalNumber
void setGlobalNumber(const Common::UString &id, int value)
Get a global number.
Definition:
module.cpp:887
Common::UString
A class holding an UTF-8 string.
Definition:
ustring.h:48
functioncontext.h
Context of an NWScript function.
Engines::KotOR::Functions::getGlobalBoolean
void getGlobalBoolean(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_global.cpp:38
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
Engines::KotOR::Functions::setGlobalBoolean
void setGlobalBoolean(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_global.cpp:44
game.h
The context handling the gameplay in Star Wars: Knights of the Old Republic.
Engines::KotOR::Functions::getGlobalNumber
void getGlobalNumber(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_global.cpp:51
Engines
Definition:
console.cpp:69
functions.h
Star Wars: Knights of the Old Republic engine functions.
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
ustring.h
Unicode string handling.
Engines::KotOR::Module::getGlobalBoolean
bool getGlobalBoolean(const Common::UString &id) const
Get a global boolean.
Definition:
module.cpp:879
Engines::KotOR::Game::getModule
Module & getModule()
Return the module context.
Definition:
game.cpp:65
Engines::KotOR::Module::setGlobalBoolean
void setGlobalBoolean(const Common::UString &id, bool value)
Set a global boolean.
Definition:
module.cpp:875
Engines::KotOR::Functions::_game
Game * _game
Definition:
functions.h:76
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
module.h
The context needed to run a Star Wars: Knights of the Old Republic module.
Engines::KotOR::Module::getGlobalNumber
int getGlobalNumber(const Common::UString &id) const
Set a global number.
Definition:
module.cpp:891
Engines::KotOR::Functions::setGlobalNumber
void setGlobalNumber(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_global.cpp:57
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14