--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/04/25 13:51:48 1.19 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/13 00:27:08 1.22 @@ -12,12 +12,16 @@ sub new { my $class = shift; - $class->SUPER::new ( + my $self = $class->SUPER::new ( z => -1, can_focus => 1, list => glGenList, @_ - ) + ); + + $self->add_command ("killpets", "kills all your summoned and charmed creates"); + + $self } sub DESTROY { @@ -176,18 +180,21 @@ sub key_down { my ($self, $ev) = @_; + return unless $::CONN; + my $mod = $ev->{mod}; my $sym = $ev->{sym}; + my $uni = $ev->{unicode}; if ($sym == CFClient::SDLK_KP5) { $::CONN->user_send ("stay fire"); - } elsif ($sym == ord ",") { + } elsif ($uni == ord ",") { $::CONN->user_send ("take"); - } elsif ($sym == ord "a") { + } elsif ($uni == ord "a") { $::CONN->user_send ("apply"); - } elsif ($sym == ord "'") { + } elsif ($uni == ord "'") { $self->emit ('activate_console'); - } elsif ($sym == ord "/") { + } elsif ($uni == ord "/") { $self->emit (activate_console => '/'); } elsif (exists $DIR{$sym}) { if ($mod & CFClient::KMOD_SHIFT) { @@ -239,7 +246,10 @@ (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; - push @{$self->{command}}, [$abbrev, $command, $tooltip, $widget, $cb]; + $self->{command} = [ + [$abbrev, $command, $tooltip, $widget, $cb], + grep $_->[1] ne $command, @{ $self->{command} }, + ]; } package CFClient::MapWidget::MapMap; @@ -365,7 +375,7 @@ for (@$command) { if ($_->[0] =~ $search_abbrev) { push @found, [$_->[0], $_]; - } elsif ($_->[1] =~ $search_full) { + } elsif (2 < length $self->{search} and $_->[1] =~ $search_full) { push @found, [$_->[1], $_]; } }