From bc3572462299f72e92bb4ad08615846ab7ad9f23 Mon Sep 17 00:00:00 2001 From: Inky Date: Tue, 8 Jan 2019 02:33:18 +0100 Subject: [PATCH] Added: Inventory filter for animals --HG-- branch : develop --- .../src/interface_v3/inventory_manager.cpp | 18 ++++++++++++++++-- .../src/interface_v3/inventory_manager.h | 12 ++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 0d23e19ec..5f9ff2d3b 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -2003,6 +2003,9 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */) prop = xmlGetProp (cur, (xmlChar*)"filter_tool"); if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); + prop = xmlGetProp (cur, (xmlChar*)"filter_pet"); + if (prop) DbFilterPet = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); + prop = xmlGetProp (cur, (xmlChar*)"filter_mp"); if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); @@ -2079,6 +2082,13 @@ bool SBagOptions::isSomethingChanged() LastDbFilterTool = (DbFilterTool->getValue8() != 0); } + if (DbFilterPet != NULL) + if ((DbFilterPet->getValue8() != 0) != LastDbFilterPet) + { + bRet = true; + LastDbFilterPet = (DbFilterPet->getValue8() != 0); + } + if (DbFilterMP != NULL) if ((DbFilterMP->getValue8() != 0) != LastDbFilterMP) { @@ -2117,6 +2127,7 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const bool bFilterArmor = getFilterArmor(); bool bFilterWeapon = getFilterWeapon(); bool bFilterTool = getFilterTool(); + bool bFilterPet = getFilterPet(); bool bFilterMP = getFilterMP(); bool bFilterMissMP = getFilterMissMP(); bool bFilterTP = getFilterTP(); @@ -2168,10 +2179,13 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const (pIS->Family == ITEMFAMILY::HARVEST_TOOL) || (pIS->Family == ITEMFAMILY::TAMING_TOOL) || (pIS->Family == ITEMFAMILY::TRAINING_TOOL) || - (pIS->Family == ITEMFAMILY::BAG) || - (pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET) ) + (pIS->Family == ITEMFAMILY::BAG)) if (!bFilterTool) bDisplay = false; + // Pet + if (pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET) + if (!bFilterPet) bDisplay = false; + // MP if ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && pIS->canBuildSomeItemPart()) if (!bFilterMP) bDisplay = false; diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.h b/code/ryzom/client/src/interface_v3/inventory_manager.h index d1c5dbe8c..364874f36 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.h +++ b/code/ryzom/client/src/interface_v3/inventory_manager.h @@ -509,6 +509,7 @@ struct SBagOptions NLMISC::CCDBNodeLeaf *DbFilterArmor; NLMISC::CCDBNodeLeaf *DbFilterWeapon; NLMISC::CCDBNodeLeaf *DbFilterTool; + NLMISC::CCDBNodeLeaf *DbFilterPet; NLMISC::CCDBNodeLeaf *DbFilterMP; NLMISC::CCDBNodeLeaf *DbFilterMissMP; NLMISC::CCDBNodeLeaf *DbFilterTP; @@ -516,6 +517,7 @@ struct SBagOptions bool LastDbFilterArmor; bool LastDbFilterWeapon; bool LastDbFilterTool; + bool LastDbFilterPet; bool LastDbFilterMP; bool LastDbFilterMissMP; bool LastDbFilterTP; @@ -529,8 +531,8 @@ struct SBagOptions SBagOptions() { InvType = CInventoryManager::InvUnknown; - DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL; - LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false; + DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterPet = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL; + LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterPet = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false; SearchFilterChanged = false; SearchQualityMin = 0; SearchQualityMax = 999; @@ -561,6 +563,12 @@ struct SBagOptions return (DbFilterTool->getValue8()!=0); } + bool getFilterPet() const + { + if (DbFilterPet == NULL) return true; + return (DbFilterPet->getValue8()!=0); + } + bool getFilterMP() const { if (DbFilterMP == NULL) return true;