Skip to content

Commit

Permalink
fix if_path
Browse files Browse the repository at this point in the history
this is why all parameter manipulation should happen at the beginning of
the method
  • Loading branch information
doy committed Jun 30, 2013
1 parent 52e66d8 commit 6cc4dcb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/TAEB/AI/Behavioral/Behavior.pm
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ sub if_path {
my $self = shift;
my $original_path = shift;
my $currently = shift;
my %opts = @_;
$opts{travel} = 1 unless defined $opts{travel};

unshift @_, 'urgency' if @_ % 2 == 1;
my %opts = @_;

$opts{urgency} = 'fallback' unless defined $opts{urgency};
$opts{travel} = 1 unless defined $opts{travel};

return if !defined($original_path);

Expand All @@ -222,7 +226,7 @@ sub if_path {
}
}

$self->urgency(@_ ? shift : 'fallback');
$self->urgency($opts{urgency});
}

=head2 done
Expand Down

0 comments on commit 6cc4dcb

Please sign in to comment.