Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba66795

Browse files
committed
fix issue BehaviorTree#141
1 parent b0ca622 commit ba66795

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

sample_nodes/crossdoor_nodes.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ NodeStatus CrossDoor::IsDoorLocked()
2626

2727
NodeStatus CrossDoor::UnlockDoor()
2828
{
29-
SleepMS(2000);
30-
_door_locked = false;
29+
if( _door_locked )
30+
{
31+
SleepMS(2000);
32+
_door_locked = false;
33+
}
3134
return NodeStatus::SUCCESS;
3235
}
3336

@@ -47,10 +50,10 @@ NodeStatus CrossDoor::OpenDoor()
4750
{
4851
if (_door_locked)
4952
{
50-
SleepMS(2000);
51-
_door_open = true;
53+
return NodeStatus::FAILURE;
5254
}
53-
55+
SleepMS(2000);
56+
_door_open = true;
5457
return NodeStatus::SUCCESS;
5558
}
5659

0 commit comments

Comments
 (0)