xoreos
0.0.5
src
engines
nwn2
script
functions_campaign.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
27
#include "
src/aurora/nwscript/functioncontext.h
"
28
29
#include "
src/engines/nwn2/game.h
"
30
#include "
src/engines/nwn2/campaign.h
"
31
32
#include "
src/engines/nwn2/script/functions.h
"
33
34
namespace
Engines
{
35
36
namespace
NWN2 {
37
38
using
Aurora::NWScript::kTypeInt
;
39
using
Aurora::NWScript::kTypeFloat
;
40
using
Aurora::NWScript::kTypeString
;
41
using
Aurora::NWScript::kTypeObject
;
42
using
Aurora::NWScript::kTypeScriptState
;
43
44
void
Functions::getOnePartyMode
(
Aurora::NWScript::FunctionContext
&ctx) {
45
ctx.
getReturn
() = 0;
46
}
47
48
void
Functions::getIsSinglePlayer
(
Aurora::NWScript::FunctionContext
&ctx) {
49
ctx.
getReturn
() = 1;
50
}
51
52
void
Functions::getGlobalInt
(
Aurora::NWScript::FunctionContext
&ctx) {
53
ctx.
getReturn
() =
_game
->
getCampaign
().
getVariable
(ctx.
getParams
()[0].getString(),
kTypeInt
).getInt();
54
}
55
56
void
Functions::getGlobalBool
(
Aurora::NWScript::FunctionContext
&ctx) {
57
ctx.
getReturn
() =
_game
->
getCampaign
().
getVariable
(ctx.
getParams
()[0].getString(),
kTypeInt
).getInt() != 0;
58
}
59
60
void
Functions::getGlobalString
(
Aurora::NWScript::FunctionContext
&ctx) {
61
ctx.
getReturn
() =
_game
->
getCampaign
().
getVariable
(ctx.
getParams
()[0].getString(),
kTypeString
).getString();
62
}
63
64
void
Functions::getGlobalFloat
(
Aurora::NWScript::FunctionContext
&ctx) {
65
ctx.
getReturn
() =
_game
->
getCampaign
().
getVariable
(ctx.
getParams
()[0].getString(),
kTypeFloat
).getFloat();
66
}
67
68
void
Functions::setGlobalInt
(
Aurora::NWScript::FunctionContext
&ctx) {
69
_game
->
getCampaign
().
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getInt());
70
}
71
72
void
Functions::setGlobalBool
(
Aurora::NWScript::FunctionContext
&ctx) {
73
_game
->
getCampaign
().
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getInt() != 0);
74
}
75
76
void
Functions::setGlobalString
(
Aurora::NWScript::FunctionContext
&ctx) {
77
_game
->
getCampaign
().
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getString());
78
}
79
80
void
Functions::setGlobalFloat
(
Aurora::NWScript::FunctionContext
&ctx) {
81
_game
->
getCampaign
().
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getFloat());
82
}
83
84
}
// End of namespace NWN2
85
86
}
// End of namespace Engines
Engines::NWN2::Functions::setGlobalInt
void setGlobalInt(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:68
game.h
The context handling the gameplay in Neverwinter Nights 2.
Engines::NWN2::Functions::getIsSinglePlayer
void getIsSinglePlayer(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:48
Engines::NWN2::Functions::getOnePartyMode
void getOnePartyMode(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:44
campaign.h
The context holding a Neverwinter Nights 2 campaign.
Engines::NWN2::Functions::getGlobalFloat
void getGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:64
functioncontext.h
Context of an NWScript function.
Aurora::NWScript::kTypeInt
Definition:
types.h:38
Engines::NWN2::Functions::getGlobalString
void getGlobalString(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:60
Aurora::NWScript::kTypeString
Definition:
types.h:40
Engines::NWN2::Functions::setGlobalFloat
void setGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:80
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
functions.h
Neverwinter Nights 2 engine functions.
Engines::NWN2::Functions::setGlobalBool
void setGlobalBool(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:72
util.h
Utility templates and functions.
Engines::NWN2::Functions::_game
Game * _game
Definition:
functions.h:75
Aurora::NWScript::VariableContainer::getVariable
Variable & getVariable(const Common::UString &var, Type type=kTypeVoid)
Definition:
variablecontainer.cpp:43
Engines
Definition:
console.cpp:69
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
Engines::NWN2::Functions::getGlobalBool
void getGlobalBool(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:56
Engines::NWN2::Functions::getGlobalInt
void getGlobalInt(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:52
Aurora::ActionScript::kTypeString
Definition:
types.h:38
Aurora::NWScript::kTypeObject
Definition:
types.h:41
Engines::NWN2::Functions::setGlobalString
void setGlobalString(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_campaign.cpp:76
Engines::NWN2::Game::getCampaign
Campaign & getCampaign()
Return the campaign context.
Definition:
game.cpp:58
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Aurora::NWScript::VariableContainer::setVariable
void setVariable(const Common::UString &var, const Variable &value)
Definition:
variablecontainer.cpp:64
Aurora::NWScript::kTypeFloat
Definition:
types.h:39
Aurora::NWScript::kTypeScriptState
"action".
Definition:
types.h:44
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14