Skip to content

Commit

Permalink
3.6.36
Browse files Browse the repository at this point in the history
  • Loading branch information
jonygli committed Aug 3, 2017
1 parent 3bb7f13 commit 94d38ca
Show file tree
Hide file tree
Showing 31 changed files with 99 additions and 214 deletions.
2 changes: 1 addition & 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.35)
set (BEHAVIAC_PACKAGE_VERSION 3.6.36)

#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
3 changes: 3 additions & 0 deletions history.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2017-08-03 3.6.36
fix a bug of accessing task params when calling a sub tree

2017-7-11 3.6.35
Improve the C++ types generation.
Fix a bug of time edition of the Wait node.
Expand Down
9 changes: 5 additions & 4 deletions inc/behaviac/agent/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,6 @@ namespace behaviac {
static bool VectorContains(IList& vector, const System::Object& element);
static void VectorClear(IList& vector);

void CurrentBT(BehaviorTreeTask* value) {
m_currentBT = value;
m_excutingTreeTask = m_currentBT;
}

protected:
Agent();
Expand Down Expand Up @@ -484,6 +480,11 @@ namespace behaviac {

void _btsetcurrent(const char* relativePath, TriggerMode triggerMode = TM_Transfer, bool bByEvent = false);

void _setCurrentTreeTask(BehaviorTreeTask* value) {
m_currentBT = value;
//m_excutingTreeTask = m_currentBT;
}

void btunload_pars(const BehaviorTree* bt);

void LoadFromXML(const behaviac::XmlConstNodeRef& xmlNode);
Expand Down
2 changes: 1 addition & 1 deletion inc/behaviac/behaviortree/behaviortree_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ namespace behaviac {

private:
bool load(const char* file);

BehaviorTreeTask* m_lastTreeTask;
};
} // namespace behaviac

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.35"
#define BEHAVIAC_VERSION_STRING "3.6.36"

18 changes: 11 additions & 7 deletions integration/demo_running/behaviac/Agent/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private List<BehaviorTreeStackItem_t> BTStack
}

private BehaviorTreeTask m_currentBT;
public BehaviorTreeTask CurrentBT
public BehaviorTreeTask CurrentTreeTask
{
get
{
Expand All @@ -253,7 +253,7 @@ public BehaviorTreeTask CurrentBT
private set
{
m_currentBT = value;
m_excutingTreeTask = m_currentBT;
//m_excutingTreeTask = m_currentBT;
}
}

Expand Down Expand Up @@ -1544,7 +1544,7 @@ private void _btsetcurrent(string relativePath, TriggerMode triggerMode, bool bB
this.BehaviorTreeTasks.Add(pTask);
}

this.CurrentBT = pTask;
this.CurrentTreeTask = pTask;

//string pThisTree = this.m_currentBT.GetName();
//this.LogJumpTree(pThisTree);
Expand All @@ -1569,7 +1569,7 @@ private EBTStatus btexec_()
//get the last one
BehaviorTreeStackItem_t lastOne = this.BTStack[this.BTStack.Count - 1];

this.CurrentBT = lastOne.bt;
this.CurrentTreeTask = lastOne.bt;
this.BTStack.RemoveAt(this.BTStack.Count - 1);

bool bExecCurrent = false;
Expand Down Expand Up @@ -1613,6 +1613,10 @@ private EBTStatus btexec_()
}
}

if (s != EBTStatus.BT_RUNNING) {
this.ExcutingTreeTask = null;
}

return s;
}
else
Expand Down Expand Up @@ -1711,7 +1715,7 @@ public void btunload(string relativePath)
BehaviorTree bt = btNode as BehaviorTree;
this.btunload_pars(bt);

this.CurrentBT = null;
this.CurrentTreeTask = null;
}

//remove it from stack
Expand Down Expand Up @@ -1798,15 +1802,15 @@ public void btunloadall()
this.BehaviorTreeTasks.Clear();

//just clear the name vector, don't unload it from cache
this.CurrentBT = null;
this.CurrentTreeTask = null;
this.BTStack.Clear();

this.Variables.Unload();
}

