--- deliantra/Deliantra-Client/bin/pclient 2006/05/17 01:03:10 1.221 +++ deliantra/Deliantra-Client/bin/pclient 2006/05/17 10:33:03 1.222 @@ -1478,10 +1478,12 @@ sub conn::container_add { my ($self, $tag, $items) = @_; + #d# print "container_add: container $tag ($self->{player}{tag})\n"; + if ($tag == 0) { update_floorbox; - $INVR->set_items ($self->{container}{0}); $OPENCONT = 0; + $INVR->set_items ($self->{container}{0}); } elsif ($tag == $self->{player}{tag}) { $INV->set_items ($self->{container}{$self->{player}{tag}}) } else { @@ -1496,15 +1498,17 @@ sub conn::container_clear { my ($self, $tag) = @_; + #d# print "container_clear: container $tag ($self->{player}{tag})\n"; + if ($tag == 0) { update_floorbox; - $INVR->set_items ($self->{container}{0}); $OPENCONT = 0; + $INVR->set_items ($self->{container}{0}); } elsif ($tag == $self->{player}{tag}) { $INV->set_items ($self->{container}{$tag}) } else { - $INVR->set_items ($self->{container}{$tag}); $OPENCONT = $tag; + $INVR->set_items ($self->{container}{$tag}); } # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; @@ -1514,13 +1518,17 @@ my ($self, @items) = @_; for (@items) { + #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n"; + if ($_->{container} == 0) { update_floorbox; + $OPENCONT = 0; $INVR->set_items ($self->{container}{0}); } elsif ($_->{container} == $self->{player}{tag}) { $INV->set_items ($self->{container}{$self->{player}{tag}}) } else { - $INVR->set_items ($self->{container}{0}); + $OPENCONT = $_->{container}; + $INVR->set_items ($self->{container}{$_->{container}}); } } } @@ -1528,11 +1536,19 @@ sub conn::item_update { my ($self, $item) = @_; - if ($item->{container} == 0) { - update_floorbox; + #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n"; + + if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) { + $OPENCONT = 0; $INVR->set_items ($self->{container}{0}); - } elsif ($item->{container} == $self->{player}{tag}) { - $INV->set_items ($self->{container}{$item->{container}}) + } else { + if ($item->{container} == 0) { + update_floorbox; + $OPENCONT = 0; + $INVR->set_items ($self->{container}{0}); + } elsif ($item->{container} == $self->{player}{tag}) { + $INV->set_items ($self->{container}{$item->{container}}) + } } }