--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/04/06 19:17:25 1.98 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2007/04/18 18:16:16 1.102 @@ -17,9 +17,14 @@ use base 'Crossfire::Protocol::Base'; sub new { - my $class = shift; + my ($class, %arg) = @_; - my $self = $class->SUPER::new (@_, setup_req => { extmap => 1 }); + my $self = $class->SUPER::new (%arg, + setup_req => { + extmap => 1, + %{$arg{setup_req} || {}}, + }, + ); $self->{map_widget}->clr_commands; @@ -429,7 +434,11 @@ sub load_map($$$) { my ($self, $hash, $x, $y) = @_; + my $gen = $self->{map_change_gen}; + CFPlus::DB::get $self->{mapcache} => $hash, sub { + return unless $gen == $self->{map_change_gen}; + my ($data) = @_; if (defined $data) { @@ -514,7 +523,10 @@ if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; } else { + my $gen = $self->{map_change_gen}; $self->send_mapinfo ("spatial $path$tile", sub { + return unless $gen == $self->{map_change_gen}; + my ($mode, $flags, $x, $y, $w, $h, $hash) = @_; return if $mode ne "spatial"; @@ -539,6 +551,8 @@ $self->flush_map; + ++$self->{map_change_gen}; + my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); my $mapmapw = $self->{mapmap}->{w}; @@ -587,6 +601,12 @@ $self->set_texture ($face->{id} => delete $face->{image}); } +sub smooth_update { + my ($self, $facenum, $face) = @_; + + $self->{map}->set_smooth ($facenum, $face->{smoothface}, $face->{smoothlevel}); +} + sub set_texture { my ($self, $id, $data) = @_; @@ -638,8 +658,9 @@ $self->logprint ("info: ", $text); - # try to create single paragraphs of multiple lines sent by the server - $text =~ s/(?<=\S)\n(?=\w)/ /g; + ## try to create single paragraphs of multiple lines sent by the server + # no longer neecssary with TRT servers + #$text =~ s/(?<=\S)\n(?=\w)/ /g; $text = CFPlus::asxml $text; $text =~ s/\[b\](.*?)\[\/b\]/\1<\/b>/g;