MCPcopy Create free account
hub / github.com/PCGen/pcgen / canContain

Method canContain

code/src/java/pcgen/core/Equipment.java:2618–2644  ·  view source on GitHub ↗

Returns 0 on object error, 1 on can fit, 2 on too heavy, 3 on properties problem (unimplemented), 4 on capacity error @param aPC The PC that has the Equipment @param obj The equipment to check @return 0 on object error, 1 on can fit, 2 on too heavy, 3 on properties problem

(final PlayerCharacter aPC, final Object obj)

Source from the content-addressed store, hash-verified

2616 * problem (unimplemented), 4 on capacity error
2617 */
2618 public int canContain(final PlayerCharacter aPC, final Object obj)
2619 {
2620
2621 if (obj instanceof final Equipment anEquip)
2622 {
2623
2624 Float f = (float) (anEquip.getWeightAsDouble(aPC) * anEquip.numberCarried());
2625
2626 if (checkChildWeight(aPC, f))
2627 {
2628
2629 // canHold(my HashMap())) //quick hack since the properties
2630 // hashmap doesn't exist
2631 if (checkContainerCapacity(anEquip.eqTypeList(), anEquip.numberCarried()))
2632 {
2633
2634 // the qty value is a temporary hack - insert all or
2635 // nothing. should reset person to be a container, with
2636 // capacity=capacity
2637 return 1;
2638 }
2639 return 4;
2640 }
2641 return 2;
2642 }
2643 return 0;
2644 }
2645
2646 /**
2647 * Description of the Method

Callers 2

addEquipToTargetMethod · 0.80
canEquipMethod · 0.80

Calls 5

checkChildWeightMethod · 0.95
getWeightAsDoubleMethod · 0.80
numberCarriedMethod · 0.80
eqTypeListMethod · 0.80

Tested by

no test coverage detected