MCPcopy Create free account
hub / github.com/TurningWheel/Barony / shouldItemStack

Method shouldItemStack

src/items.cpp:6858–6942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6856}
6857
6858bool Item::shouldItemStack(const int player, bool ignoreStackLimit) const
6859{
6860 if ( player >= 0 )
6861 {
6862 if ( (!itemIsEquipped(this, player)
6863 && itemCategory(this) != ARMOR
6864 && itemCategory(this) != WEAPON
6865 && itemCategory(this) != MAGICSTAFF
6866 && itemCategory(this) != RING
6867 && itemCategory(this) != AMULET
6868 && itemCategory(this) != SPELLBOOK
6869 && this->type != TOOL_PICKAXE
6870 && this->type != TOOL_ALEMBIC
6871 && this->type != TOOL_TINKERING_KIT
6872 && this->type != TOOL_FRYING_PAN
6873 && this->type != ENCHANTED_FEATHER
6874 && this->type != TOOL_LANTERN
6875 && this->type != TOOL_GLASSES
6876 && this->type != TOOL_MIRROR
6877 && this->type != TOOL_BLINDFOLD
6878 && this->type != TOOL_BLINDFOLD_FOCUS
6879 && this->type != TOOL_BLINDFOLD_TELEPATHY)
6880 || itemCategory(this) == THROWN
6881 || itemCategory(this) == GEM
6882 || itemCategory(this) == POTION
6883 || (itemCategory(this) == TOOL
6884 && this->type != TOOL_PICKAXE
6885 && this->type != TOOL_ALEMBIC
6886 && this->type != TOOL_TINKERING_KIT
6887 && this->type != TOOL_FRYING_PAN
6888 && this->type != ENCHANTED_FEATHER
6889 && this->type != TOOL_LANTERN
6890 && this->type != TOOL_GLASSES
6891 && this->type != TOOL_MIRROR
6892 && this->type != TOOL_BLINDFOLD
6893 && this->type != TOOL_BLINDFOLD_FOCUS
6894 && this->type != TOOL_BLINDFOLD_TELEPATHY)
6895 )
6896 {
6897 // THROWN, GEM, TOOLS, POTIONS should stack when equipped.
6898 // otherwise most equippables should not stack.
6899 if ( itemTypeIsThrownBall(this->type) )
6900 {
6901 if ( !ignoreStackLimit && count >= QUIVER_MAX_AMMO_QTY - 1 )
6902 {
6903 return false;
6904 }
6905 return true;
6906 }
6907 if ( itemCategory(this) == THROWN || itemCategory(this) == GEM )
6908 {
6909 if ( !ignoreStackLimit && count >= THROWN_GEM_MAX_STACK_QTY )
6910 {
6911 return false;
6912 }
6913 }
6914 else if ( itemTypeIsQuiver(this->type) )
6915 {

Callers 5

actPlayerFunction · 0.80
itemPickupFunction · 0.80
quickStackItemsFunction · 0.80

Calls 5

itemIsEquippedFunction · 0.85
itemTypeIsThrownBallFunction · 0.85
itemTypeIsQuiverFunction · 0.85
hasAttributeMethod · 0.80
itemCategoryFunction · 0.70

Tested by

no test coverage detected