… | |
… | |
186 | bool object::can_merge_slow (object *ob1, object *ob2) |
186 | bool object::can_merge_slow (object *ob1, object *ob2) |
187 | { |
187 | { |
188 | /* A couple quicksanity checks */ |
188 | /* A couple quicksanity checks */ |
189 | if (ob1 == ob2 |
189 | if (ob1 == ob2 |
190 | || ob1->type != ob2->type |
190 | || ob1->type != ob2->type |
191 | || fabs (ob1->speed - ob2->speed) < MIN_ACTIVE_SPEED |
191 | || fabs (ob1->speed - ob2->speed) >= MIN_ACTIVE_SPEED |
192 | || ob1->value != ob2->value |
192 | || ob1->value != ob2->value |
193 | || ob1->name != ob2->name) |
193 | || ob1->name != ob2->name) |
194 | return 0; |
194 | return 0; |
195 | |
195 | |
196 | /* Do not merge objects if nrof would overflow, assume nrof |
196 | /* Do not merge objects if nrof would overflow, assume nrof |
… | |
… | |
230 | || ob1->move_block != ob2->move_block |
230 | || ob1->move_block != ob2->move_block |
231 | || ob1->move_allow != ob2->move_allow |
231 | || ob1->move_allow != ob2->move_allow |
232 | || ob1->move_on != ob2->move_on |
232 | || ob1->move_on != ob2->move_on |
233 | || ob1->move_off != ob2->move_off |
233 | || ob1->move_off != ob2->move_off |
234 | || ob1->move_slow != ob2->move_slow |
234 | || ob1->move_slow != ob2->move_slow |
235 | || fabs (ob1->move_slow_penalty - ob2->move_slow_penalty) < (1.f / 1024.f) |
235 | || fabs (ob1->move_slow_penalty - ob2->move_slow_penalty) >= (1.f / 1024.f) |
236 | || memcmp (&ob1->resist, &ob2->resist, sizeof (ob1->resist)) |
236 | || memcmp (&ob1->resist, &ob2->resist, sizeof (ob1->resist)) |
237 | || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats))) |
237 | || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats))) |
238 | return 0; |
238 | return 0; |
239 | |
239 | |
240 | if ((ob1->flag ^ ob2->flag) |
240 | if ((ob1->flag ^ ob2->flag) |
… | |
… | |
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 |