--- deliantra/server/lib/cf.pm 2007/08/21 00:31:18 1.336 +++ deliantra/server/lib/cf.pm 2007/08/24 00:26:10 1.339 @@ -1151,12 +1151,15 @@ ? @$msg : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove - if (my $cb = $EXTCMD{$type}) { - my @reply = $cb->($pl, @payload); + my @reply; - $pl->ext_reply ($reply, @reply) - if $reply; + if (my $cb = $EXTCMD{$type}) { + @reply = $cb->($pl, @payload); } + + $pl->ext_reply ($reply, @reply) + if $reply; + } else { warn "player " . ($pl->ob->name) . " sent unparseable ext message: <$buf>\n"; } @@ -1946,6 +1949,9 @@ sub do_load_sync { my ($map) = @_; + cf::LOG cf::llevDebug | cf::logBacktrace, "do_load_sync" + if $Coro::current != $Coro::main; + cf::sync_job { $map->load }; } @@ -1953,7 +1959,7 @@ our $MAP_PREFETCHER = undef; sub find_async { - my ($path, $origin) = @_; + my ($path, $origin, $load) = @_; $path = normalise $path, $origin && $origin->{path}; @@ -1961,15 +1967,16 @@ return $map if $map->in_memory == cf::MAP_IN_MEMORY; } - undef $MAP_PREFETCH{$path}; + $MAP_PREFETCH{$path} |= $load; + $MAP_PREFETCHER ||= cf::async { while (%MAP_PREFETCH) { - for my $path (keys %MAP_PREFETCH) { - if (my $map = find $path) { - $map->load; + while (my ($k, $v) = each %MAP_PREFETCH) { + if (my $map = find $k) { + $map->load if $v; } - delete $MAP_PREFETCH{$path}; + delete $MAP_PREFETCH{$k}; } } undef $MAP_PREFETCHER; @@ -2648,12 +2655,15 @@ ? @$msg : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove - if (my $cb = $EXTICMD{$type}) { - my @reply = $cb->($ns, @payload); + my @reply; - $ns->ext_reply ($reply, @reply) - if $reply; + if (my $cb = $EXTICMD{$type}) { + @reply = $cb->($ns, @payload); } + + $ns->ext_reply ($reply, @reply) + if $reply; + } else { warn "client " . ($ns->pl ? $ns->pl->ob->name : $ns->host) . " sent unparseable exti message: <$buf>\n"; } @@ -2841,7 +2851,7 @@ # patch in the exptable $facedata->{resource}{"res/exp_table"} = { type => FT_RSRC, - data => $enc->encode ([map cf::level_to_min_exp $_, 0 .. cf::settings->max_level]), + data => $enc->encode ([map cf::level_to_min_exp $_, 1 .. cf::settings->max_level]), }; cf::cede_to_tick; @@ -2904,6 +2914,8 @@ }); $data = pack "(w/a*)*", $meta, $info->{data}; + } else { + $data = $info->{data}; } cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data;