Checks for an object in any of the players inventorys and removes it
| 1515 | |
| 1516 | // Checks for an object in any of the players inventorys and removes it |
| 1517 | void InventoryRemoveObject(int objhandle) { |
| 1518 | object *obj = ObjGet(objhandle); |
| 1519 | ASSERT(obj); |
| 1520 | if (!obj) |
| 1521 | return; |
| 1522 | |
| 1523 | if (!(obj->flags & OF_INPLAYERINVENTORY)) // not in the player's inventory |
| 1524 | return; |
| 1525 | |
| 1526 | // go through all the players and look for the object |
| 1527 | for (int i = 0; i < MAX_PLAYERS; i++) { |
| 1528 | if (Players[i].inventory.CheckItem(objhandle, -1)) { |
| 1529 | // this player has it!! |
| 1530 | mprintf(0, "INVEN: Removing dead object from %d\n", i); |
| 1531 | Players[i].inventory.Remove(objhandle, -1); |
| 1532 | return; |
| 1533 | } |
| 1534 | } |
| 1535 | } |
no test coverage detected