Skip to content

Commit

Permalink
NWN2: Create AddRosterMemberByTemplate script function
Browse files Browse the repository at this point in the history
This eliminates multiple startup warning messages about a missing
script function.
  • Loading branch information
rjshae authored and DrMcCoy committed Feb 10, 2019
1 parent e09df62 commit dc6d13a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/engines/nwn2/script/function_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ const Functions::FunctionPointer Functions::kFunctionPointers[] = {
{ 819, "EffectBreakEnchantment" , 0 },
{ 820, "GetFirstEnteringPC" , 0 },
{ 821, "GetNextEnteringPC" , 0 },
{ 822, "AddRosterMemberByTemplate" , 0 },
{ 822, "AddRosterMemberByTemplate" , &Functions::addRosterMemberByTemplate },
{ 823, "AddRosterMemberByCharacter" , 0 },
{ 824, "RemoveRosterMember" , 0 },
{ 825, "GetIsRosterMemberAvailable" , &Functions::getIsRosterMemberAvailable },
Expand Down
2 changes: 2 additions & 0 deletions src/engines/nwn2/script/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ class Functions {
void getIsRosterMemberAvailable (Aurora::NWScript::FunctionContext &ctx);
void getIsRosterMemberCampaignNPC(Aurora::NWScript::FunctionContext &ctx);
void getIsRosterMemberSelectable (Aurora::NWScript::FunctionContext &ctx);

void addRosterMemberByTemplate(Aurora::NWScript::FunctionContext &ctx);
// '---

// .--- Actions, functions_action.cpp
Expand Down
6 changes: 6 additions & 0 deletions src/engines/nwn2/script/functions_roster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ namespace Engines {

namespace NWN2 {

void Functions::addRosterMemberByTemplate(Aurora::NWScript::FunctionContext &ctx) {
const Common::UString &name = ctx.getParams()[0].getString();
const Common::UString &cTemplate = ctx.getParams()[1].getString();
ctx.getReturn() = _game->getModule().getRoster().addRosterMemberByTemplate(name, cTemplate);
}

void Functions::getFirstRosterMember(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = _game->getModule().getRoster().getFirstRosterMember();
}
Expand Down

0 comments on commit dc6d13a

Please sign in to comment.