void CCreatureSet::addToSlot(SlotID slot, CreatureID cre, TQuantity count, bool allowMerging/* = true*/) { const CCreature *c = VLC->creh->creatures[cre]; if(!hasStackAtSlot(slot)) { setCreature(slot, cre, count); } else if(getCreature(slot) == c && allowMerging) //that slot was empty or contained same type creature { setStackCount(slot, getStackCount(slot) + count); } else { tlog1 << "Failed adding to slot!\n"; } }
void CGHeroInstance::setPropertyDer( ui8 what, ui32 val ) { if(what == ObjProperty::PRIMARY_STACK_COUNT) setStackCount(SlotID(0), val); }
void CCreatureSet::changeStackCount(SlotID slot, TQuantity toAdd) { setStackCount(slot, getStackCount(slot) + toAdd); }