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.99 by root, Tue Apr 10 09:39:48 2007 UTC vs.
Revision 1.100 by root, Tue Apr 10 11:12:53 2007 UTC

432} 432}
433 433
434sub load_map($$$) { 434sub load_map($$$) {
435 my ($self, $hash, $x, $y) = @_; 435 my ($self, $hash, $x, $y) = @_;
436 436
437 my $gen = $self->{map_change_gen};
438
437 CFPlus::DB::get $self->{mapcache} => $hash, sub { 439 CFPlus::DB::get $self->{mapcache} => $hash, sub {
440 return unless $gen == $self->{map_change_gen};
441
438 my ($data) = @_; 442 my ($data) = @_;
439 443
440 if (defined $data) { 444 if (defined $data) {
441 $data = Compress::LZF::decompress $data; 445 $data = Compress::LZF::decompress $data;
442 #warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d# 446 #warn sprintf "LOADmap[%s,%d,%d] length %d\n", $hash, $x, $y, length $data;#d#
517 521
518 $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) 522 $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags)
519 if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; 523 if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1;
520 524
521 } else { 525 } else {
526 my $gen = $self->{map_change_gen};
522 $self->send_mapinfo ("spatial $path$tile", sub { 527 $self->send_mapinfo ("spatial $path$tile", sub {
528 return unless $gen == $self->{map_change_gen};
529
523 my ($mode, $flags, $x, $y, $w, $h, $hash) = @_; 530 my ($mode, $flags, $x, $y, $w, $h, $hash) = @_;
524 531
525 return if $mode ne "spatial"; 532 return if $mode ne "spatial";
526 533
527 $x += $self->{map}->ox; 534 $x += $self->{map}->ox;
541 548
542sub map_change { 549sub map_change {
543 my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_; 550 my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_;
544 551
545 $self->flush_map; 552 $self->flush_map;
553
554 ++$self->{map_change_gen};
546 555
547 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); 556 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy);
548 557
549 my $mapmapw = $self->{mapmap}->{w}; 558 my $mapmapw = $self->{mapmap}->{w};
550 my $mapmaph = $self->{mapmap}->{h}; 559 my $mapmaph = $self->{mapmap}->{h};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines