Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 7 years ago
commit 5ee74c1c05

@ -1005,7 +1005,6 @@ namespace NLGUI
{
case KeyESCAPE:
_CurrentHistoricIndex= -1;
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
// stop selection
_CurrSelection = NULL;
_CursorAtPreviousLineEnd = false;
@ -1014,6 +1013,7 @@ namespace NLGUI
setInputString(ucstring(""));
triggerOnChangeAH();
}
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
break;
case KeyTAB:
makeTopWindow();

@ -307,6 +307,10 @@ CameraSpeedMin = 2.0;
CameraSpeedMax = 100.0;
CameraResetSpeed = 10.0; // Speed in radian/s
// Default values for map
MaxMapScale = 2.0f;
R2EDMaxMapScale = 8.0f;
//////////////////
// SOUND CONFIG //
//////////////////

@ -122,6 +122,9 @@
<command name="loot" action="inv_temp_all" params="" />
<command name="mapsearch" action="proc" params="map_search_show_set|+" />
<command name="mapsearch" action="proc" params="map_search_show" />
<!-- WebIG -->
<command name="go" action="browse" params="name=ui:interface:webig:content:html|url=home"/>
<command name="webdev" action="browse" params="name=ui:interface:webig:content:html|url=http://localhost/index.html"/>

@ -25,6 +25,8 @@
<action id="teleport" name="uiTeleport" handler="map_teleport" params=""/>
<action id="create_at_user_pos" name="uiCreateUserLMAtUserPos" handler="create_user_landmark_at_user_pos" params=""/>
<separator/>
<action id="search" name="uiMapSearch" handler="proc" params="map_search_show"/>
<separator/>
<action id="center" name="uiMenuCenter" handler="map_center" params="map=ui:interface:map:content:map_content:actual_map"/>
</group>
@ -144,6 +146,7 @@
<!-- * USER MAP * -->
<!-- ******************************************************************** -->
<variable entry="UI:VARIABLES:ISACTIVE:MAP_SEARCH" type="sint32" value="0" />
<proc id="map_proc_active">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:MAP|value=1" />
@ -155,7 +158,49 @@
<action handler="lua" params="if (r2 and r2.Mode == 'Edit') then r2.ToolUI:updateToggleWindowButtons() end" />
</proc>
<proc id="map_search_toggle">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:MAP_SEARCH|value=not(@UI:VARIABLES:ISACTIVE:MAP_SEARCH)"/>
<action handler="proc" params="map_search_focus" cond="@UI:VARIABLES:ISACTIVE:MAP_SEARCH"/>
<action handler="proc" params="map_search_reset" cond="not(@UI:VARIABLES:ISACTIVE:MAP_SEARCH)"/>
</proc>
<proc id="map_search_focus">
<action handler="set_keyboard_focus" params="target=ui:interface:map:content:map_content:lm_search:search:eb|select_all=true" />
</proc>
<proc id="map_search_reset">
<action handler="proc" params="map_search_setfilter" />
</proc>
<proc id="map_search_show">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:MAP_SEARCH|value=1" />
<action handler="proc" params="map_search_focus" />
</proc>
<proc id="map_search_hide">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:MAP_SEARCH|value=0" />
</proc>
<proc id="map_search_setfilter">
<action handler="set" params="target_property=ui:interface:map:content:map_content:lm_search:search:eb:input_string|value='@0'" />
<action handler="land_mark_filter" params="map=ui:interface:map:content:map_content:actual_map|text=@0" />
</proc>
<!-- set search string from /mapsearch command -->
<proc id="map_search_show_set">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:MAP_SEARCH|value=1" />
<action handler="proc" params="map_search_setfilter|@0" />
</proc>
<!-- hide search if focus was lost and input is empty (esc key) -->
<proc id="map_search_focuslost">
<action handler="proc" params="map_search_hide"
cond="eq(getprop('ui:interface:map:content:map_content:lm_search:search:eb:input_string'),'')" />
</proc>
<proc id="map_search_onchange">
<action handler="land_mark_filter" params="map=ui:interface:map:content:map_content:actual_map|group=@0" />
</proc>
<define id="map_min_size" value="256" />
@ -191,8 +236,10 @@
<!-- center on player -->
<ctrl type="button" id="center" button_type="push_button" posparent="zoom_out" posref="TR TL" y="0" x="4" tx_normal="w_center_map.tga" tx_pushed="W_button_16_over.tga" tx_over="W_button_16_over.tga"
onclick_l="map_center" params_l="map=ui:interface:map:content:map_content:actual_map" tooltip="uittCenter" />
<ctrl type="button" id="lm_search_btn" button_type="push_button" posparent="center" posref="TR TL" y="0" x="4" tx_normal="w_help_1.tga" tx_pushed="W_button_16_over.tga" tx_over="W_button_16_over.tga"
onclick_l="proc" params_l="map_search_toggle" tooltip="uittMapSearch" />
<view type="text" id="time" x="12" y="0" posparent="center" posref="MR ML" color="255 255 255 255" fontsize="12" shadow="true" hardtext="" />
<view type="text" id="time" x="12" y="0" posparent="lm_search_btn" posref="MR ML" color="255 255 255 255" fontsize="12" shadow="true" hardtext="" />
<view type="text" id="weather" x="8" y="-16" posref="TL TL" color="255 255 255 255" fontsize="12" shadow="true" hardtext="" />
<ctrl type="tooltip" id="weather_tt" posparent="weather" sizeref="wh" w="0" h="0" tooltip="" tooltip_parent="ctrl" tooltip_posref="BL TL" />
@ -316,11 +363,40 @@
selection_axis_color = "0 0 0 127"
compass="ui:interface:compass"
scale_max="2"
scale_max_r2="8"
/>
<!-- border around the map -->
<group id="lm_search"
posparent="back"
posref="TR TR"
x="-2"
y="-2"
child_resize_w="true"
child_resize_h="true">
<instance template="edit_box_widget"
id="search"
posref="TR TR"
w="150"
clear_on_escape="true"
enter_recover_focus="false"
on_focus_lost="proc" on_focus_lost_params="map_search_focuslost"
onenter=""
onchange="proc" onchange_params="map_search_onchange|ui:interface:map:content:map_content:lm_search:search:eb" />
<ctrl type="button"
id="reset"
button_type="push_button"
posparent="search"
posref="ML MR"
x="-2"
tx_normal="w_close_0.tga"
tx_pushed="w_close_0.tga"
tx_over="W_button_16_over"
onclick_l="proc" params_l="map_search_toggle"
tooltip="" />
<view type="text" id="lm_count" posparent="search" posref="BR TR" x="-2" color="200 200 200 255" fontsize="10" shadow="true" hardtext="0" />
</group>
<link expr="@UI:VARIABLES:ISACTIVE:MAP_SEARCH" target="lm_search:active" />
</group>
</group>
</group>
@ -409,7 +485,6 @@
player_pos_tex="player_pos.tga"
scale_max="2"
/>
<!-- border around the map -->

