fix near updating when not first path
This commit is contained in:
parent
cb48ebdb81
commit
f40350609a
3 changed files with 1536 additions and 1 deletions
|
|
@ -1538,7 +1538,7 @@ func updateNear(prevG, g *d2graph.Graph, from, to *string) error {
|
|||
if len(n.MapKey.Key.Path) == 0 {
|
||||
continue
|
||||
}
|
||||
if n.MapKey.Key.Path[0].Unbox().ScalarString() == "near" {
|
||||
if n.MapKey.Key.Path[len(n.MapKey.Key.Path)-1].Unbox().ScalarString() == "near" {
|
||||
k := n.MapKey.Value.ScalarBox().Unbox().ScalarString()
|
||||
if strings.EqualFold(k, *from) && to == nil {
|
||||
deleteFromMap(obj.Map, n.MapKey)
|
||||
|
|
|
|||
|
|
@ -3824,6 +3824,37 @@ y
|
|||
|
||||
exp: `x
|
||||
y
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "delete_container_of_near",
|
||||
|
||||
text: `direction: down
|
||||
first input -> start game -> game loop
|
||||
|
||||
game loop: {
|
||||
direction: down
|
||||
input -> increase bird top velocity
|
||||
|
||||
move bird -> move pipes -> render
|
||||
|
||||
render -> no collision -> wait 16 milliseconds -> move bird
|
||||
render -> collision detected -> game over
|
||||
no collision.near: game loop.collision detected
|
||||
}
|
||||
`,
|
||||
key: `game loop`,
|
||||
|
||||
exp: `direction: down
|
||||
first input -> start game
|
||||
|
||||
input -> increase bird top velocity
|
||||
|
||||
move bird -> move pipes -> render
|
||||
|
||||
render -> no collision -> wait 16 milliseconds -> move bird
|
||||
render -> collision detected -> game over
|
||||
no collision.near: collision detected
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
1504
testdata/d2oracle/TestDelete/delete_container_of_near.exp.json
generated
vendored
Normal file
1504
testdata/d2oracle/TestDelete/delete_container_of_near.exp.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue