… | |
… | |
1501 | { |
1501 | { |
1502 | if (where->env) |
1502 | if (where->env) |
1503 | return where->env->insert (this); |
1503 | return where->env->insert (this); |
1504 | else |
1504 | else |
1505 | return where->map->insert (this, where->x, where->y, originator, flags); |
1505 | return where->map->insert (this, where->x, where->y, originator, flags); |
|
|
1506 | } |
|
|
1507 | |
|
|
1508 | // check whether we can put this into the map, respect max_nrof, max_volume, max_items |
|
|
1509 | bool |
|
|
1510 | object::can_drop_at (maptile *m, int x, int y, object *originator) |
|
|
1511 | { |
|
|
1512 | mapspace &ms = m->at (x, y); |
|
|
1513 | |
|
|
1514 | int items = ms.items (); |
|
|
1515 | |
|
|
1516 | if (!items // testing !items ensures we can drop at least one item |
|
|
1517 | || (items < m->max_items |
|
|
1518 | && ms.volume () < m->max_volume |
|
|
1519 | && nrof <= m->max_nrof)) |
|
|
1520 | return true; |
|
|
1521 | |
|
|
1522 | if (originator && originator->is_player ()) |
|
|
1523 | originator->contr->failmsg (format ( |
|
|
1524 | "No matter how hard you try, you just cannot put the %s here H<Try to remove some items from the floor first.>", |
|
|
1525 | query_name () |
|
|
1526 | )); |
|
|
1527 | |
|
|
1528 | return false; |
1506 | } |
1529 | } |
1507 | |
1530 | |
1508 | /* |
1531 | /* |
1509 | * decrease(object, number) decreases a specified number from |
1532 | * decrease(object, number) decreases a specified number from |
1510 | * the amount of an object. If the amount reaches 0, the object |
1533 | * the amount of an object. If the amount reaches 0, the object |