xoreos
0.0.5
src
engines
kotor2
script
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/kotor2/objectcontainer.h
"
28
#include "
src/engines/kotor2/object.h
"
29
#include "
src/engines/kotor2/situated.h
"
30
31
#include "
src/engines/kotor2/script/functions.h
"
32
33
namespace
Engines
{
34
35
namespace
KotOR2 {
36
37
void
Functions::getLocked
(
Aurora::NWScript::FunctionContext
&ctx) {
38
Situated
*situated =
KotOR2::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 =
KotOR2::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 =
KotOR2::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 =
KotOR2::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 =
KotOR2::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 =
KotOR2::ObjectContainer::toSituated
(ctx.
getCaller
());
79
if
(!situated)
80
return
;
81
82
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) situated->
getLastUsedBy
();
83
}
84
85
}
// End of namespace KotOR2
86
87
}
// End of namespace Engines
Aurora::NWScript::Object
Definition:
object.h:37
Engines::KotOR2::Situated::getLastOpenedBy
Object * getLastOpenedBy() const
Return the object that last opened this situated object.
Definition:
situated.cpp:105
Engines::KotOR2::Situated::getLastUsedBy
Object * getLastUsedBy() const
Return the object that last used this situated object.
Definition:
situated.cpp:113
objectcontainer.h
A container of Star Wars: Knights of the Old Republic II - The Sith Lords objects.
functioncontext.h
Context of an NWScript function.
Engines::KotOR2::Situated
Definition:
situated.h:44
Aurora::NWScript::FunctionContext::getCaller
Object * getCaller() const
Definition:
functioncontext.cpp:119
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
Engines::KotOR2::Functions::getLastClosedBy
void getLastClosedBy(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:65
object.h
An object in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
Engines::KotOR2::Functions::getIsOpen
void getIsOpen(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:49
functions.h
Star Wars: Knights of the Old Republic II - The Sith Lords engine functions.
Engines::KotOR2::Situated::isLocked
bool isLocked() const
Is the situated object locked?
Definition:
situated.cpp:97
Engines
Definition:
console.cpp:69
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
Engines::KotOR2::Functions::getLocked
void getLocked(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:37
situated.h
A situated object in a Star Wars: Knights of the Old Republic II - The Sith Lords area...
Engines::KotOR2::Functions::getParamObject
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition:
functions.cpp:115
Engines::KotOR2::Situated::isOpen
virtual bool isOpen() const =0
Is the situated object open?
Engines::KotOR2::Situated::setLocked
virtual void setLocked(bool locked)
Lock/Unlock the situated object.
Definition:
situated.cpp:101
Engines::KotOR2::Functions::setLocked
void setLocked(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:43
Engines::KotOR2::Functions::getLastUsedBy
void getLastUsedBy(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:75
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Engines::KotOR2::ObjectContainer::toSituated
static Situated * toSituated(Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:140
Engines::KotOR2::Functions::getLastOpenedBy
void getLastOpenedBy(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_situated.cpp:55
Engines::KotOR2::Situated::getLastClosedBy
Object * getLastClosedBy() const
Return the object that last closed this situated object.
Definition:
situated.cpp:109
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14