Skip to content

Commit

Permalink
3.6.32
Browse files Browse the repository at this point in the history
  • Loading branch information
cainhuang committed Apr 26, 2017
1 parent d5e71e2 commit fc137b1
Show file tree
Hide file tree
Showing 153 changed files with 3,761 additions and 1,772 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cmake_minimum_required (VERSION 2.8)
# set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Profile" CACHE STRING "" FORCE)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)

set (BEHAVIAC_PACKAGE_VERSION 3.6.31)
set (BEHAVIAC_PACKAGE_VERSION 3.6.32)

#option( BUILD_SHARED_LIBS "set to OFF to build static libraries" ON )
SET(BUILD_SHARED_LIBS ON CACHE BOOL "set to OFF to build static libraries")
Expand Down Expand Up @@ -443,6 +443,7 @@ if (NOT BEHAVIAC_ANDROID_STUDIO)
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_10/cpp")
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_11/cpp")
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_12/cpp")
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_13/cpp")
else()
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_11/cpp")
endif()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/Tencent/behaviac/blob/master/license.txt)
[![Release Version](https://img.shields.io/badge/release-3.6.31-red.svg)](https://github.com/Tencent/behaviac/releases)
[![Release Version](https://img.shields.io/badge/release-3.6.32-red.svg)](https://github.com/Tencent/behaviac/releases)
[![Updates](https://img.shields.io/badge/Platform-%20iOS%20%7C%20OS%20X%20%7C%20Android%20%7C%20Windows%20%7C%20Linux%20-brightgreen.svg)](https://github.com/Tencent/behaviac/blob/master/history.txt)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/behaviac/pulls)

Expand Down
Binary file modified docs/behaviac.chm
Binary file not shown.
4 changes: 4 additions & 0 deletions history.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2017-4-26 3.6.32
Support resetting the children for the SelectorLoop node.
Add the tutorial_13.

2017-4-24 3.6.31
Fix a bug for generating the codes of the Task and Event.
Fix a bug for the hotreload of the meta file.
Expand Down
1 change: 1 addition & 0 deletions inc/behaviac/behaviac.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
#include "behaviac/behaviortree/behaviortree.h"
#include "behaviac/common/workspace.h"
#include "behaviac/common/file/filemanager.h"
#include "behaviac/common/randomgenerator/randomgenerator.h"

#endif // _BEHAVIAC_BEHAVIAC_H_
10 changes: 7 additions & 3 deletions inc/behaviac/behaviortree/nodes/composites/selectorloop.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ namespace behaviac {
virtual ~SelectorLoop();
virtual void load(int version, const char* agentType, const properties_t& properties);
virtual bool IsManagingChildrenAsSubTrees() const;

protected:
virtual bool IsValid(Agent* pAgent, BehaviorTask* pTask) const;

private:
virtual BehaviorTask* createTask() const;
//protected:
// Nodes* m_preconditions;
// Nodes* m_actions;

protected:
bool m_bResetChildren;

friend class SelectorLoopTask;
};

class BEHAVIAC_API SelectorLoopTask : public CompositeTask {
Expand Down
2 changes: 1 addition & 1 deletion inc/behaviac/common/_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#define BEHAVIAC_RELEASE 0
#endif

#define BEHAVIAC_VERSION_STRING "3.6.31"
#define BEHAVIAC_VERSION_STRING "3.6.32"

2 changes: 1 addition & 1 deletion inc/behaviac/common/randomgenerator/randomgenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#endif//#if _SYS_RANDOM_

namespace behaviac {
class RandomGenerator {
class BEHAVIAC_API RandomGenerator {
public:
static RandomGenerator* GetInstance() {
RandomGenerator* pRandomGenerator = RandomGenerator::_GetInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ namespace behaviac
{
public class SelectorLoop : BehaviorNode
{
protected bool m_bResetChildren = false;

protected override void load(int version, string agentType, List<property_t> properties)
{
base.load(version, agentType, properties);

for (int i = 0; i < properties.Count; ++i)
{
property_t p = properties[i];

if (p.name == "ResetChildren")
{
this.m_bResetChildren = (p.value == "true");
break;
}
}
}

public override bool IsValid(Agent pAgent, BehaviorTask pTask)
Expand All @@ -44,9 +57,6 @@ protected override BehaviorTask createTask()
return pTask;
}

//List<BehaviorNode> m_preconditions;
//List<BehaviorNode> m_actions;

// ============================================================================
/**
behavives similarly to SelectorTask, i.e. executing chidren until the first successful one.
Expand Down Expand Up @@ -157,15 +167,29 @@ protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
//clean up the current ticking action tree
if (index != (int) - 1)
{
if (this.m_activeChildIndex != CompositeTask.InvalidChildIndex &&
this.m_activeChildIndex != index)
if (this.m_activeChildIndex != CompositeTask.InvalidChildIndex)
{
WithPreconditionTask pCurrentSubTree = (WithPreconditionTask)this.m_children[this.m_activeChildIndex];
//BehaviorTask action = pCurrentSubTree.ActionNode;
pCurrentSubTree.abort(pAgent);
bool abortChild = (this.m_activeChildIndex != index);
if (!abortChild)
{
SelectorLoop pSelectorLoop = (SelectorLoop)(this.GetNode());
Debug.Check(pSelectorLoop != null);

if (pSelectorLoop != null)
{
abortChild = pSelectorLoop.m_bResetChildren;
}
}

if (abortChild)
{
WithPreconditionTask pCurrentSubTree = (WithPreconditionTask)this.m_children[this.m_activeChildIndex];
//BehaviorTask action = pCurrentSubTree.ActionNode;
pCurrentSubTree.abort(pAgent);

//don't set it here
//this.m_activeChildIndex = index;
//don't set it here
//this.m_activeChildIndex = index;
}
}

for (int i = index; i < this.m_children.Count; ++i)
Expand Down
2 changes: 1 addition & 1 deletion integration/demo_running/behaviac/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.31
3.6.32
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<property DecorateWhenChildEnds="true" />
<property DoneWithinFrame="false" />
<node class="SelectorLoop" id="6">
<property ResetChildren="false" />
<node class="WithPrecondition" id="5">
<node class="Condition" id="13">
<property Operator="Equal" />
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<property DecorateWhenChildEnds="true" />
<property DoneWithinFrame="false" />
<node class="SelectorLoop" id="6">
<property ResetChildren="false" />
<node class="WithPrecondition" id="5">
<node class="Condition" id="13">
<property Operator="Equal" />
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--Source File: node_test\selector_loop_ut_0.xml-->
<behavior name="node_test/selector_loop_ut_0" agenttype="AgentNodeTest" version="5">
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="True" id="4" />
<node class="Action" id="5">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--Source File: node_test\selector_loop_ut_1.xml-->
<behavior name="node_test/selector_loop_ut_1" agenttype="AgentNodeTest" version="5">
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="True" id="4" />
<node class="Action" id="5">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--Source File: node_test\selector_loop_ut_2.xml-->
<behavior name="node_test/selector_loop_ut_2" agenttype="AgentNodeTest" version="5">
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="True" id="4" />
<node class="Action" id="5">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--Source File: node_test\selector_loop_ut_3.xml-->
<behavior name="node_test/selector_loop_ut_3" agenttype="AgentNodeTest" version="5">
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="False" id="4" />
<node class="Action" id="5">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--Source File: node_test\selector_loop_ut_4.xml-->
<behavior name="node_test/selector_loop_ut_4" agenttype="AgentNodeTest" version="5">
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="True" id="4" />
<node class="Action" id="5">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--Source File: node_test\selector_loop_ut_5.xml-->
<behavior name="node_test/selector_loop_ut_5" agenttype="AgentNodeTest" version="5">
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="False" id="4" />
<node class="Action" id="5">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<property DecorateWhenChildEnds="false" />
<property DoneWithinFrame="false" />
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="Condition" id="4">
<property Operator="Equal" />
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<property Phase="Success" />
</attachment>
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="Condition" id="4">
<property Operator="Equal" />
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<property Phase="Success" />
</attachment>
<node class="SelectorLoop" id="0">
<property ResetChildren="false" />
<node class="WithPrecondition" id="1">
<node class="Condition" id="4">
<property Operator="Equal" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ namespace behaviac
{
public class SelectorLoop : BehaviorNode
{
protected bool m_bResetChildren = false;

protected override void load(int version, string agentType, List<property_t> properties)
{
base.load(version, agentType, properties);

for (int i = 0; i < properties.Count; ++i)
{
property_t p = properties[i];

if (p.name == "ResetChildren")
{
this.m_bResetChildren = (p.value == "true");
break;
}
}
}

public override bool IsValid(Agent pAgent, BehaviorTask pTask)
Expand All @@ -44,9 +57,6 @@ protected override BehaviorTask createTask()
return pTask;
}

//List<BehaviorNode> m_preconditions;
//List<BehaviorNode> m_actions;

// ============================================================================
/**
behavives similarly to SelectorTask, i.e. executing chidren until the first successful one.
Expand Down Expand Up @@ -157,15 +167,29 @@ protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
//clean up the current ticking action tree
if (index != (int) - 1)
{
if (this.m_activeChildIndex != CompositeTask.InvalidChildIndex &&
this.m_activeChildIndex != index)
if (this.m_activeChildIndex != CompositeTask.InvalidChildIndex)
{
WithPreconditionTask pCurrentSubTree = (WithPreconditionTask)this.m_children[this.m_activeChildIndex];
//BehaviorTask action = pCurrentSubTree.ActionNode;
pCurrentSubTree.abort(pAgent);
bool abortChild = (this.m_activeChildIndex != index);
if (!abortChild)
{
SelectorLoop pSelectorLoop = (SelectorLoop)(this.GetNode());
Debug.Check(pSelectorLoop != null);

if (pSelectorLoop != null)
{
abortChild = pSelectorLoop.m_bResetChildren;
}
}

if (abortChild)
{
WithPreconditionTask pCurrentSubTree = (WithPreconditionTask)this.m_children[this.m_activeChildIndex];
//BehaviorTask action = pCurrentSubTree.ActionNode;
pCurrentSubTree.abort(pAgent);

//don't set it here
//this.m_activeChildIndex = index;
//don't set it here
//this.m_activeChildIndex = index;
}
}

for (int i = index; i < this.m_children.Count; ++i)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.31
3.6.32
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Behavior Version="5">
<Behavior Version="5" NoError="true">
<Node Class="Behaviac.Design.Nodes.Behavior" AgentType="AgentNodeTest" Domains="" Enable="true" HasOwnPrefabData="false" Id="-1" PrefabName="" PrefabNodeId="-1">
<Comment Background="NoColor" Text="" />
<DescriptorRefs value="0:" />
<Connector Identifier="GenericChildren">
<Node Class="PluginBehaviac.Nodes.SelectorLoop" Enable="true" HasOwnPrefabData="false" Id="0" PrefabName="" PrefabNodeId="-1">
<Node Class="PluginBehaviac.Nodes.SelectorLoop" Enable="true" HasOwnPrefabData="false" Id="0" PrefabName="" PrefabNodeId="-1" ResetChildren="false">
<Comment Background="NoColor" Text="" />
<Connector Identifier="GenericChildren">
<Node Class="PluginBehaviac.Nodes.WithPrecondition" Enable="true" HasOwnPrefabData="false" Id="1" PrefabName="" PrefabNodeId="-1">
Expand Down
Loading

0 comments on commit fc137b1

Please sign in to comment.