From b48b1dc0cccdf6f69b188fb0fd02aa90741980f5 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 2 May 2018 17:05:35 +0300 Subject: [PATCH] Changed: Set icon background from land speciality sbrick --HG-- branch : develop --- .../client/src/interface_v3/dbctrl_sheet.cpp | 38 +++++++++++++- .../common/src/game_share/sabrina_com.cpp | 49 +++++++++++++++++++ .../ryzom/common/src/game_share/sabrina_com.h | 3 ++ 3 files changed, 89 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 88b454279..0533441cf 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -1548,12 +1548,48 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bri // Get the best SBrick to display. CSheetId rootBrickSheetId= bricks[0]; - { CSheetId bestBrickSheetId= pBM->getSabrinaCom().getPhraseBestDisplayBrick(bricks); setupDisplayAsSBrick (rootBrickSheetId.asInt(), bestBrickSheetId.asInt() ); } + // Override background if type is forace extraction/prospection and ecosystem brick is used + { + BRICK_FAMILIES::TBrickFamily family = pBM->getSabrinaCom().getPhraseForageFamily(bricks); + std::string icon; + switch(family) + { + case BRICK_FAMILIES::BHFEMA: + case BRICK_FAMILIES::BHFPMA: + icon = "bk_matis_brick.tga"; + break; + case BRICK_FAMILIES::BHFEMB: + case BRICK_FAMILIES::BHFPMB: + icon = "bk_fyros_brick.tga"; + break; + case BRICK_FAMILIES::BHFEMC: + case BRICK_FAMILIES::BHFPMC: + icon = "bk_zorai_brick.tga"; + break; + case BRICK_FAMILIES::BHFEMD: + case BRICK_FAMILIES::BHFPMD: + icon = "bk_tryker_brick.tga"; + break; + case BRICK_FAMILIES::BHFEME: + case BRICK_FAMILIES::BHFPME: + icon = "bk_generic_brick.tga"; + break; + default: + icon = ""; + break; + } + if (!icon.empty()) + { + CViewRenderer &rVR = *CViewRenderer::getInstance(); + _DispBackBmpId = rVR.getTextureIdFromName(icon); + } + } + // not so beautiful to display .sphrase name in progression, and in botchat if(_ActualType==SheetType_SPhraseId) { diff --git a/code/ryzom/common/src/game_share/sabrina_com.cpp b/code/ryzom/common/src/game_share/sabrina_com.cpp index 234bf2a87..e7d21cd60 100644 --- a/code/ryzom/common/src/game_share/sabrina_com.cpp +++ b/code/ryzom/common/src/game_share/sabrina_com.cpp @@ -140,6 +140,55 @@ TOOL_TYPE::TCraftingToolType CSabrinaCom::getPhraseFaberPlanToolType(const std: return TOOL_TYPE::Unknown; } +// *************************************************************************** +BRICK_FAMILIES::TBrickFamily CSabrinaCom::getPhraseForageFamily(const std::vector &phraseBricks) const +{ + if(phraseBricks.empty()) + return BRICK_FAMILIES::Unknown; + + BRICK_TYPE::EBrickType bType= _BC->getBrickType(phraseBricks[0]); + if ( (bType == BRICK_TYPE::FORAGE_PROSPECTION) || (bType == BRICK_TYPE::FORAGE_EXTRACTION) ) + { + for ( uint i=1; igetBrickFamily( brickId, indexInFamily ); + // FPMA=prospection, FEMA=extraction + if ((brickFamily == BRICK_FAMILIES::BHFPMA || brickFamily == BRICK_FAMILIES::BHFEMA)) + { + // remapping need to be used because prospection ecosystem families + // have resource speciality inserted right in the middle + // luckily indexInFamily and TBrickFamily is defined in the same order + BRICK_FAMILIES::TBrickFamily bf = (BRICK_FAMILIES::TBrickFamily)(brickFamily + indexInFamily - 1); + // A:matis, B:fyros, C:zorai, D:tryker, E:prime roots + switch (bf) { + case BRICK_FAMILIES::BHFPMA: + case BRICK_FAMILIES::BHFPMB: + return bf; + case BRICK_FAMILIES::BHFPRMFMA: + return BRICK_FAMILIES::BHFPMC; + case BRICK_FAMILIES::BHFPRMFMB: + return BRICK_FAMILIES::BHFPMD; + case BRICK_FAMILIES::BHFPRMFMC: + return BRICK_FAMILIES::BHFPME; + case BRICK_FAMILIES::BHFEMA: + case BRICK_FAMILIES::BHFEMB: + case BRICK_FAMILIES::BHFEMC: + case BRICK_FAMILIES::BHFEMD: + case BRICK_FAMILIES::BHFEME: + return bf; + default: + break; + } + } + } + } + + return BRICK_FAMILIES::Unknown; +} + // *************************************************************************** NLMISC::CSheetId CSabrinaCom::getPhraseBestDisplayBrick(const std::vector &phraseBricks) const { diff --git a/code/ryzom/common/src/game_share/sabrina_com.h b/code/ryzom/common/src/game_share/sabrina_com.h index 4613cdcd0..d799a421e 100644 --- a/code/ryzom/common/src/game_share/sabrina_com.h +++ b/code/ryzom/common/src/game_share/sabrina_com.h @@ -91,6 +91,9 @@ public: /// For Faber. TOOL_TYPE::TCraftingToolType getPhraseFaberPlanToolType(const std::vector &phraseBricks) const; + //// For Display, if ecosystem is in use, then return it + BRICK_FAMILIES::TBrickFamily getPhraseForageFamily(const std::vector &phraseBricks) const; + /// For Display. Return the brick (should be in phrase) used to display the phrase as icon NLMISC::CSheetId getPhraseBestDisplayBrick(const std::vector &phraseBricks) const;