xoreos  0.0.5
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 
28 
29 #include "src/engines/nwn2/game.h"
31 
33 
34 namespace Engines {
35 
36 namespace NWN2 {
37 
43 
45  ctx.getReturn() = 0;
46 }
47 
49  ctx.getReturn() = 1;
50 }
51 
53  ctx.getReturn() = _game->getCampaign().getVariable(ctx.getParams()[0].getString(), kTypeInt).getInt();
54 }
55 
57  ctx.getReturn() = _game->getCampaign().getVariable(ctx.getParams()[0].getString(), kTypeInt).getInt() != 0;
58 }
59 
61  ctx.getReturn() = _game->getCampaign().getVariable(ctx.getParams()[0].getString(), kTypeString).getString();
62 }
63 
65  ctx.getReturn() = _game->getCampaign().getVariable(ctx.getParams()[0].getString(), kTypeFloat).getFloat();
66 }
67 
69  _game->getCampaign().setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt());
70 }
71 
73  _game->getCampaign().setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt() != 0);
74 }
75 
77  _game->getCampaign().setVariable(ctx.getParams()[0].getString(), ctx.getParams()[1].getString());
78 }
79 
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
void setGlobalInt(Aurora::NWScript::FunctionContext &ctx)
The context handling the gameplay in Neverwinter Nights 2.
void getIsSinglePlayer(Aurora::NWScript::FunctionContext &ctx)
void getOnePartyMode(Aurora::NWScript::FunctionContext &ctx)
The context holding a Neverwinter Nights 2 campaign.
void getGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Context of an NWScript function.
void getGlobalString(Aurora::NWScript::FunctionContext &ctx)
void setGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Neverwinter Nights 2 engine functions.
void setGlobalBool(Aurora::NWScript::FunctionContext &ctx)
Utility templates and functions.
Variable & getVariable(const Common::UString &var, Type type=kTypeVoid)
void getGlobalBool(Aurora::NWScript::FunctionContext &ctx)
void getGlobalInt(Aurora::NWScript::FunctionContext &ctx)
void setGlobalString(Aurora::NWScript::FunctionContext &ctx)
Campaign & getCampaign()
Return the campaign context.
Definition: game.cpp:58
void setVariable(const Common::UString &var, const Variable &value)