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

Comparing deliantra/Deliantra/Deliantra/Protocol.pm (file contents):
Revision 1.2 by root, Thu Apr 6 20:04:55 2006 UTC vs.
Revision 1.3 by root, Thu Apr 6 20:15:05 2006 UTC

100 my ($self, $data) = @_; 100 my ($self, $data) = @_;
101 101
102 my ($num, $chksum, $name) = unpack "nNa*", $data; 102 my ($num, $chksum, $name) = unpack "nNa*", $data;
103 103
104 $self->{face}[$num] = { name => $name, chksum => $chksum }; 104 $self->{face}[$num] = { name => $name, chksum => $chksum };
105
106 if (my $data = $self->face_find ($name, $chksum)) {
107 $self->{face}[$num]{image} = $data;
108 $self->face_update ($num, $self->{face}[$num]);
109 } else {
110 $self->send ("askface $num");
111 }
105} 112}
106 113
107sub feed_drawinfo { 114sub feed_drawinfo {
108 my ($self, $data) = @_; 115 my ($self, $data) = @_;
109# warn "<$data>\n"; 116# warn "<$data>\n";
187} 194}
188 195
189sub feed_image { 196sub feed_image {
190 my ($self, $data) = @_; 197 my ($self, $data) = @_;
191 198
192 my ($face, $len, $data) = unpack "NNa*", $data; 199 my ($num, $len, $data) = unpack "NNa*", $data;
193 200
194 $self->{face}[$face]{image} = $data; 201 $self->{face}[$num]{image} = $data;
195
196 $self->face_update ($face, $self->{face}[$face]); 202 $self->face_update ($num, $self->{face}[$num]);
203
204 my @dirty;
197 205
198 for my $x (0..$self->{mapw} - 1) { 206 for my $x (0..$self->{mapw} - 1) {
199 for my $y (0..$self->{maph} - 1) { 207 for my $y (0..$self->{maph} - 1) {
200 push @dirty, [$x, $y] 208 push @dirty, [$x, $y]
201 if grep $_ == $num, @{$self->{map}[$x][$y] || []}; 209 if grep $_ == $num, @{$self->{map}[$x][$y] || []};
236 244
237=cut 245=cut
238 246
239sub face_update { } 247sub face_update { }
240 248
249=item $conn->face_find ($facenum, $face) [OVERWRITE]
250
251Find and return the png image for the given face, or the empty list if no
252face could be found, in which case it will be requested from the server.
253
254=cut
255
256sub face_find { }
257
241=item $conn->send ($data) 258=item $conn->send ($data)
242 259
243Send a single packet/line to the server. 260Send a single packet/line to the server.
244 261
245=cut 262=cut

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines