… | |
… | |
10 | our @ISA = CFClient::UI::Base::; |
10 | our @ISA = CFClient::UI::Base::; |
11 | |
11 | |
12 | sub new { |
12 | sub 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 | |
23 | sub DESTROY { |
27 | sub DESTROY { |
24 | my $self = shift; |
28 | my $self = shift; |
25 | |
29 | |
… | |
… | |
173 | CFClient::SDLK_LEFT, [7, "west"], |
177 | CFClient::SDLK_LEFT, [7, "west"], |
174 | ); |
178 | ); |
175 | |
179 | |
176 | sub key_down { |
180 | sub key_down { |
177 | my ($self, $ev) = @_; |
181 | my ($self, $ev) = @_; |
|
|
182 | |
|
|
183 | return unless $::CONN; |
178 | |
184 | |
179 | my $mod = $ev->{mod}; |
185 | my $mod = $ev->{mod}; |
180 | my $sym = $ev->{sym}; |
186 | my $sym = $ev->{sym}; |
181 | |
187 | |
182 | if ($sym == CFClient::SDLK_KP5) { |
188 | if ($sym == CFClient::SDLK_KP5) { |
… | |
… | |
237 | sub add_command { |
243 | sub add_command { |
238 | my ($self, $command, $tooltip, $widget, $cb) = @_; |
244 | my ($self, $command, $tooltip, $widget, $cb) = @_; |
239 | |
245 | |
240 | (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; |
246 | (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; |
241 | |
247 | |
|
|
248 | $self->{command} = [ |
242 | push @{$self->{command}}, [$abbrev, $command, $tooltip, $widget, $cb]; |
249 | [$abbrev, $command, $tooltip, $widget, $cb], |
|
|
250 | grep $_->[1] ne $command, @{ $self->{command} }, |
|
|
251 | ]; |
243 | } |
252 | } |
244 | |
253 | |
245 | package CFClient::MapWidget::MapMap; |
254 | package CFClient::MapWidget::MapMap; |
246 | |
255 | |
247 | our @ISA = CFClient::UI::Base::; |
256 | our @ISA = CFClient::UI::Base::; |
… | |
… | |
363 | my @found; |
372 | my @found; |
364 | |
373 | |
365 | for (@$command) { |
374 | for (@$command) { |
366 | if ($_->[0] =~ $search_abbrev) { |
375 | if ($_->[0] =~ $search_abbrev) { |
367 | push @found, [$_->[0], $_]; |
376 | push @found, [$_->[0], $_]; |
368 | } elsif ($_->[1] =~ $search_full) { |
377 | } elsif (2 < length $self->{search} and $_->[1] =~ $search_full) { |
369 | push @found, [$_->[1], $_]; |
378 | push @found, [$_->[1], $_]; |
370 | } |
379 | } |
371 | } |
380 | } |
372 | |
381 | |
373 | @found = sort { $a->[0] cmp $b->[0] } @found; |
382 | @found = sort { $a->[0] cmp $b->[0] } @found; |