@ -599,6 +599,9 @@ CClientConfig::CClientConfig()
CameraSpeedMax = 1.0f;
CameraResetSpeed = 2.0f;
MaxMapScale = 2.0f;
R2EDMaxMapScale = 8.0f;
// VERBOSES
VerboseVP = false;
VerboseAnimUser = false;
@ -1456,6 +1459,9 @@ void CClientConfig::setValues()
READ_FLOAT_FV(CameraDistance)
}
// Default values for CGroupMap
READ_FLOAT_FV(MaxMapScale);
READ_FLOAT_FV(R2EDMaxMapScale);
/////////////
// SHADOWS //

@ -591,6 +591,10 @@ struct CClientConfig
float CameraSpeedMax;
float CameraResetSpeed;
// Default values for CGroupMap
float MaxMapScale;
float R2EDMaxMapScale;
//////////////
// VERBOSES //
bool VerboseVP;

@ -1548,12 +1548,48 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &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)
{

@ -426,6 +426,8 @@ CGroupMap::CGroupMap(const TCtorParam &param)
//
_TargetLM = NULL;
_HomeLM = NULL;
_LandmarkFilter.clear();
_MatchedLandmarkCount = 0;
//
_ScaleMax = 8.f;
_ScaleMaxR2 = 8.f;
@ -711,9 +713,11 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
}
//
_ScaleMax = ClientCfg.MaxMapScale;
ptr = (char*) xmlGetProp( cur, (xmlChar*)"scale_max" );
if (ptr) fromString((const char *) ptr, _ScaleMax);
//
_ScaleMaxR2 = ClientCfg.R2EDMaxMapScale;
ptr = (char*) xmlGetProp( cur, (xmlChar*)"scale_max_r2" );
if (ptr) fromString((const char *) ptr, _ScaleMaxR2);
//
@ -900,9 +904,19 @@ void CGroupMap::updateCoords()
// bool newLandMarkShown = false;
uint i;
for (i = 0; i < _ContinentLM.size(); ++i)
{
if (_ContinentLM[i]->SearchMatch)
_ContinentLM[i]->setActive(true);
else
setupFromZoom(_ContinentLM[i], _ContinentLM[i]->Type, _MeterPerPixel);
}
for (i = 0; i < _ContinentText.size(); ++i)
{
if (_ContinentText[i]->SearchMatch)
_ContinentText[i]->setActive(true);
else
setupFromZoom(_ContinentText[i], _ContinentText[i]->Type, _MeterPerPixel);
}
//
updateLandMarkList(_ContinentLM);
updateLandMarkTextList(_ContinentText);
@ -2357,6 +2371,12 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
worldToMap(mapPos, rCLM.Pos);
const ucstring ucsTmp(CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID));
const ucstring lcTitle = toLower(ucsTmp);
bool searchMatch = _LandmarkFilter.size() > 0 && filterLandmark(lcTitle);
if (searchMatch)
_MatchedLandmarkCount++;
// Add button if not a region nor a place
if ((rCLM.Type != CContLandMark::Region) && (rCLM.Type != CContLandMark::Place) &&
(rCLM.Type != CContLandMark::Street))
@ -2366,6 +2386,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
else
addLandMark(_ContinentLM, mapPos, CI18N::get("uiStable"), _ContinentLMOptions);
_ContinentLM.back()->Type = rCLM.Type;
_ContinentLM.back()->SearchMatch = searchMatch;
}
else // just add a text
{
@ -2384,6 +2405,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
pNewText->setShadowColor(CRGBA(0,0,0,255));
pNewText->setModulateGlobalColor(false);
pNewText->Type = rCLM.Type;
pNewText->SearchMatch = searchMatch;
_ContinentText.push_back(pNewText);
addView(pNewText);
}
@ -2413,6 +2435,8 @@ void CGroupMap::createContinentLandMarks()
{
uint32 k;
_MatchedLandmarkCount = 0;
if (_MapMode != MapMode_Normal) return;
if (_CurMap == NULL) return;
@ -2444,8 +2468,24 @@ void CGroupMap::createContinentLandMarks()
NLMISC::CVector2f mapPos;
worldToMap(mapPos, _CurContinent->UserLandMarks[k].Pos);
if (filterLandmark(_CurContinent->UserLandMarks[k].Title))
{
addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k));
_MatchedLandmarkCount++;
}
}
// update visible landmark count
CInterfaceGroup *gc = getParentContainer();
if (gc)
{
CViewText *pVT = dynamic_cast<CViewText *>(gc->getView("lm_count"));
if (pVT)
{
pVT->setText(toString(_MatchedLandmarkCount));
}
}
invalidateCoords();
}
@ -2464,6 +2504,20 @@ static void hideTeleportButtonsInPopupMenuIfNotEnoughPriv()
if(ie) ie->setActive(showTeleport);
}
//============================================================================================================
void CGroupMap::setLandmarkFilter(const std::string &s)
{
_LandmarkFilter.clear();
if (!s.empty()) {
ucstring ucs;
ucs.fromUtf8(s);
splitUCString(toLower(s), ucstring(" "), _LandmarkFilter);
}
// recreate landmarks
createContinentLandMarks();
}
//============================================================================================================
void CGroupMap::updateUserLandMarks()
@ -2549,6 +2603,22 @@ void CGroupMap::updateLandMarkButton(CLandMarkButton *lmb, const CLandMarkOption
lmb->setColorPushed(options.ColorPushed);
}
//============================================================================================================
bool CGroupMap::filterLandmark(const ucstring &title) const
{
if (_LandmarkFilter.size() > 0)
{
ucstring lcTitle = toLower(title);
for(uint i = 0; i< _LandmarkFilter.size(); ++i) {
if (lcTitle.find(_LandmarkFilter[i]) == ucstring::npos) {
return false;
}
}
}
return true;
}
//============================================================================================================
void CGroupMap::addLandMark(TLandMarkButtonVect &destList, const NLMISC::CVector2f &pos, const ucstring &title, const CLandMarkOptions &options)
{
@ -3302,6 +3372,32 @@ SMap *CGroupMap::getParentMap(SMap *map)
// ACTION HANDLERS //
/////////////////////
//=========================================================================================================
// Set landmark filter
class CAHLandMarkFilter : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &params )
{
string id = getParam(params, "map");
CGroupMap* map = dynamic_cast<CGroupMap*>(CWidgetManager::getInstance()->getElementFromId(id));
if (!map) return;
string text = getParam(params, "text");
if (text.empty() && params.find("text=") == std::string::npos)
{
string group = getParam(params, "group");
CGroupEditBox* eb = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(group));
if (!eb) return;
text = eb->getInputString().toUtf8();
}
map->setLandmarkFilter(text);
}
};
REGISTER_ACTION_HANDLER(CAHLandMarkFilter, "land_mark_filter");
//=========================================================================================================
// A land mark button has been pushed
class CAHLandMarkSelected : public IActionHandler

