xoreos
0.0.5
src
engines
witcher
nwscript
functions_situated.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/aurora/nwscript/functioncontext.h
"
26
27
#include "
src/engines/witcher/objectcontainer.h
"
28
#include "
src/engines/witcher/object.h
"
29
#include "
src/engines/witcher/situated.h
"
30
31
#include "
src/engines/witcher/nwscript/functions.h
"
32
33
namespace
Engines
{
34
35
namespace
Witcher {
36
37
void
Functions::getLocked
(
Aurora::NWScript::FunctionContext
&ctx) {
38
Situated
*situated =
Witcher::ObjectContainer::toSituated
(
getParamObject
(ctx, 0));
39
40
ctx.
getReturn
() = situated ? situated->
isLocked
() : 0;
41
}
42
43
void
Functions::setLocked
(
Aurora::NWScript::FunctionContext
&ctx) {
44
Situated
*situated =
Witcher::ObjectContainer::toSituated
(
getParamObject
(ctx, 0));
45
if
(situated)
46
situated->
setLocked
(ctx.
getParams
()[1].getInt() != 0);
47
}
48
49
void
Functions::getIsOpen
(
Aurora::NWScript::FunctionContext
&ctx) {
50
Situated
*situated =
Witcher::ObjectContainer::toSituated
(
getParamObject
(ctx, 0));
51
52
ctx.
getReturn
() = situated ? situated->
isOpen
() : 0;
53
}
54
55
void
Functions::getLastOpenedBy
(
Aurora::NWScript::FunctionContext
&ctx) {
56
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) 0;
57
58
Situated
*situated =
Witcher::ObjectContainer::toSituated
(ctx.
getCaller
());
59
if
(!situated)
60
return
;
61
62
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) situated->
getLastOpenedBy
();
63
}
64
65
void
Functions::getLastClosedBy
(
Aurora::NWScript::FunctionContext
&ctx) {
66
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) 0;
67
68
Situated
*situated =
Witcher::ObjectContainer::toSituated
(ctx.
getCaller
());
69
if
(!situated)
70
return
;
71
72
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) situated->
getLastClosedBy
();
73
}
74
75
void
Functions::getLastUsedBy
(
Aurora::NWScript::FunctionContext
&ctx) {
76
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) 0;
77
78
Situated
*situated =
Witcher::ObjectContainer::toSituated
(ctx.
getCaller
());
79
if
(!situated)
80
return
;
81
82
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) situated->
getLastUsedBy
();
83
}
84
85
}
// End of namespace Witcher
86
87
}
// End of namespace Engines
Engines::Witcher::Situated
Witcher situated object.
Definition:
situated.h:41
Aurora::NWScript::Object
Definition:
object.h:37
objectcontainer.h
A container of The Witcher objects.
Engines::Witcher::Situated::isOpen
virtual bool isOpen() const =0
Is the situated object open?
Engines::Witcher::Functions::getLastUsedBy
void getLastUsedBy(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:75
functioncontext.h
Context of an NWScript function.
Engines::Witcher::Situated::getLastClosedBy
Object * getLastClosedBy() const
Return the object that last closed this situated object.
Definition:
situated.cpp:130
Engines::Witcher::Functions::getLastClosedBy
void getLastClosedBy(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:65
situated.h
A situated object in a The Witcher area.
Aurora::NWScript::FunctionContext::getCaller
Object * getCaller() const
Definition:
functioncontext.cpp:119
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
Engines::Witcher::Situated::getLastOpenedBy
Object * getLastOpenedBy() const
Return the object that last opened this situated object.
Definition:
situated.cpp:126
Engines::Witcher::Functions::getParamObject
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition:
functions.cpp:124
Engines::Witcher::Situated::setLocked
virtual void setLocked(bool locked)
Lock/Unlock the situated object.
Definition:
situated.cpp:122
object.h
An object in a The Witcher area.
Engines::Witcher::Functions::getIsOpen
void getIsOpen(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:49
Engines
Definition:
console.cpp:69
Engines::Witcher::Situated::isLocked
bool isLocked() const
Is the situated object locked?
Definition:
situated.cpp:118
Engines::Witcher::Functions::setLocked
void setLocked(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:43
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
Engines::Witcher::ObjectContainer::toSituated
static Situated * toSituated(Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:141
functions.h
The Witcher engine functions.
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Engines::Witcher::Situated::getLastUsedBy
Object * getLastUsedBy() const
Return the object that last used this situated object.
Definition:
situated.cpp:134
Engines::Witcher::Functions::getLastOpenedBy
void getLastOpenedBy(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:55
Engines::Witcher::Functions::getLocked
void getLocked(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:37
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14