diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-02 18:52:25 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-02 18:54:01 -0500 |
commit | 880dfe8177549891a31f1632821f6fdefbd69c4f (patch) | |
tree | a3585657d18a1370ef33ddf51b0f7186d59d44d0 /lib/Bot/Games/Game/Ghost.pm | |
parent | 7d059870682438390ed816330259a8e23550bfcb (diff) | |
download | bot-games-880dfe8177549891a31f1632821f6fdefbd69c4f.tar.gz bot-games-880dfe8177549891a31f1632821f6fdefbd69c4f.zip |
move maybe_add_player to the currentplayer role
Diffstat (limited to 'lib/Bot/Games/Game/Ghost.pm')
-rw-r--r-- | lib/Bot/Games/Game/Ghost.pm | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm index 8a3a9c6..6f8ad83 100644 --- a/lib/Bot/Games/Game/Ghost.pm +++ b/lib/Bot/Games/Game/Ghost.pm @@ -118,15 +118,12 @@ command valid_word_from_state => sub { return uc($word_prefix) eq $self->state; }, formatter => 'Bool'; -sub maybe_add_player { +around maybe_add_player => sub { + my $orig = shift; my $self = shift; - my ($player) = @_; - if (!$self->has_challenger && !grep { $player eq $_ } $self->players) { - if ($self->add_player($player)) { - $self->current_player($player); - } - } -} + return if $self->has_challenger; + return $self->$orig(@_); +}; __PACKAGE__->meta->make_immutable; no Bot::Games::OO::Game; |