@ -202,6 +202,9 @@ public:
void delArkPoints();
// set landmarks visibility based text query
void setLandmarkFilter(const std::string &s);
// set the selection axis pos & visibility
void setSelectionAxis(bool active, const NLMISC::CVector2f &worldPos = NLMISC::CVector2f::Null);
@ -297,6 +300,7 @@ private:
NLMISC::CVector2f Pos;
CContLandMark::TContLMType Type;
bool HandleEvents;
bool SearchMatch;
public:
virtual bool handleEvent (const NLGUI::CEventDescriptor& event)
{
@ -314,6 +318,7 @@ private:
Type = CContLandMark::Unknown;
Pos.set(0.f, 0.f);
HandleEvents = true;
SearchMatch = false;
}
};
typedef std::vector<CLandMarkButton*> TLandMarkButtonVect;
@ -324,12 +329,14 @@ private:
public:
NLMISC::CVector2f Pos;
CContLandMark::TContLMType Type;
bool SearchMatch;
CLandMarkText(const TCtorParam &param)
: CViewText(param)
{
Type = CContLandMark::Unknown;
Pos.set(0.f, 0.f);
SearchMatch = false;
}
};
typedef std::vector<CLandMarkText*> TLandMarkTextVect;
@ -485,6 +492,10 @@ private:
typedef std::set<IDeco *> TDecos;
TDecos _Decos;
// filter keywords
std::vector<ucstring> _LandmarkFilter;
uint32 _MatchedLandmarkCount;
//////////////////////
// Respawn handling //
// //////////////// //
@ -542,6 +553,9 @@ private:
// update a landmark button
void updateLandMarkButton(CLandMarkButton *lmb, const CLandMarkOptions &options);
// Test title against landmark filter
bool filterLandmark(const ucstring &title) const;
// update the scale depending on the window size and the user scale
void updateScale();

