Changed: Filter craft plans according to tool type.

fix-media-player
Nimetu 5 years ago
parent 682985978d
commit 5250d22706

@ -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;

@ -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<NLMISC::CSheetId> &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<CSheetId>::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);
}
// ***************************************************************************

@ -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)

Loading…
Cancel
Save