Skip to content

Commit

Permalink
KOTORBASE: Add nwscript GetTag function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius committed Oct 12, 2019
1 parent 9000339 commit 1f546b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/engines/kotorbase/script/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class Functions {
void getMaxHitPoints(Aurora::NWScript::FunctionContext &ctx);
void getItemInSlot(Aurora::NWScript::FunctionContext &ctx);
void getNearestCreature(Aurora::NWScript::FunctionContext &ctx);
void getTag(Aurora::NWScript::FunctionContext &ctx);

void getArea (Aurora::NWScript::FunctionContext &ctx);
void getLocation(Aurora::NWScript::FunctionContext &ctx);
Expand Down
8 changes: 8 additions & 0 deletions src/engines/kotorbase/script/functions_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ void Functions::getNearestCreature(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = _game->getModule().getCurrentArea()->getNearestCreature(target, nth, criteria);
}

void Functions::getTag(Aurora::NWScript::FunctionContext &ctx) {
Object *object = ObjectContainer::toObject(ctx.getParams()[0].getObject());
if (!object)
throw Common::Exception("Functions::getTag() parameter is not an object");

ctx.getReturn() = object->getTag();
}

void Functions::destroyObject(Aurora::NWScript::FunctionContext &ctx) {
Object *object = ObjectContainer::toObject(ctx.getParams()[0].getObject());
if (object)
Expand Down

0 comments on commit 1f546b9

Please sign in to comment.