MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Remove

Method Remove

Descent3/Inventory.cpp:872–898  ·  view source on GitHub ↗

removes an item from inventory, without using it (returns true on success, false if object didn't exist)

Source from the content-addressed store, hash-verified

870
871// removes an item from inventory, without using it (returns true on success, false if object didn't exist)
872bool Inventory::Remove(int type, int id) {
873 inven_item *node;
874
875 node = FindItem(type, id);
876
877 if (!node)
878 return false;
879
880 if (node->iflags & INVF_OBJECT) {
881 // always remove
882 object *obj = ObjGet(type);
883 ASSERT(obj);
884 if (obj) {
885 obj->flags &= ~OF_INPLAYERINVENTORY;
886 }
887
888 RemoveNode(node);
889 } else {
890 node->count--;
891 mprintf(0, "Inventory System: Remove\n");
892
893 if (node->count <= 0)
894 RemoveNode(node);
895 }
896
897 return true;
898}
899
900// removes a node from the list, decrementing the count
901void Inventory::RemoveNode(inven_item *node) {

Callers 8

msafe_CallFunctionFunction · 0.80
MultiDoStripPlayerFunction · 0.80
InvRemoveFunction · 0.80
dInven_RemoveFunction · 0.80
PlayerSpewInventoryFunction · 0.80
ThiefStealItemFunction · 0.80
InventoryRemoveObjectFunction · 0.80

Calls 1

ObjGetFunction · 0.85

Tested by

no test coverage detected