private void checkCreatureInventory(CreResource cre) {
   HexNumber slots_offset = (HexNumber) cre.getAttribute("Item slots offset");
   items.clear();
   slots.clear();
   for (int i = 0; i < cre.getRowCount(); i++) {
     StructEntry entry = cre.getStructEntryAt(i);
     if (entry instanceof Item) items.add(entry);
     else if (entry.getOffset() >= slots_offset.getValue() + cre.getOffset()
         && entry instanceof DecNumber
         && !entry.getName().equals("Weapon slot selected")
         && !entry.getName().equals("Weapon ability selected")) slots.add(entry);
   }
   for (int i = 0; i < slots.size(); i++) {
     DecNumber slot = (DecNumber) slots.get(i);
     if (slot.getValue() >= 0 && slot.getValue() < items.size())
       items.set(slot.getValue(), slots_offset); // Dummy object
   }
   for (int i = 0; i < items.size(); i++) {
     if (items.get(i) != slots_offset) {
       Item item = (Item) items.get(i);
       table.addTableItem(new CreInvError(cre.getResourceEntry(), item, "Item not in inventory"));
     }
   }
 }
 public Iwd2Struct(
     AbstractStruct superStruct, byte buffer[], int offset, DecNumber count, String name, int type)
     throws Exception {
   super(superStruct, name, offset, count.getValue() + 2);
   this.count = count;
   this.type = type;
   if (type == TYPE_SPELL)
     for (int i = 0; i < count.getValue(); i++)
       list.add(new Iwd2Spell(this, buffer, offset + 16 * i));
   else if (type == TYPE_ABILITY)
     for (int i = 0; i < count.getValue(); i++)
       list.add(new Iwd2Ability(this, buffer, offset + 16 * i));
   else if (type == TYPE_SHAPE)
     for (int i = 0; i < count.getValue(); i++)
       list.add(new Iwd2Shape(this, buffer, offset + 16 * i));
   else if (type == TYPE_SONG)
     for (int i = 0; i < count.getValue(); i++)
       list.add(new Iwd2Song(this, buffer, offset + 16 * i));
   list.add(new DecNumber(buffer, offset + 16 * count.getValue(), 4, "# memorizable (total)"));
   list.add(new DecNumber(buffer, offset + 16 * count.getValue() + 4, 4, "# free uses remaining"));
   setOffset(offset);
 }
 protected int getAddedPosition() {
   return count.getValue();
 }
 protected void datatypeRemoved(AddRemovable datatype) {
   count.incValue(-1);
 }