… | |
… | |
184 | if (ob1 == ob2 |
184 | if (ob1 == ob2 |
185 | || ob1->type != ob2->type |
185 | || ob1->type != ob2->type |
186 | || ob1->speed != ob2->speed |
186 | || ob1->speed != ob2->speed |
187 | || ob1->value != ob2->value |
187 | || ob1->value != ob2->value |
188 | || ob1->name != ob2->name) |
188 | || ob1->name != ob2->name) |
189 | return 0; |
|
|
190 | |
|
|
191 | // some objects are unmergable |
|
|
192 | if (!ob1->nrof || !ob2->nrof) |
|
|
193 | return 0; |
189 | return 0; |
194 | |
190 | |
195 | /* Do not merge objects if nrof would overflow. First part checks |
191 | /* Do not merge objects if nrof would overflow. First part checks |
196 | * for unsigned overflow (2c), second part checks whether the result |
192 | * for unsigned overflow (2c), second part checks whether the result |
197 | * would fit into a 32 bit signed int, which is often used to hold |
193 | * would fit into a 32 bit signed int, which is often used to hold |
… | |
… | |
349 | else |
345 | else |
350 | { |
346 | { |
351 | // maybe there is a player standing on the same mapspace |
347 | // maybe there is a player standing on the same mapspace |
352 | // this will catch the case where "this" is a player |
348 | // this will catch the case where "this" is a player |
353 | if (object *pl = ms ().player ()) |
349 | if (object *pl = ms ().player ()) |
|
|
350 | if ((!pl->container && pl->contr->ns && !pl->contr->ns->update_look) |
354 | if (!pl->container || this == pl->container) |
351 | || this == pl->container) |
355 | return pl; |
352 | return pl; |
356 | } |
353 | } |
357 | } |
354 | } |
358 | |
355 | |
359 | return 0; |
356 | return 0; |
… | |
… | |
913 | || map->in_memory != MAP_ACTIVE |
910 | || map->in_memory != MAP_ACTIVE |
914 | || map->no_drop |
911 | || map->no_drop |
915 | || ms ().move_block == MOVE_ALL) |
912 | || ms ().move_block == MOVE_ALL) |
916 | { |
913 | { |
917 | while (inv) |
914 | while (inv) |
918 | { |
|
|
919 | inv->destroy_inv (false); |
|
|
920 | inv->destroy (); |
915 | inv->destroy (true); |
921 | } |
|
|
922 | } |
916 | } |
923 | else |
917 | else |
924 | { /* Put objects in inventory onto this space */ |
918 | { /* Put objects in inventory onto this space */ |
925 | while (inv) |
919 | while (inv) |
926 | { |
920 | { |
… | |
… | |
1545 | |
1539 | |
1546 | nrof -= nr; |
1540 | nrof -= nr; |
1547 | |
1541 | |
1548 | if (nrof) |
1542 | if (nrof) |
1549 | { |
1543 | { |
1550 | adjust_weight (env, -weight * nr); // carrying == 0 |
1544 | adjust_weight (env, -weight * max (1, nr)); // carrying == 0 |
1551 | |
1545 | |
1552 | if (object *pl = visible_to ()) |
1546 | if (object *pl = visible_to ()) |
1553 | esrv_update_item (UPD_NROF, pl, this); |
1547 | esrv_update_item (UPD_NROF, pl, this); |
1554 | |
1548 | |
1555 | return true; |
1549 | return true; |
1556 | } |
1550 | } |
1557 | else |
1551 | else |
1558 | { |
1552 | { |
1559 | destroy (1); |
1553 | destroy (); |
1560 | return false; |
1554 | return false; |
1561 | } |
1555 | } |
1562 | } |
1556 | } |
1563 | |
1557 | |
1564 | /* |
1558 | /* |