diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 8a94a4c16..0e5ba0c48 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -536,8 +536,10 @@ public: CInterfaceManager *pIM= CInterfaceManager::getInstance(); // Launch the modal to select the faber plan - extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection); - fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection); + extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType); + // from sphrase_manager.cpp + extern TOOL_TYPE::TCraftingToolType getRightHandCraftToolType(); + fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection, getRightHandCraftToolType()); // setup the validation CHandlerPhraseValidateBrick::BuildPhraseGroup= NULL; diff --git a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 40efedac0..1c99983e3 100644 --- a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -257,7 +257,7 @@ void CActionPhraseFaber::onCloseFaberCastWindow() // *************************************************************************** -void CActionPhraseFaber::fillFaberPlanSelection(const std::string &brickDB, uint maxSelection) +void CActionPhraseFaber::fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); CSBrickManager *pBM= CSBrickManager::getInstance(); @@ -268,7 +268,21 @@ void CActionPhraseFaber::fillFaberPlanSelection(const std::string &brickDB, ui for(i=0;i<_FaberPlanBrickFamilies.size();i++) { const std::vector &famBricks= pBM->getFamilyBricks(_FaberPlanBrickFamilies[i]); - bricks.insert(bricks.end(), famBricks.begin(), famBricks.end()); + if (toolType == TOOL_TYPE::Unknown) + { + bricks.insert(bricks.end(), famBricks.begin(), famBricks.end()); + } + else + { + for(std::vector::const_iterator it = famBricks.begin(); it != famBricks.end(); ++it) + { + CSBrickSheet *brick= pBM->getBrick(*it); + if (brick && brick->FaberPlan.ToolType == toolType) + { + bricks.push_back(*it); + } + } + } } // get only ones known @@ -1257,10 +1271,10 @@ void launchFaberCastWindow(sint32 memoryLine, uint memoryIndex, CSBrickSheet *r } // *************************************************************************** -void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection) +void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType) { if (ActionPhraseFaber == NULL) ActionPhraseFaber = new CActionPhraseFaber; - ActionPhraseFaber->fillFaberPlanSelection(brickDB, maxSelection); + ActionPhraseFaber->fillFaberPlanSelection(brickDB, maxSelection, toolType); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/action_phrase_faber.h b/code/ryzom/client/src/interface_v3/action_phrase_faber.h index ba74ef0aa..f406d0ee2 100644 --- a/code/ryzom/client/src/interface_v3/action_phrase_faber.h +++ b/code/ryzom/client/src/interface_v3/action_phrase_faber.h @@ -25,6 +25,7 @@ #include "nel/misc/types_nl.h" #include "inventory_manager.h" +#include "game_share/crafting_tool_type.h" #include "game_share/rm_family.h" #include "game_share/brick_families.h" #include "game_share/item_origin.h" @@ -62,7 +63,7 @@ public: /// Fill the Faber Plan selection DB (no window opened) - void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection); + void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType = TOOL_TYPE::Unknown); /// Called when the user has selected the Plan. copy bag. the itemPlanBrick must have "FaberPlan" good infos. void validateFaberPlanSelection(CSBrickSheet *itemPlanBrick); @@ -249,7 +250,7 @@ private: // Called when click a Faber phrase extern void launchFaberCastWindow(sint32 memoryLine, uint memoryIndex, CSBrickSheet *rootBrick); // Called when select a Faber plan -extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection); +extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType = TOOL_TYPE::Unknown); // Called when the Faber plan is selected extern void validateFaberPlanSelection(CSBrickSheet *itemPlanBrick); // Called when something needs to close the crafting window (does nothing if not open)