Skip to content

Commit ec9e0c9

Browse files
committed
Update the version to 3.6.38
1 parent 8f314f7 commit ec9e0c9

File tree

27 files changed

+218
-178
lines changed

27 files changed

+218
-178
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cmake_minimum_required (VERSION 2.8)
3131
# set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Profile" CACHE STRING "" FORCE)
3232
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
3333

34-
set (BEHAVIAC_PACKAGE_VERSION 3.6.37)
34+
set (BEHAVIAC_PACKAGE_VERSION 3.6.38)
3535

3636
#option( BUILD_SHARED_LIBS "set to OFF to build static libraries" ON )
3737
SET(BUILD_SHARED_LIBS ON CACHE BOOL "set to OFF to build static libraries")

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/Tencent/behaviac/blob/master/license.txt)
2-
[![Release Version](https://img.shields.io/badge/release-3.6.37-red.svg)](https://github.com/Tencent/behaviac/releases)
2+
[![Release Version](https://img.shields.io/badge/release-3.6.38-red.svg)](https://github.com/Tencent/behaviac/releases)
33
[![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)
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/behaviac/pulls)
55

history.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2017-08-17 3.6.38
2+
Improve the GC for the C#.
3+
14
2017-08-08 3.6.37
25
Support generating the codes for initializing the member array.
36

inc/behaviac/common/_config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
#define BEHAVIAC_RELEASE 0
1212
#endif
1313

14-
#define BEHAVIAC_VERSION_STRING "3.6.37"
14+
#define BEHAVIAC_VERSION_STRING "3.6.38"
1515

integration/demo_running/behaviac/Agent/Agent.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,6 @@ public void LogVariables(bool bForce)
13651365
}
13661366
}
13671367
}
1368-
13691368
#endif
13701369
}
13711370

