adds a new type/id item to the inventory
| 501 | |
| 502 | // adds a new type/id item to the inventory |
| 503 | bool 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 |
| 528 | bool Inventory::AddCounterMeasure(int id, int aux_type, int aux_id, int flags, const char *description) { |
no outgoing calls
no test coverage detected