… | |
… | |
1568 | return where->env->insert (this); |
1568 | return where->env->insert (this); |
1569 | else |
1569 | else |
1570 | return where->map->insert (this, where->x, where->y, originator, flags); |
1570 | return where->map->insert (this, where->x, where->y, originator, flags); |
1571 | } |
1571 | } |
1572 | |
1572 | |
1573 | // check whether we can put this into the map, respect max_nrof, max_volume, max_items |
1573 | // check whether we can put this into the map, respect max_volume, max_items |
1574 | bool |
1574 | bool |
1575 | object::can_drop_at (maptile *m, int x, int y, object *originator) |
1575 | object::can_drop_at (maptile *m, int x, int y, object *originator) |
1576 | { |
1576 | { |
1577 | mapspace &ms = m->at (x, y); |
1577 | mapspace &ms = m->at (x, y); |
1578 | |
1578 | |
1579 | int items = ms.items (); |
1579 | int items = ms.items (); |
1580 | |
1580 | |
1581 | if (!items // testing !items ensures we can drop at least one item |
1581 | if (!items // testing !items ensures we can drop at least one item |
1582 | || (items < m->max_items |
1582 | || (items < m->max_items |
1583 | && ms.volume () < m->max_volume |
1583 | && ms.volume () < m->max_volume)) |
1584 | && nrof <= m->max_nrof)) |
|
|
1585 | return true; |
1584 | return true; |
1586 | |
1585 | |
1587 | if (originator && originator->is_player ()) |
1586 | if (originator && originator->is_player ()) |
1588 | originator->contr->failmsg (format ( |
1587 | originator->contr->failmsg (format ( |
1589 | "No matter how hard you try, you just cannot put the %s here H<Try to remove some items from the floor first.>", |
1588 | "No matter how hard you try, you just cannot put the %s here H<Try to remove some items from the floor first.>", |