Skip to content

Commit

Permalink
Scripting|All Games: Querying the current game rules
Browse files Browse the repository at this point in the history
IssueID #2375
  • Loading branch information
skyjake committed Jun 24, 2020
1 parent d64f14e commit 1cf8a07
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions doomsday/apps/plugins/common/src/common.cpp
Expand Up @@ -22,6 +22,7 @@
#include "g_common.h"
#include "g_defs.h"
#include "g_update.h"
#include "gamesession.h"
#include "p_map.h"
#include "p_start.h"
#include "polyobjs.h"
Expand Down Expand Up @@ -220,13 +221,18 @@ static int playerNumberArgument(const de::Value &arg)
return plrNum;
}

static de::Value *Function_SetMessage(de::Context &, const de::Function::ArgumentValues &args)
static de::Value *Function_Game_SetMessage(de::Context &, const de::Function::ArgumentValues &args)
{
const int plrNum = playerNumberArgument(*args.at(1));
P_SetMessage(&players[plrNum], args.at(0)->asText().toLatin1());
return nullptr;
}

static de::Value *Function_Game_Rules(de::Context &, const de::Function::ArgumentValues &args)
{
return new de::RecordValue(gfw_Session()->rules().asRecord());
}

#if defined (__JHEXEN__)
static de::Value *Function_SetYellowMessage(de::Context &, const de::Function::ArgumentValues &args)
{
Expand Down Expand Up @@ -372,7 +378,8 @@ void Common_Load()
setMessageArgs["player"] = new NoneValue;

gameBindings->init(*gameModule)
<< DENG2_FUNC_DEFS(SetMessage, "setMessage", "message" << "player", setMessageArgs);
<< DENG2_FUNC_DEFS (Game_SetMessage, "setMessage", "message" << "player", setMessageArgs)
<< DENG2_FUNC_NOARG(Game_Rules, "rules");

#if defined(__JHEXEN__)
{
Expand Down

0 comments on commit 1cf8a07

Please sign in to comment.