--- deliantra/server/lib/cf.pm 2011/05/08 11:44:43 1.572 +++ deliantra/server/lib/cf.pm 2012/01/03 02:08:49 1.576 @@ -1463,10 +1463,7 @@ my $msg = eval { $pl->ns->{json_coder}->decode ($buf) }; if (ref $msg) { - my ($type, $reply, @payload) = - "ARRAY" eq ref $msg - ? @$msg - : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove + my ($type, $reply, @payload) = @$msg; # version 1 used %type, $id, %$hash my @reply; @@ -2241,7 +2238,6 @@ $self->decay_objects; $self->fix_auto_apply; $self->update_buttons; - $self->post_load_physics; cf::cede_to_tick; #$self->activate; # no longer activate maps automatically } @@ -2270,33 +2266,6 @@ $self } -# find and load all maps in the 3x3 area around a map -sub load_neighbours { - my ($map) = @_; - - my @neigh; # diagonal neighbours - - for (0 .. 3) { - my $neigh = $map->tile_path ($_) - or next; - $neigh = find $neigh, $map - or next; - $neigh->load; - - # now find the diagonal neighbours - push @neigh, - [$neigh->tile_path (($_ + 3) % 4), $neigh], - [$neigh->tile_path (($_ + 1) % 4), $neigh]; - } - - for (grep defined $_->[0], @neigh) { - my ($path, $origin) = @$_; - my $neigh = find $path, $origin - or next; - $neigh->load; - } -} - sub find_sync { my ($path, $origin) = @_; @@ -2325,8 +2294,6 @@ $path = normalise $path, $origin; - print "find async $path (from $origin)\n";#d# - if (my $map = $cf::MAP{$path}) { return $map if !$load || $map->linkable; } @@ -2780,7 +2747,6 @@ if $x <= 0 && $y <= 0; $map->load; - $map->load_neighbours; return unless $self->contr->active; @@ -3223,13 +3189,9 @@ sub cf::client::ext_reply($$@) { my ($self, $id, @msg) = @_; - if ($self->extcmd == 2) { - $self->send_big_packet ("ext " . $self->{json_coder}->encode (["reply-$id", @msg])); - } elsif ($self->extcmd == 1) { - #TODO: version 1, remove - unshift @msg, msgtype => "reply", msgid => $id; - $self->send_big_packet ("ext " . $self->{json_coder}->encode ({@msg})); - } + return unless $self->extcmd == 2; + + $self->send_big_packet ("ext " . $self->{json_coder}->encode (["reply-$id", @msg])); } =item $success = $client->query ($flags, "text", \&cb) @@ -3294,10 +3256,7 @@ my $msg = eval { $ns->{json_coder}->decode ($buf) }; if (ref $msg) { - my ($type, $reply, @payload) = - "ARRAY" eq ref $msg - ? @$msg - : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove + my ($type, $reply, @payload) = @$msg; # version 1 used %type, $id, %$hash my @reply; @@ -3761,8 +3720,7 @@ cf::object::thawer::errors_are_fatal 0; info "parse errors in files are no longer fatal from this point on.\n"; - my $free_main; $free_main = EV::idle sub { - undef $free_main; + AE::postpone { undef &main; # free gobs of memory :) }; @@ -3929,7 +3887,7 @@ trace "emergency_perl_save: flushing outstanding aio requests"; while (IO::AIO::nreqs || BDB::nreqs) { - Coro::EV::timer_once 0.01; # let the sync_job do it's thing + Coro::AnyEvent::sleep 0.01; # let the sync_job do it's thing } cf::write_runtime_sync; # external watchdog should not bark @@ -4176,7 +4134,7 @@ BDB::min_parallel 16; BDB::max_poll_reqs $TICK * 0.1; - $AnyEvent::BDB::WATCHER->priority (1); + #$AnyEvent::BDB::WATCHER->priority (1); unless ($DB_ENV) { $DB_ENV = BDB::db_env_create;