--- deliantra/server/lib/cf.pm 2007/07/12 08:40:14 1.305 +++ deliantra/server/lib/cf.pm 2007/07/16 15:27:06 1.309 @@ -872,7 +872,7 @@ sub override { $override = 1; - @invoke_results = (); + @invoke_results = (@_); } sub do_invoke { @@ -1621,7 +1621,7 @@ } } - Carp::carp "unable to resolve path '$path' (base '$base')."; + Carp::cluck "unable to resolve path '$path' (base '$base')."; () } @@ -1909,9 +1909,9 @@ $MAP_PREFETCHER ||= cf::async { while (%MAP_PREFETCH) { for my $path (keys %MAP_PREFETCH) { - my $map = find $path - or next; - $map->load; + if (my $map = find $path) { + $map->load; + } delete $MAP_PREFETCH{$path}; } @@ -2258,19 +2258,20 @@ $self->enter_map ($map, $x, $y); } -=item $player_object->goto ($path, $x, $y[, $check->($map)]) +=item $player_object->goto ($path, $x, $y[, $check->($map)[, $done->()]]) Moves the player to the given map-path and coordinates by first freezing her, loading and preparing them map, calling the provided $check callback that has to return the map if sucecssful, and then unfreezes the player on -the new (success) or old (failed) map position. +the new (success) or old (failed) map position. In either case, $done will +be called at the end of this process. =cut our $GOTOGEN; sub cf::object::player::goto { - my ($self, $path, $x, $y, $check) = @_; + my ($self, $path, $x, $y, $check, $done) = @_; # do generation counting so two concurrent goto's will be executed in-order my $gen = $self->{_goto_generation} = ++$GOTOGEN; @@ -2300,6 +2301,8 @@ delete $self->{_goto_generation}; $self->leave_link ($map, $x, $y); } + + $done->() if $done; })->prio (1); } @@ -2770,12 +2773,19 @@ type => $info->{type}, copyright => $info->{copyright}, #TODO# }); - my $data = pack "(w/a*)*", $meta, $info->{data}; - my $chk = Digest::MD5::md5 "$info->{chksum},$meta"; # mangle data checksum and metadata my $idx = (cf::face::find $name) || cf::face::alloc $name; - cf::face::set_type $idx, 1; - cf::face::set_data $idx, 0, $data, $chk; + + if ($name =~ /\.jpg$/) { + cf::face::set_data $idx, 0, $info->{data}, $info->{chksum};#d# temp hack + cf::face::set_data $idx, 1, $info->{data}, $info->{chksum};#d# temp hack + } else { + my $data = pack "(w/a*)*", $meta, $info->{data}; + my $chk = Digest::MD5::md5 "$info->{chksum},$meta"; # mangle data checksum and metadata + + cf::face::set_type $idx, 1; + cf::face::set_data $idx, 0, $data, $chk; + } cf::cede_to_tick; }