ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.147 by root, Thu Aug 9 03:40:01 2007 UTC vs.
Revision 1.149 by root, Fri Aug 10 04:33:41 2007 UTC

506} 506}
507 507
508sub feed_map1a { 508sub feed_map1a {
509 my ($self, $data) = @_; 509 my ($self, $data) = @_;
510 510
511 $self->{map}->map1a_update ($data, $self->{setup}{extmap}); 511 my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap});
512 my $delay;
513
514 for my $tile (@$missing) {
515 next if $self->{delay}{$tile};
516
517 $delay = 1;
518
519 if (my $tex = $::CONN->{texture}[$tile]) {
520 $tex->upload;
521 } else {
522 $self->{delay}{$tile} = 1;
523
524 # we assume the face is in-flight and will eventually come
525 push @{$self->{face_cb}{$tile}}, sub {
526 delete $self->{delay}{$tile};
527 $_[0]->upload;
528 };
529 }
530 }
531
532 if ($delay) {
533 # delay the map drawing a tiny bit in the hope of getting the missing fetched
534 Event->timer (after => 0.03, cb => sub {
535 $_[0]->w->cancel;
536 $self->{map_widget}->update;
537 });
538 } else {
512 $self->{map_widget}->update; 539 $self->{map_widget}->update;
540 }
513} 541}
514 542
515sub magicmap { 543sub magicmap {
516 my ($self, $w, $h, $x, $y, $data) = @_; 544 my ($self, $w, $h, $x, $y, $data) = @_;
517 545
556 584
557 return unless $self->{map}; # stop when destroyed 585 return unless $self->{map}; # stop when destroyed
558 586
559 $self->have_tile ($id) 587 $self->have_tile ($id)
560 if $exists; 588 if $exists;
589
590 $self->{texture}[$id]->upload;
561 591
562 $self->bg_fetch; 592 $self->bg_fetch;
563 }; 593 };
564} 594}
565 595
721 $self->{map}->set_tileid ($facenum => $id); 751 $self->{map}->set_tileid ($facenum => $id);
722 752
723 CFPlus::DB::get tilecache => $id, $cb; 753 CFPlus::DB::get tilecache => $id, $cb;
724 754
725 } elsif ($face->{type} & 1) { # with metadata 755 } elsif ($face->{type} & 1) { # with metadata
726 #::message ({ markup => "starting to download song #$face/$pri, check your output-rate setting if your connection gets laggy." });
727 CFPlus::DB::get res_meta => $face->{name}, $cb; 756 CFPlus::DB::get res_meta => $face->{name}, $cb;
728 } 757 }
729} 758}
730 759
731sub face_update { 760sub face_update {
778sub have_tile { 807sub have_tile {
779 my ($self, $tile) = @_; 808 my ($self, $tile) = @_;
780 809
781 return unless $self->{map}; 810 return unless $self->{map};
782 811
783 $self->{texture}[$tile] ||= my $tex = 812 my $tex = $self->{texture}[$tile] ||=
784 new CFPlus::Texture 813 new CFPlus::Texture
785 tile => $tile, minify => 1, mipmap => 1, delay => 1; 814 tile => $tile, minify => 1, mipmap => 1, delay => 1;
786 815
787 $_->() for @{(delete $self->{face_cb}{$tile}) || []}; 816 $_->($tex) for @{(delete $self->{face_cb}{$tile}) || []};
788} 817}
789 818
790sub connect_face_update { 819sub connect_face_update {
791 my ($self, $id, $cb) = @_; 820 my ($self, $id, $cb) = @_;
792 821
987 } 1016 }
988 1017
989 $::FLOORBOX->add_at (@add); 1018 $::FLOORBOX->add_at (@add);
990 }); 1019 });
991 1020
992 $::WANT_REFRESH++; 1021 $::WANT_REFRESH->start;
993} 1022}
994 1023
995sub set_opencont { 1024sub set_opencont {
996 my ($conn, $tag, $name) = @_; 1025 my ($conn, $tag, $name) = @_;
997 $conn->{open_container} = $tag; 1026 $conn->{open_container} = $tag;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines