ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.303 by root, Wed Jul 11 15:57:31 2007 UTC vs.
Revision 1.306 by root, Sat Jul 14 14:33:30 2007 UTC

1489 my ($path) = @_; 1489 my ($path) = @_;
1490 1490
1491 my ($match, $specificity); 1491 my ($match, $specificity);
1492 1492
1493 for my $region (list) { 1493 for my $region (list) {
1494 if ($region->match && $path =~ $region->match) { 1494 if ($region->{match} && $path =~ $region->{match}) {
1495 ($match, $specificity) = ($region, $region->specificity) 1495 ($match, $specificity) = ($region, $region->specificity)
1496 if $region->specificity > $specificity; 1496 if $region->specificity > $specificity;
1497 } 1497 }
1498 } 1498 }
1499 1499
2256 2256
2257 local $self->{_prev_pos} = $link_pos; # ugly hack for rent.ext 2257 local $self->{_prev_pos} = $link_pos; # ugly hack for rent.ext
2258 $self->enter_map ($map, $x, $y); 2258 $self->enter_map ($map, $x, $y);
2259} 2259}
2260 2260
2261=item $player_object->goto ($path, $x, $y[, $check->($map)]) 2261=item $player_object->goto ($path, $x, $y[, $check->($map)[, $done->()]])
2262 2262
2263Moves the player to the given map-path and coordinates by first freezing 2263Moves the player to the given map-path and coordinates by first freezing
2264her, loading and preparing them map, calling the provided $check callback 2264her, loading and preparing them map, calling the provided $check callback
2265that has to return the map if sucecssful, and then unfreezes the player on 2265that has to return the map if sucecssful, and then unfreezes the player on
2266the new (success) or old (failed) map position. 2266the new (success) or old (failed) map position. In either case, $done will
2267be called at the end of this process.
2267 2268
2268=cut 2269=cut
2269 2270
2270our $GOTOGEN; 2271our $GOTOGEN;
2271 2272
2272sub cf::object::player::goto { 2273sub cf::object::player::goto {
2273 my ($self, $path, $x, $y, $check) = @_; 2274 my ($self, $path, $x, $y, $check, $done) = @_;
2274 2275
2275 # do generation counting so two concurrent goto's will be executed in-order 2276 # do generation counting so two concurrent goto's will be executed in-order
2276 my $gen = $self->{_goto_generation} = ++$GOTOGEN; 2277 my $gen = $self->{_goto_generation} = ++$GOTOGEN;
2277 2278
2278 $self->enter_link; 2279 $self->enter_link;
2298 2299
2299 if ($gen == $self->{_goto_generation}) { 2300 if ($gen == $self->{_goto_generation}) {
2300 delete $self->{_goto_generation}; 2301 delete $self->{_goto_generation};
2301 $self->leave_link ($map, $x, $y); 2302 $self->leave_link ($map, $x, $y);
2302 } 2303 }
2304
2305 $done->() if $done;
2303 })->prio (1); 2306 })->prio (1);
2304} 2307}
2305 2308
2306=item $player_object->enter_exit ($exit_object) 2309=item $player_object->enter_exit ($exit_object)
2307 2310
2465=cut 2468=cut
2466 2469
2467sub cf::client::ext_event($$%) { 2470sub cf::client::ext_event($$%) {
2468 my ($self, $type, %msg) = @_; 2471 my ($self, $type, %msg) = @_;
2469 2472
2473 return unless $self->extcmd;
2474
2470 $msg{msgtype} = "event_$type"; 2475 $msg{msgtype} = "event_$type";
2471 $self->send_packet ("ext " . $self->{json_coder}->encode (\%msg)); 2476 $self->send_packet ("ext " . $self->{json_coder}->encode (\%msg));
2472} 2477}
2473 2478
2474=item $success = $client->query ($flags, "text", \&cb) 2479=item $success = $client->query ($flags, "text", \&cb)
2783} 2788}
2784 2789
2785sub reload_regions { 2790sub reload_regions {
2786 load_resource_file "$MAPDIR/regions" 2791 load_resource_file "$MAPDIR/regions"
2787 or die "unable to load regions file\n"; 2792 or die "unable to load regions file\n";
2793
2794 for (cf::region::list) {
2795 $_->{match} = qr/$_->{match}/
2796 if exists $_->{match};
2797 }
2788} 2798}
2789 2799
2790sub reload_facedata { 2800sub reload_facedata {
2791 load_facedata "$DATADIR/facedata" 2801 load_facedata "$DATADIR/facedata"
2792 or die "unable to load facedata\n"; 2802 or die "unable to load facedata\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines