… | |
… | |
1476 | } |
1476 | } |
1477 | |
1477 | |
1478 | sub conn::container_add { |
1478 | sub conn::container_add { |
1479 | my ($self, $tag, $items) = @_; |
1479 | my ($self, $tag, $items) = @_; |
1480 | |
1480 | |
|
|
1481 | #d# print "container_add: container $tag ($self->{player}{tag})\n"; |
|
|
1482 | |
1481 | if ($tag == 0) { |
1483 | if ($tag == 0) { |
1482 | update_floorbox; |
1484 | update_floorbox; |
|
|
1485 | $OPENCONT = 0; |
1483 | $INVR->set_items ($self->{container}{0}); |
1486 | $INVR->set_items ($self->{container}{0}); |
1484 | $OPENCONT = 0; |
|
|
1485 | } elsif ($tag == $self->{player}{tag}) { |
1487 | } elsif ($tag == $self->{player}{tag}) { |
1486 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1488 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1487 | } else { |
1489 | } else { |
1488 | $OPENCONT = $tag; |
1490 | $OPENCONT = $tag; |
1489 | $INVR->set_items ($self->{container}{$tag}); |
1491 | $INVR->set_items ($self->{container}{$tag}); |
… | |
… | |
1494 | } |
1496 | } |
1495 | |
1497 | |
1496 | sub conn::container_clear { |
1498 | sub conn::container_clear { |
1497 | my ($self, $tag) = @_; |
1499 | my ($self, $tag) = @_; |
1498 | |
1500 | |
|
|
1501 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
|
|
1502 | |
1499 | if ($tag == 0) { |
1503 | if ($tag == 0) { |
1500 | update_floorbox; |
1504 | update_floorbox; |
|
|
1505 | $OPENCONT = 0; |
1501 | $INVR->set_items ($self->{container}{0}); |
1506 | $INVR->set_items ($self->{container}{0}); |
1502 | $OPENCONT = 0; |
|
|
1503 | } elsif ($tag == $self->{player}{tag}) { |
1507 | } elsif ($tag == $self->{player}{tag}) { |
1504 | $INV->set_items ($self->{container}{$tag}) |
1508 | $INV->set_items ($self->{container}{$tag}) |
1505 | } else { |
1509 | } else { |
|
|
1510 | $OPENCONT = $tag; |
1506 | $INVR->set_items ($self->{container}{$tag}); |
1511 | $INVR->set_items ($self->{container}{$tag}); |
1507 | $OPENCONT = $tag; |
|
|
1508 | } |
1512 | } |
1509 | |
1513 | |
1510 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1514 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1511 | } |
1515 | } |
1512 | |
1516 | |
1513 | sub conn::item_delete { |
1517 | sub conn::item_delete { |
1514 | my ($self, @items) = @_; |
1518 | my ($self, @items) = @_; |
1515 | |
1519 | |
1516 | for (@items) { |
1520 | for (@items) { |
|
|
1521 | #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n"; |
|
|
1522 | |
1517 | if ($_->{container} == 0) { |
1523 | if ($_->{container} == 0) { |
1518 | update_floorbox; |
1524 | update_floorbox; |
|
|
1525 | $OPENCONT = 0; |
1519 | $INVR->set_items ($self->{container}{0}); |
1526 | $INVR->set_items ($self->{container}{0}); |
1520 | } elsif ($_->{container} == $self->{player}{tag}) { |
1527 | } elsif ($_->{container} == $self->{player}{tag}) { |
1521 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1528 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1522 | } else { |
1529 | } else { |
|
|
1530 | $OPENCONT = $_->{container}; |
1523 | $INVR->set_items ($self->{container}{0}); |
1531 | $INVR->set_items ($self->{container}{$_->{container}}); |
1524 | } |
1532 | } |
1525 | } |
1533 | } |
1526 | } |
1534 | } |
1527 | |
1535 | |
1528 | sub conn::item_update { |
1536 | sub conn::item_update { |
1529 | my ($self, $item) = @_; |
1537 | my ($self, $item) = @_; |
1530 | |
1538 | |
1531 | if ($item->{container} == 0) { |
1539 | #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n"; |
1532 | update_floorbox; |
1540 | |
|
|
1541 | if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) { |
|
|
1542 | $OPENCONT = 0; |
1533 | $INVR->set_items ($self->{container}{0}); |
1543 | $INVR->set_items ($self->{container}{0}); |
|
|
1544 | } else { |
|
|
1545 | if ($item->{container} == 0) { |
|
|
1546 | update_floorbox; |
|
|
1547 | $OPENCONT = 0; |
|
|
1548 | $INVR->set_items ($self->{container}{0}); |
1534 | } elsif ($item->{container} == $self->{player}{tag}) { |
1549 | } elsif ($item->{container} == $self->{player}{tag}) { |
1535 | $INV->set_items ($self->{container}{$item->{container}}) |
1550 | $INV->set_items ($self->{container}{$item->{container}}) |
|
|
1551 | } |
1536 | } |
1552 | } |
1537 | } |
1553 | } |
1538 | |
1554 | |
1539 | %SDL_CB = ( |
1555 | %SDL_CB = ( |
1540 | CFClient::SDL_QUIT => sub { |
1556 | CFClient::SDL_QUIT => sub { |