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.22 by root, Sat May 13 00:27:08 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
174); 178);
175 179
176sub key_down { 180sub 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]");
237sub add_command { 244sub 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
245package CFClient::MapWidget::MapMap; 255package CFClient::MapWidget::MapMap;
246 256
247our @ISA = CFClient::UI::Base::; 257our @ISA = CFClient::UI::Base::;
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines