mirror of https://github.com/tidwall/tile38.git
Fixed stale faraway object
This commit is contained in:
parent
8bde592092
commit
73f2cac9a4
|
@ -399,9 +399,15 @@ func fenceMatchRoam(
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
faraways = prevNearbys
|
for i := 0; i < len(prevNearbys); i++ {
|
||||||
for i := 0; i < len(faraways); i++ {
|
obj, _, ok := col.Get(prevNearbys[i].id)
|
||||||
faraways[i].meters = faraways[i].obj.CalculatedPoint().DistanceTo(p)
|
if ok {
|
||||||
|
faraways = append(faraways, roamMatch{
|
||||||
|
id: prevNearbys[i].id,
|
||||||
|
obj: obj,
|
||||||
|
meters: obj.CalculatedPoint().DistanceTo(p),
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(nearbys) == 0 {
|
if len(nearbys) == 0 {
|
||||||
if fence.roam.nearbys != nil {
|
if fence.roam.nearbys != nil {
|
||||||
|
|
Loading…
Reference in New Issue