… | |
… | |
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 | |
… | |
… | |
174 | ); |
178 | ); |
175 | |
179 | |
176 | sub key_down { |
180 | sub key_down { |
177 | my ($self, $ev) = @_; |
181 | my ($self, $ev) = @_; |
178 | |
182 | |
|
|
183 | return unless $::CONN; |
|
|
184 | |
179 | my $mod = $ev->{mod}; |
185 | my $mod = $ev->{mod}; |
180 | my $sym = $ev->{sym}; |
186 | my $sym = $ev->{sym}; |
|
|
187 | my $uni = $ev->{unicode}; |
181 | |
188 | |
182 | if ($sym == CFClient::SDLK_KP5) { |
189 | if ($sym == CFClient::SDLK_KP5) { |
183 | $::CONN->user_send ("stay fire"); |
190 | $::CONN->user_send ("stay fire"); |
184 | } elsif ($sym == ord ",") { |
191 | } elsif ($uni == ord ",") { |
185 | $::CONN->user_send ("take"); |
192 | $::CONN->user_send ("take"); |
186 | } elsif ($sym == ord "a") { |
193 | } elsif ($uni == ord "a") { |
187 | $::CONN->user_send ("apply"); |
194 | $::CONN->user_send ("apply"); |
188 | } elsif ($sym == ord "'") { |
195 | } elsif ($uni == ord "'") { |
189 | $self->emit ('activate_console'); |
196 | $self->emit ('activate_console'); |
190 | } elsif ($sym == ord "/") { |
197 | } elsif ($uni == ord "/") { |
191 | $self->emit (activate_console => '/'); |
198 | $self->emit (activate_console => '/'); |
192 | } elsif (exists $DIR{$sym}) { |
199 | } elsif (exists $DIR{$sym}) { |
193 | if ($mod & CFClient::KMOD_SHIFT) { |
200 | if ($mod & CFClient::KMOD_SHIFT) { |
194 | $self->{shft}++; |
201 | $self->{shft}++; |
195 | $::CONN->user_send ("fire $DIR{$sym}[0]"); |
202 | $::CONN->user_send ("fire $DIR{$sym}[0]"); |
… | |
… | |
237 | sub add_command { |
244 | sub add_command { |
238 | my ($self, $command, $tooltip, $widget, $cb) = @_; |
245 | my ($self, $command, $tooltip, $widget, $cb) = @_; |
239 | |
246 | |
240 | (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; |
247 | (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; |
241 | |
248 | |
|
|
249 | $self->{command} = [ |
242 | push @{$self->{command}}, [$abbrev, $command, $tooltip, $widget, $cb]; |
250 | [$abbrev, $command, $tooltip, $widget, $cb], |
|
|
251 | grep $_->[1] ne $command, @{ $self->{command} }, |
|
|
252 | ]; |
243 | } |
253 | } |
244 | |
254 | |
245 | package CFClient::MapWidget::MapMap; |
255 | package CFClient::MapWidget::MapMap; |
246 | |
256 | |
247 | use base CFClient::UI::Base::; |
257 | our @ISA = CFClient::UI::Base::; |
248 | |
258 | |
249 | use Time::HiRes qw(time); |
259 | use Time::HiRes qw(time); |
250 | use CFClient::OpenGL; |
260 | use CFClient::OpenGL; |
251 | |
261 | |
252 | sub size_request { |
262 | sub size_request { |
… | |
… | |
363 | my @found; |
373 | my @found; |
364 | |
374 | |
365 | for (@$command) { |
375 | for (@$command) { |
366 | if ($_->[0] =~ $search_abbrev) { |
376 | if ($_->[0] =~ $search_abbrev) { |
367 | push @found, [$_->[0], $_]; |
377 | push @found, [$_->[0], $_]; |
368 | } elsif ($_->[1] =~ $search_full) { |
378 | } elsif (2 < length $self->{search} and $_->[1] =~ $search_full) { |
369 | push @found, [$_->[1], $_]; |
379 | push @found, [$_->[1], $_]; |
370 | } |
380 | } |
371 | } |
381 | } |
372 | |
382 | |
373 | @found = sort { $a->[0] cmp $b->[0] } @found; |
383 | @found = sort { $a->[0] cmp $b->[0] } @found; |