--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/08/09 03:40:01 1.147 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2007/08/10 04:33:41 1.149 @@ -508,8 +508,36 @@ sub feed_map1a { my ($self, $data) = @_; - $self->{map}->map1a_update ($data, $self->{setup}{extmap}); - $self->{map_widget}->update; + my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap}); + my $delay; + + for my $tile (@$missing) { + next if $self->{delay}{$tile}; + + $delay = 1; + + if (my $tex = $::CONN->{texture}[$tile]) { + $tex->upload; + } else { + $self->{delay}{$tile} = 1; + + # we assume the face is in-flight and will eventually come + push @{$self->{face_cb}{$tile}}, sub { + delete $self->{delay}{$tile}; + $_[0]->upload; + }; + } + } + + if ($delay) { + # delay the map drawing a tiny bit in the hope of getting the missing fetched + Event->timer (after => 0.03, cb => sub { + $_[0]->w->cancel; + $self->{map_widget}->update; + }); + } else { + $self->{map_widget}->update; + } } sub magicmap { @@ -558,6 +586,8 @@ $self->have_tile ($id) if $exists; + + $self->{texture}[$id]->upload; $self->bg_fetch; }; @@ -723,7 +753,6 @@ CFPlus::DB::get tilecache => $id, $cb; } elsif ($face->{type} & 1) { # with metadata - #::message ({ markup => "starting to download song #$face/$pri, check your output-rate setting if your connection gets laggy." }); CFPlus::DB::get res_meta => $face->{name}, $cb; } } @@ -780,11 +809,11 @@ return unless $self->{map}; - $self->{texture}[$tile] ||= my $tex = + my $tex = $self->{texture}[$tile] ||= new CFPlus::Texture tile => $tile, minify => 1, mipmap => 1, delay => 1; - $_->() for @{(delete $self->{face_cb}{$tile}) || []}; + $_->($tex) for @{(delete $self->{face_cb}{$tile}) || []}; } sub connect_face_update { @@ -989,7 +1018,7 @@ $::FLOORBOX->add_at (@add); }); - $::WANT_REFRESH++; + $::WANT_REFRESH->start; } sub set_opencont {