public void btreloadall()
{
this.CurrentBT = null;
this.CurrentTreeTask = null;
this.BTStack.Clear();

if (this.m_behaviorTreeTasks != null)
Expand Down
2 changes: 1 addition & 1 deletion integration/demo_running/behaviac/Base/LogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public void Log(Agent pAgent, string btMsg, long time)
//string agentClassName = pAgent.GetObjectTypeName();
//string agentInstanceName = pAgent.GetName();

BehaviorTreeTask bt = !System.Object.ReferenceEquals(pAgent, null) ? pAgent.CurrentBT : null;
BehaviorTreeTask bt = !System.Object.ReferenceEquals(pAgent, null) ? pAgent.CurrentTreeTask : null;

string btName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public void switchTo(Agent pAgent, Dictionary<uint, IInstantiatedVariable> event

pAgent.bteventtree(pAgent, this.m_referencedBehaviorPath, tm);

Debug.Check(pAgent.CurrentBT != null);
pAgent.CurrentBT.AddVariables(eventParams);
Debug.Check(pAgent.CurrentTreeTask != null);
pAgent.CurrentTreeTask.AddVariables(eventParams);

pAgent.btexec();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ called when the child's tick returns success or failure.
public class BehaviorTreeTask : SingeChildTask
{
private Dictionary<uint, IInstantiatedVariable> m_localVars = new Dictionary<uint, IInstantiatedVariable>();
private BehaviorTreeTask m_excutingTreeTask = null;
public Dictionary<uint, IInstantiatedVariable> LocalVars
{
get
Expand Down Expand Up @@ -1462,7 +1463,7 @@ protected override bool onenter(Agent pAgent)

protected override void onexit(Agent pAgent, EBTStatus s)
{
pAgent.ExcutingTreeTask = null;
pAgent.ExcutingTreeTask = this.m_excutingTreeTask;
pAgent.LogReturnTree(this.GetName());

base.onexit(pAgent, s);
Expand Down Expand Up @@ -1495,6 +1496,7 @@ protected override EBTStatus update_current(Agent pAgent, EBTStatus childStatus)
Debug.Check(this.m_node != null);
Debug.Check(this.m_node is BehaviorTree);

this.m_excutingTreeTask = pAgent.ExcutingTreeTask;
pAgent.ExcutingTreeTask = this;

BehaviorTree tree = (BehaviorTree)this.m_node;
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.35
3.6.36
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void test_decoration_loop_0()
Assert.AreEqual(behaviac.EBTStatus.BT_RUNNING, status);
Assert.AreEqual(0, testAgent.testVar_0);

behaviac.BehaviorTreeTask btTask = testAgent.CurrentBT;
behaviac.BehaviorTreeTask btTask = testAgent.CurrentTreeTask;
Assert.AreNotEqual(null, btTask);

List<behaviac.BehaviorTask> nodes = btTask.GetRunningNodes(false);
Expand Down
18 changes: 11 additions & 7 deletions integration/unity/Assets/Scripts/behaviac/runtime/Agent/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private List<BehaviorTreeStackItem_t> BTStack
}

private BehaviorTreeTask m_currentBT;
public BehaviorTreeTask CurrentBT
public BehaviorTreeTask CurrentTreeTask
{
get
{
Expand All @@ -253,7 +253,7 @@ public BehaviorTreeTask CurrentBT
private set
{
m_currentBT = value;
m_excutingTreeTask = m_currentBT;
//m_excutingTreeTask = m_currentBT;
}
}

Expand Down Expand Up @@ -1544,7 +1544,7 @@ private void _btsetcurrent(string relativePath, TriggerMode triggerMode, bool bB
this.BehaviorTreeTasks.Add(pTask);
}

this.CurrentBT = pTask;
this.CurrentTreeTask = pTask;

//string pThisTree = this.m_currentBT.GetName();
//this.LogJumpTree(pThisTree);
Expand All @@ -1569,7 +1569,7 @@ private EBTStatus btexec_()
//get the last one
BehaviorTreeStackItem_t lastOne = this.BTStack[this.BTStack.Count - 1];

this.CurrentBT = lastOne.bt;
this.CurrentTreeTask = lastOne.bt;
this.BTStack.RemoveAt(this.BTStack.Count - 1);

bool bExecCurrent = false;
Expand Down Expand Up @@ -1613,6 +1613,10 @@ private EBTStatus btexec_()
}
}

if (s != EBTStatus.BT_RUNNING) {
this.ExcutingTreeTask = null;
}

return s;
}
else
Expand Down Expand Up @@ -1711,7 +1715,7 @@ public void btunload(string relativePath)
BehaviorTree bt = btNode as BehaviorTree;
this.btunload_pars(bt);

this.CurrentBT = null;
this.CurrentTreeTask = null;
}

//remove it from stack
Expand Down Expand Up @@ -1798,15 +1802,15 @@ public void btunloadall()
this.BehaviorTreeTasks.Clear();

//just clear the name vector, don't unload it from cache
this.CurrentBT = null;
this.CurrentTreeTask = null;
this.BTStack.Clear();

this.Variables.Unload();
}

public void btreloadall()
{
this.CurrentBT = null;
this.CurrentTreeTask = null;
this.BTStack.Clear();

if (this.m_behaviorTreeTasks != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public void Log(Agent pAgent, string btMsg, long time)
//string agentClassName = pAgent.GetObjectTypeName();
//string agentInstanceName = pAgent.GetName();

BehaviorTreeTask bt = !System.Object.ReferenceEquals(pAgent, null) ? pAgent.CurrentBT : null;
BehaviorTreeTask bt = !System.Object.ReferenceEquals(pAgent, null) ? pAgent.CurrentTreeTask : null;

string btName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public void switchTo(Agent pAgent, Dictionary<uint, IInstantiatedVariable> event

pAgent.bteventtree(pAgent, this.m_referencedBehaviorPath, tm);

Debug.Check(pAgent.CurrentBT != null);
pAgent.CurrentBT.AddVariables(eventParams);
Debug.Check(pAgent.CurrentTreeTask != null);
pAgent.CurrentTreeTask.AddVariables(eventParams);

pAgent.btexec();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ called when the child's tick returns success or failure.
public class BehaviorTreeTask : SingeChildTask
{
private Dictionary<uint, IInstantiatedVariable> m_localVars = new Dictionary<uint, IInstantiatedVariable>();
private BehaviorTreeTask m_excutingTreeTask = null;
public Dictionary<uint, IInstantiatedVariable> LocalVars
{
get
Expand Down Expand Up @@ -1462,7 +1463,7 @@ protected override bool onenter(Agent pAgent)

protected override void onexit(Agent pAgent, EBTStatus s)
{
pAgent.ExcutingTreeTask = null;
pAgent.ExcutingTreeTask = this.m_excutingTreeTask;
pAgent.LogReturnTree(this.GetName());

base.onexit(pAgent, s);
Expand Down Expand Up @@ -1495,6 +1496,7 @@ protected override EBTStatus update_current(Agent pAgent, EBTStatus childStatus)
Debug.Check(this.m_node != null);
Debug.Check(this.m_node is BehaviorTree);

this.m_excutingTreeTask = pAgent.ExcutingTreeTask;
pAgent.ExcutingTreeTask = this;

BehaviorTree tree = (BehaviorTree)this.m_node;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.35
3.6.36
Loading

0 comments on commit 94d38ca

Please sign in to comment.