ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.19 by root, Tue Apr 25 13:51:48 2006 UTC vs.
Revision 1.20 by root, Tue Apr 25 14:04:37 2006 UTC

10our @ISA = CFClient::UI::Base::; 10our @ISA = CFClient::UI::Base::;
11 11
12sub new { 12sub new {
13 my $class = shift; 13 my $class = shift;
14 14
15 $class->SUPER::new ( 15 my $self = $class->SUPER::new (
16 z => -1, 16 z => -1,
17 can_focus => 1, 17 can_focus => 1,
18 list => glGenList, 18 list => glGenList,
19 @_ 19 @_
20 ) 20 );
21
22 $self->add_command ("killpets", "kills all your summoned and charmed creates");
23
24 $self
21} 25}
22 26
23sub DESTROY { 27sub DESTROY {
24 my $self = shift; 28 my $self = shift;
25 29
237sub add_command { 241sub add_command {
238 my ($self, $command, $tooltip, $widget, $cb) = @_; 242 my ($self, $command, $tooltip, $widget, $cb) = @_;
239 243
240 (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; 244 (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g;
241 245
246 $self->{command} = [
242 push @{$self->{command}}, [$abbrev, $command, $tooltip, $widget, $cb]; 247 [$abbrev, $command, $tooltip, $widget, $cb],
248 grep $_->[1] ne $command, @{ $self->{command} },
249 ];
243} 250}
244 251
245package CFClient::MapWidget::MapMap; 252package CFClient::MapWidget::MapMap;
246 253
247our @ISA = CFClient::UI::Base::; 254our @ISA = CFClient::UI::Base::;
363 my @found; 370 my @found;
364 371
365 for (@$command) { 372 for (@$command) {
366 if ($_->[0] =~ $search_abbrev) { 373 if ($_->[0] =~ $search_abbrev) {
367 push @found, [$_->[0], $_]; 374 push @found, [$_->[0], $_];
368 } elsif ($_->[1] =~ $search_full) { 375 } elsif (2 < length $self->{search} and $_->[1] =~ $search_full) {
369 push @found, [$_->[1], $_]; 376 push @found, [$_->[1], $_];
370 } 377 }
371 } 378 }
372 379
373 @found = sort { $a->[0] cmp $b->[0] } @found; 380 @found = sort { $a->[0] cmp $b->[0] } @found;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines