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

Method Add

Descent3/Inventory.cpp:503–525  ·  view source on GitHub ↗

adds a new type/id item to the inventory

Source from the content-addressed store, hash-verified

501
502// adds a new type/id item to the inventory
503bool Inventory::Add(int type, int id, object *parent, int aux_type, int aux_id, int flags, const char *description) {
504 // make sure we can fit another object
505 if (count >= MAX_UNIQUE_INVEN_ITEMS) {
506 mprintf(0, "Max unique count hit on add to inventory\n");
507 return false;
508 }
509
510 if ((type < 0) || (type == OBJ_NONE)) {
511 mprintf(0, "Invalid type on add to inventory\n");
512 return false;
513 }
514
515 if (type != OBJ_WEAPON) {
516 ASSERT(type == OBJ_BUILDING || type == OBJ_ROBOT || type == OBJ_POWERUP || type == OBJ_CLUTTER);
517 return AddObjectItem(type, id, (aux_type != -1) ? aux_type : type, (aux_id != -1) ? aux_id : id, flags,
518 description);
519 } else {
520 // special case for countermeasures
521 return AddCounterMeasure(id, aux_type, aux_id, flags, description);
522 }
523
524 return false;
525}
526
527// adds a special cased CounterMeasure into the inventory
528bool Inventory::AddCounterMeasure(int id, int aux_type, int aux_id, int flags, const char *description) {

Callers 15

OnInitDialogMethod · 0.45
ProcessTestKeysFunction · 0.45
msafe_CallFunctionFunction · 0.45
HandleCommonPowerupsFunction · 0.45
HandleInventoryPowerupsFunction · 0.45
MultiDoEnteringGameFunction · 0.45
MultiDoWorldStatesFunction · 0.45
MultiDoRenewPlayerFunction · 0.45
MultiStartNewLevelFunction · 0.45
InvAddTypeIDFunction · 0.45
dInven_AddFunction · 0.45
DemoCheatsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected