Adds a child to this Equipment @param aPC The PC that has the Equipment @param child The child to add
(final PlayerCharacter aPC, final Object child)
| 2872 | * The child to add |
| 2873 | */ |
| 2874 | public void insertChild(final PlayerCharacter aPC, final Object child) |
| 2875 | { |
| 2876 | |
| 2877 | if (child == null) |
| 2878 | { |
| 2879 | return; |
| 2880 | } |
| 2881 | |
| 2882 | Equipment anEquip = (Equipment) child; |
| 2883 | Float aFloat = anEquip.numberCarried(); |
| 2884 | Float bFloat = aFloat; |
| 2885 | |
| 2886 | final String aString = pickChildType(anEquip.eqTypeList(), aFloat); |
| 2887 | |
| 2888 | if (containsChildType(aString)) |
| 2889 | { |
| 2890 | aFloat = getChildType(aString) + aFloat; |
| 2891 | } |
| 2892 | |
| 2893 | bFloat = getChildType("Total") + bFloat; |
| 2894 | setChildType(aString, aFloat); |
| 2895 | setChildType("Total", bFloat); |
| 2896 | addContainedEquipment(anEquip); |
| 2897 | anEquip.setIndexedUnderType(aString); |
| 2898 | anEquip.setParent(this); |
| 2899 | |
| 2900 | // hmm probably not needed; but as it currently isn't hurting |
| 2901 | // anything... |
| 2902 | updateContainerContentsString(aPC); |
| 2903 | |
| 2904 | while (anEquip.getParent() != null) |
| 2905 | { |
| 2906 | anEquip = anEquip.getParent(); |
| 2907 | anEquip.updateContainerContentsString(aPC); |
| 2908 | } |
| 2909 | } |
| 2910 | |
| 2911 | /** |
| 2912 | * Returns how 'deep' in a structure an Equipment is. |
no test coverage detected