@ -140,6 +140,55 @@ TOOL_TYPE::TCraftingToolType CSabrinaCom::getPhraseFaberPlanToolType(const std:
return TOOL_TYPE::Unknown;
}
// ***************************************************************************
BRICK_FAMILIES::TBrickFamily CSabrinaCom::getPhraseForageFamily(const std::vector<NLMISC::CSheetId> &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; i<phraseBricks.size(); ++i ) // skip the root brick (index 0)
{
const CSheetId& brickId = phraseBricks[i];
uint indexInFamily;
BRICK_FAMILIES::TBrickFamily brickFamily = _BC->getBrickFamily( 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<NLMISC::CSheetId> &phraseBricks) const
{

@ -91,6 +91,9 @@ public:
/// For Faber.
TOOL_TYPE::TCraftingToolType getPhraseFaberPlanToolType(const std::vector<NLMISC::CSheetId> &phraseBricks) const;
//// For Display, if ecosystem is in use, then return it
BRICK_FAMILIES::TBrickFamily getPhraseForageFamily(const std::vector<NLMISC::CSheetId> &phraseBricks) const;
/// For Display. Return the brick (should be in phrase) used to display the phrase as icon
NLMISC::CSheetId getPhraseBestDisplayBrick(const std::vector<NLMISC::CSheetId> &phraseBricks) const;

Loading…
Cancel
Save