@@ -1375,9 +1374,11 @@ public void LogRunningNodes()
13751374
if (Config.IsLoggingOrSocketing && this.m_currentBT != null)
13761375
{
13771376
List<BehaviorTask> runningNodes = this.m_currentBT.GetRunningNodes(false);
1377+
var e = runningNodes.GetEnumerator();
13781378

1379-
foreach (BehaviorTask behaviorTask in runningNodes)
1379+
while (e.MoveNext())
13801380
{
1381+
BehaviorTask behaviorTask = e.Current;
13811382
string btStr = BehaviorTask.GetTickInfo(this, behaviorTask, "enter");
13821383

13831384
//empty btStr is for internal BehaviorTreeTask

integration/demo_running/behaviac/Base/Operation.cs

+33-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
22
// Tencent is pleased to support the open source community by making behaviac available.
33
//
44
// Copyright (C) 2015-2017 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1818,37 +1818,41 @@ public static EOperatorType ParseOperatorType(string operatorType)
18181818

18191819
public static bool Compare<T>(T left, T right, EOperatorType comparisonType)
18201820
{
1821-
bool bLeftNull = (left == null);
1822-
bool bRightNull = (right == null);
1823-
1824-
if (bLeftNull && bRightNull) // both are null
1825-
{
1826-
if (comparisonType == EOperatorType.E_EQUAL)
1827-
{
1828-
return true;
1829-
}
1830-
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1831-
{
1832-
return false;
1833-
}
1834-
else
1835-
{
1836-
Debug.Check(false);
1837-
}
1838-
}
1839-
else if (bLeftNull || bRightNull) // one is null and ther other one is not null
1821+
Type type = typeof(T);
1822+
if (!type.IsValueType)
18401823
{
1841-
if (comparisonType == EOperatorType.E_EQUAL)
1842-
{
1843-
return false;
1844-
}
1845-
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1824+
bool bLeftNull = (left == null);
1825+
bool bRightNull = (right == null);
1826+
1827+
if (bLeftNull && bRightNull) // both are null
18461828
{
1847-
return true;
1829+
if (comparisonType == EOperatorType.E_EQUAL)
1830+
{
1831+
return true;
1832+
}
1833+
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1834+
{
1835+
return false;
1836+
}
1837+
else
1838+
{
1839+
Debug.Check(false);
1840+
}
18481841
}
1849-
else
1842+
else if (bLeftNull || bRightNull) // one is null and the other is not null
18501843
{
1851-
Debug.Check(false);
1844+
if (comparisonType == EOperatorType.E_EQUAL)
1845+
{
1846+
return false;
1847+
}
1848+
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1849+
{
1850+
return true;
1851+
}
1852+
else
1853+
{
1854+
Debug.Check(false);
1855+
}
18521856
}
18531857
}
18541858

@@ -1878,15 +1882,9 @@ public static bool Compare<T>(T left, T right, EOperatorType comparisonType)
18781882
}
18791883
}
18801884

1881-
Type type = typeof(T);
1882-
18831885
if (!type.IsValueType)
18841886
{
1885-
// reference type
1886-
object l = (object)left;
1887-
object r = (object)right;
1888-
1889-
bool bEqual = Object.ReferenceEquals(l, r);
1887+
bool bEqual = Object.ReferenceEquals(left, right);
18901888

18911889
if (bEqual)
18921890
{

integration/demo_running/behaviac/BehaviorTree/BehaviorTree.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -1494,9 +1494,12 @@ public void InstantiatePars(Dictionary<uint, IInstantiatedVariable> vars)
14941494
{
14951495
if (this.m_localProps != null)
14961496
{
1497-
foreach (KeyValuePair<uint, ICustomizedProperty> pair in this.m_localProps)
1497+
var e = this.m_localProps.Keys.GetEnumerator();
1498+
1499+
while (e.MoveNext())
14981500
{
1499-
vars[pair.Key] = pair.Value.Instantiate();
1501+
uint varId = e.Current;
1502+
vars[varId] = this.m_localProps[varId].Instantiate();
15001503
}
15011504
}
15021505
}
@@ -1505,8 +1508,11 @@ public void UnInstantiatePars(Dictionary<uint, IInstantiatedVariable> vars)
15051508
{
15061509
if (this.m_localProps != null)
15071510
{
1508-
foreach (uint varId in this.m_localProps.Keys)
1511+
var e = this.m_localProps.Keys.GetEnumerator();
1512+
1513+
while (e.MoveNext())
15091514
{
1515+
uint varId = e.Current;
15101516
vars.Remove(varId);
15111517
}
15121518
}

integration/demo_running/behaviac/BehaviorTree/BehaviorTree_task.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,12 @@ internal void AddVariables(Dictionary<uint, IInstantiatedVariable> vars)
13721372
{
13731373
if (vars != null)
13741374
{
1375-
foreach (KeyValuePair<uint, IInstantiatedVariable> pair in vars)
1375+
var e = vars.Keys.GetEnumerator();
1376+
1377+
while (e.MoveNext())
13761378
{
1377-
this.LocalVars[pair.Key] = pair.Value;
1379+
uint varId = e.Current;
1380+
this.LocalVars[varId] = vars[varId];
13781381
}
13791382
}
13801383
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.37
1+
3.6.38

integration/unity/Assets/Scripts/behaviac/runtime/Agent/Agent.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,6 @@ public void LogVariables(bool bForce)
13651365
}
13661366
}
13671367
}
1368-
13691368
#endif
13701369
}
13711370

@@ -1375,9 +1374,11 @@ public void LogRunningNodes()
13751374
if (Config.IsLoggingOrSocketing && this.m_currentBT != null)
13761375
{
13771376
List<BehaviorTask> runningNodes = this.m_currentBT.GetRunningNodes(false);
1377+
var e = runningNodes.GetEnumerator();
13781378

1379-
foreach (BehaviorTask behaviorTask in runningNodes)
1379+
while (e.MoveNext())
13801380
{
1381+
BehaviorTask behaviorTask = e.Current;
13811382
string btStr = BehaviorTask.GetTickInfo(this, behaviorTask, "enter");
13821383

13831384
//empty btStr is for internal BehaviorTreeTask

integration/unity/Assets/Scripts/behaviac/runtime/Base/Operation.cs

+33-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
22
// Tencent is pleased to support the open source community by making behaviac available.
33
//
44
// Copyright (C) 2015-2017 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1818,37 +1818,41 @@ public static EOperatorType ParseOperatorType(string operatorType)
18181818

18191819
public static bool Compare<T>(T left, T right, EOperatorType comparisonType)
18201820
{
1821-
bool bLeftNull = (left == null);
1822-
bool bRightNull = (right == null);
1823-
1824-
if (bLeftNull && bRightNull) // both are null
1825-
{
1826-
if (comparisonType == EOperatorType.E_EQUAL)
1827-
{
1828-
return true;
1829-
}
1830-
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1831-
{
1832-
return false;
1833-
}
1834-
else
1835-
{
1836-
Debug.Check(false);
1837-
}
1838-
}
1839-
else if (bLeftNull || bRightNull) // one is null and ther other one is not null
1821+
Type type = typeof(T);
1822+
if (!type.IsValueType)
18401823
{
1841-
if (comparisonType == EOperatorType.E_EQUAL)
1842-
{
1843-
return false;
1844-
}
1845-
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1824+
bool bLeftNull = (left == null);
1825+
bool bRightNull = (right == null);
1826+
1827+
if (bLeftNull && bRightNull) // both are null
18461828
{
1847-
return true;
1829+
if (comparisonType == EOperatorType.E_EQUAL)
1830+
{
1831+
return true;
1832+
}
1833+
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1834+
{
1835+
return false;
1836+
}
1837+
else
1838+
{
1839+
Debug.Check(false);
1840+
}
18481841
}
1849-
else
1842+
else if (bLeftNull || bRightNull) // one is null and the other is not null
18501843
{
1851-
Debug.Check(false);
1844+
if (comparisonType == EOperatorType.E_EQUAL)
1845+
{
1846+
return false;
1847+
}
1848+
else if (comparisonType == EOperatorType.E_NOTEQUAL)
1849+
{
1850+
return true;
1851+
}
1852+
else
1853+
{
1854+
Debug.Check(false);
1855+
}
18521856
}
18531857
}
18541858

@@ -1878,15 +1882,9 @@ public static bool Compare<T>(T left, T right, EOperatorType comparisonType)
18781882
}
18791883
}
18801884

1881-
Type type = typeof(T);
1882-
18831885
if (!type.IsValueType)
18841886
{
1885-
// reference type
1886-
object l = (object)left;
1887-
object r = (object)right;
1888-
1889-
bool bEqual = Object.ReferenceEquals(l, r);
1887+
bool bEqual = Object.ReferenceEquals(left, right);
18901888

18911889
if (bEqual)
18921890
{

integration/unity/Assets/Scripts/behaviac/runtime/BehaviorTree/BehaviorTree.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -1494,9 +1494,12 @@ public void InstantiatePars(Dictionary<uint, IInstantiatedVariable> vars)
14941494
{
14951495
if (this.m_localProps != null)
14961496
{
1497-
foreach (KeyValuePair<uint, ICustomizedProperty> pair in this.m_localProps)
1497+
var e = this.m_localProps.Keys.GetEnumerator();
1498+
1499+
while (e.MoveNext())
14981500
{
1499-
vars[pair.Key] = pair.Value.Instantiate();
1501+
uint varId = e.Current;
1502+
vars[varId] = this.m_localProps[varId].Instantiate();
15001503
}
15011504
}
15021505
}
@@ -1505,8 +1508,11 @@ public void UnInstantiatePars(Dictionary<uint, IInstantiatedVariable> vars)
15051508
{
15061509
if (this.m_localProps != null)
15071510
{
1508-
foreach (uint varId in this.m_localProps.Keys)
1511+
var e = this.m_localProps.Keys.GetEnumerator();
1512+
1513+
while (e.MoveNext())
15091514
{
1515+
uint varId = e.Current;
15101516
vars.Remove(varId);
15111517
}
15121518
}

integration/unity/Assets/Scripts/behaviac/runtime/BehaviorTree/BehaviorTree_task.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,12 @@ internal void AddVariables(Dictionary<uint, IInstantiatedVariable> vars)
13721372
{
13731373
if (vars != null)
13741374
{
1375-
foreach (KeyValuePair<uint, IInstantiatedVariable> pair in vars)
1375+
var e = vars.Keys.GetEnumerator();
1376+
1377+
while (e.MoveNext())
13761378
{
1377-
this.LocalVars[pair.Key] = pair.Value;
1379+
uint varId = e.Current;
1380+
this.LocalVars[varId] = vars[varId];
13781381
}
13791382
}
13801383
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.37
1+
3.6.38

tools/designer/BehaviacDesigner/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
// Build Number
3030
// Revision
3131
//
32-
[assembly: AssemblyVersion("3.6.37")]
33-
[assembly: AssemblyFileVersion("3.6.37")]
32+
[assembly: AssemblyVersion("3.6.38")]
33+
[assembly: AssemblyFileVersion("3.6.38")]

tools/designer/Plugins/PluginBehaviac/DataExporters/Cpp/DataCppExporter.cs

+5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ public static string GetGeneratedDefaultValue(Type type, string typename, string
163163
}
164164
else if (type == typeof(float))
165165
{
166+
if (value == "0")
167+
{
168+
value = "0.0";
169+
}
170+
166171
if (!string.IsNullOrEmpty(value) && !value.ToLowerInvariant().EndsWith("f"))
167172
{
168173
value += "f";

tutorials/CsTutorials/behaviac/runtime/Agent/Agent.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,6 @@ public void LogVariables(bool bForce)
13651365
}
13661366
}
13671367
}
1368-
13691368
#endif
13701369
}
13711370

@@ -1375,9 +1374,11 @@ public void LogRunningNodes()
13751374
if (Config.IsLoggingOrSocketing && this.m_currentBT != null)
13761375
{
13771376
List<BehaviorTask> runningNodes = this.m_currentBT.GetRunningNodes(false);
1377+
var e = runningNodes.GetEnumerator();
13781378

1379-
foreach (BehaviorTask behaviorTask in runningNodes)
1379+
while (e.MoveNext())
13801380
{
1381+
BehaviorTask behaviorTask = e.Current;
13811382
string btStr = BehaviorTask.GetTickInfo(this, behaviorTask, "enter");
13821383

13831384
//empty btStr is for internal BehaviorTreeTask

0 commit comments

Comments
 (0)