Skip to content

Commit

Permalink
Merge branch 'release/1.2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bam4d committed Sep 6, 2021
2 parents fc3e1bd + f21b66e commit ae199c1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. mac/linux/windows]
- Version [e.g. 1.2.7]
- Version [e.g. 1.2.8]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10.0)
project(Griddly VERSION 1.2.7)
project(Griddly VERSION 1.2.8)

set(BINARY ${CMAKE_PROJECT_NAME})

Expand Down
2 changes: 1 addition & 1 deletion bindings/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace griddly {

PYBIND11_MODULE(python_griddly, m) {
m.doc() = "Griddly python bindings";
m.attr("version") = "1.2.7";
m.attr("version") = "1.2.8";

#ifndef NDEBUG
spdlog::set_level(spdlog::level::debug);
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Chris Bamford'

# The full version, including alpha/beta/rc tags
release = '1.2.7'
release = '1.2.8'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def griddly_package_data(config='Debug'):

setup(
name='griddly',
version="1.2.7",
version="1.2.8",
author_email="[email protected]",
description="Griddly Python Libraries",
long_description=long_description,
Expand Down
5 changes: 3 additions & 2 deletions src/Griddly/Core/GDY/Objects/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ BehaviourFunction Object::instantiateBehaviour(std::string commandName, Behaviou

// reward the player that owns this particular object, otherwise warn
if (commandName == "reward") {
auto value = commandArguments["0"].as<int32_t>(0);
auto variablePointers = resolveVariables(commandArguments);
auto value = variablePointers["0"];
return [this, value](std::shared_ptr<Action> action) -> BehaviourResult {
// if the object has a player Id, the reward will be given to that object's player,
// otherwise the reward will be given to the player which has performed the action
Expand All @@ -222,7 +223,7 @@ BehaviourFunction Object::instantiateBehaviour(std::string commandName, Behaviou
}

// Find the player id of this object and give rewards to this player.
return {false, {{rewardPlayer, value}}};
return {false, {{rewardPlayer, value->resolve(action)}}};
};
}

Expand Down
15 changes: 15 additions & 0 deletions tests/src/Griddly/Core/GDY/Objects/ObjectTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,21 @@ TEST(ObjectTest, command_reward) {
verifyMocks(mockActionPtr);
}

TEST(ObjectTest, command_reward_variable) {
auto srcObjectPtr = setupObject(1, "srcObject", {{"ten", _V(10)}});
auto dstObjectPtr = setupObject(3, "dstObject", {{"minusten", _V(-10)}});
auto mockActionPtr = setupAction("action", srcObjectPtr, dstObjectPtr);

auto srcResult = addCommandsAndExecute(ActionBehaviourType::SOURCE, mockActionPtr, "reward", {{"0", _Y("ten")}}, srcObjectPtr, dstObjectPtr);
auto dstResult = addCommandsAndExecute(ActionBehaviourType::DESTINATION, mockActionPtr, "reward", {{"0", _Y("minusten")}}, srcObjectPtr, dstObjectPtr);

verifyCommandResult(srcResult, false, {{1, 10}});
verifyCommandResult(dstResult, false, {{3, -10}});

verifyMocks(mockActionPtr);
}


TEST(ObjectTest, command_reward_default_to_action_player_id) {
auto srcObjectPtr = setupObject(0, "srcObject", {});
auto dstObjectPtr = setupObject(0, "dstObject", {});
Expand Down

0 comments on commit ae199c1

Please sign in to comment.