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.33 by root, Sun Apr 23 23:57:13 2006 UTC vs.
Revision 1.34 by root, Sat Apr 29 16:17:13 2006 UTC

453sub _del_items { 453sub _del_items {
454 my ($self, @items) = @_; 454 my ($self, @items) = @_;
455 455
456 for my $item (@items) { 456 for my $item (@items) {
457 delete $self->{item}{$item->{tag}}; 457 delete $self->{item}{$item->{tag}};
458 delete $self->{container}{$item->{container}}{$item->{tag}}; 458 $self->{container}{$item->{container}} = [
459 grep $_ != $item, @{ $self->{container}{$item->{container}} }
460 ];
459 } 461 }
460} 462}
461 463
462sub feed_delinv { 464sub feed_delinv {
463 my ($self, $data) = @_; 465 my ($self, $data) = @_;
464 466
465 $self->_del_items (values %{ $self->{container}{$data} }); 467 $self->_del_items (@{ $self->{container}{$data} });
466 $self->container_clear ($data); 468 $self->container_clear ($data);
467} 469}
468 470
469sub feed_delitem { 471sub feed_delitem {
470 my ($self, $data) = @_; 472 my ($self, $data) = @_;
501 nrof => $nrof, 503 nrof => $nrof,
502 type => $type, 504 type => $type,
503 }; 505 };
504 506
505 $self->{item}{$tag} = $item; 507 $self->{item}{$tag} = $item;
506 $self->{container}{$location}{$tag} = $item; 508 push @{ $self->{container}{$location} }, $item;
507 push @items, $item; 509 push @items, $item;
508 } 510 }
509 511
510 $self->container_add ($location, \@items); 512 $self->container_add ($location, \@items);
511} 513}
517 519
518 my $item = $self->{item}{$tag}; 520 my $item = $self->{item}{$tag};
519 521
520 if ($flags & UPD_LOCATION) { 522 if ($flags & UPD_LOCATION) {
521 $self->item_delete ($item); 523 $self->item_delete ($item);
522 delete $self->{container}{$item->{container}}{$tag}; 524 $self->{container}{$item->{container}} = [
525 grep $_ != $item, @{ $self->{container}{$item->{container}} }
526 ];
523 527
524 $item->{container} = unpack "N", substr $data, 0, 4, ""; 528 $item->{container} = unpack "N", substr $data, 0, 4, "";
525 529
526 $self->{container}{$item->{container}}{$tag} = $item; 530 push @{ $self->{container}{$item->{container}} }, $item;
527 $self->container_add ($item->{location}, $item); 531 $self->container_add ($item->{location}, $item);
528 } 532 }
529 533
530 $item->{flags} = unpack "N", substr $data, 0, 4, "" if $flags & UPD_FLAGS; 534 $item->{flags} = unpack "N", substr $data, 0, 4, "" if $flags & UPD_FLAGS;
531 $item->{weight} = unpack "N", substr $data, 0, 4, "" if $flags & UPD_WEIGHT; 535 $item->{weight} = unpack "N", substr $data, 0, 4, "" if $flags & UPD_WEIGHT;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines