… | |
… | |
1505 | |
1505 | |
1506 | object * |
1506 | object * |
1507 | decrease_ob_nr (object *op, uint32 i) |
1507 | decrease_ob_nr (object *op, uint32 i) |
1508 | { |
1508 | { |
1509 | object *tmp; |
1509 | object *tmp; |
1510 | player *pl; |
|
|
1511 | |
1510 | |
1512 | if (i == 0) /* objects with op->nrof require this check */ |
1511 | if (i == 0) /* objects with op->nrof require this check */ |
1513 | return op; |
1512 | return op; |
1514 | |
1513 | |
1515 | if (i > op->nrof) |
1514 | if (i > op->nrof) |
… | |
… | |
1528 | * IMO, searching through all the players will mostly |
1527 | * IMO, searching through all the players will mostly |
1529 | * likely be quicker than following op->env to the map, |
1528 | * likely be quicker than following op->env to the map, |
1530 | * and then searching the map for a player. |
1529 | * and then searching the map for a player. |
1531 | */ |
1530 | */ |
1532 | if (!tmp) |
1531 | if (!tmp) |
1533 | { |
1532 | for_all_players (pl) |
1534 | for (pl = first_player; pl; pl = pl->next) |
|
|
1535 | if (pl->ob->container == op->env) |
1533 | if (pl->ob->container == op->env) |
1536 | { |
1534 | { |
1537 | tmp = pl->ob; |
1535 | tmp = pl->ob; |
1538 | break; |
1536 | break; |
1539 | } |
1537 | } |
1540 | } |
|
|
1541 | |
1538 | |
1542 | if (i < op->nrof) |
1539 | if (i < op->nrof) |
1543 | { |
1540 | { |
1544 | sub_weight (op->env, op->weight * i); |
1541 | sub_weight (op->env, op->weight * i); |
1545 | op->nrof -= i; |
1542 | op->nrof -= i; |