Added: home propertie of html group (so lua scripts can setup the home)

Fixed: adding new landmarks with lua don't remove respawn points if player is not in an island

--HG--
branch : compatibility-develop
hg/compatibility-develop
Ulukyn 6 years ago
parent 7d9b1f58f0
commit c582964448

@ -131,7 +131,7 @@ namespace NLGUI
// ImageDownload system // ImageDownload system
enum TDataType {ImgType= 0, BnpType}; enum TDataType {ImgType= 0, BnpType};
enum TImageType {NormalImage=0, OverImage}; enum TImageType {NormalImage=0, OverImage};
// Constructor // Constructor
CGroupHTML(const TCtorParam &param); CGroupHTML(const TCtorParam &param);
~CGroupHTML(); ~CGroupHTML();
@ -177,7 +177,7 @@ namespace NLGUI
// End of the paragraph // End of the paragraph
void endParagraph(); void endParagraph();
// add image download (used by view_bitmap.cpp to load web images) // add image download (used by view_bitmap.cpp to load web images)
void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams(), const TImageType type = NormalImage); void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams(), const TImageType type = NormalImage);
std::string localImageName(const std::string &url); std::string localImageName(const std::string &url);
@ -264,6 +264,8 @@ namespace NLGUI
// Browser home // Browser home
std::string Home; std::string Home;
// Get Home URL
virtual std::string home();
// Undo browse: Browse the precedent url browsed. no op if none // Undo browse: Browse the precedent url browsed. no op if none
void browseUndo (); void browseUndo ();
@ -281,6 +283,8 @@ namespace NLGUI
std::string getHTML() const { return _DocumentHtml; } std::string getHTML() const { return _DocumentHtml; }
void setHTML(const std::string &html); void setHTML(const std::string &html);
void setHome(const std::string &home);
int luaClearRefresh(CLuaState &ls); int luaClearRefresh(CLuaState &ls);
int luaClearUndoRedo(CLuaState &ls); int luaClearUndoRedo(CLuaState &ls);
int luaBrowse(CLuaState &ls); int luaBrowse(CLuaState &ls);
@ -313,6 +317,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("setBackground", luaSetBackground) REFLECT_LUA_METHOD("setBackground", luaSetBackground)
REFLECT_STRING("url", getURL, setURL) REFLECT_STRING("url", getURL, setURL)
REFLECT_STRING("html", getHTML, setHTML) REFLECT_STRING("html", getHTML, setHTML)
REFLECT_STRING("home", home, setHome)
REFLECT_FLOAT("timeout", getTimeout, setTimeout) REFLECT_FLOAT("timeout", getTimeout, setTimeout)
REFLECT_EXPORT_END REFLECT_EXPORT_END
@ -354,9 +359,6 @@ namespace NLGUI
void htmlElement(xmlNode *node, int element_number); void htmlElement(xmlNode *node, int element_number);
void htmlWalkDOM(xmlNode *a_node); void htmlWalkDOM(xmlNode *a_node);
// Get Home URL
virtual std::string home();
// Clear style stack and restore default style // Clear style stack and restore default style
void resetCssStyle(); void resetCssStyle();
@ -425,7 +427,7 @@ namespace NLGUI
std::string _DocumentUrl; std::string _DocumentUrl;
std::string _DocumentDomain; std::string _DocumentDomain;
std::string _DocumentHtml; // not updated only set by first render std::string _DocumentHtml; // not updated only set by first render
// Valid base href was found // Valid base href was found
bool _IgnoreBaseUrlTag; bool _IgnoreBaseUrlTag;
// Fragment from loading url // Fragment from loading url
@ -730,7 +732,7 @@ namespace NLGUI
return 0; return 0;
return _Indent.back(); return _Indent.back();
} }
// Current node is a title // Current node is a title
@ -821,7 +823,7 @@ namespace NLGUI
private: private:
// decode all HTML entities // decode all HTML entities
static ucstring decodeHTMLEntities(const ucstring &str); static ucstring decodeHTMLEntities(const ucstring &str);
struct CDataImageDownload struct CDataImageDownload
{ {
public: public:

@ -306,10 +306,10 @@ namespace NLGUI
sint32 height = style.Height; sint32 height = style.Height;
sint32 maxw = style.MaxWidth; sint32 maxw = style.MaxWidth;
sint32 maxh = style.MaxHeight; sint32 maxh = style.MaxHeight;
sint32 imageWidth, imageHeight; sint32 imageWidth, imageHeight;
bool changed = true; bool changed = true;
// get image texture size // get image texture size
// if image is being downloaded, then correct size is set after thats done // if image is being downloaded, then correct size is set after thats done
CCtrlButton *btn = dynamic_cast<CCtrlButton*>(view); CCtrlButton *btn = dynamic_cast<CCtrlButton*>(view);
@ -334,14 +334,14 @@ namespace NLGUI
return; return;
} }
} }
// if width/height is not requested, then use image size // if width/height is not requested, then use image size
// else recalculate missing value, keep image ratio // else recalculate missing value, keep image ratio
if (width == -1 && height == -1) if (width == -1 && height == -1)
{ {
width = imageWidth; width = imageWidth;
height = imageHeight; height = imageHeight;
changed = false; changed = false;
} }
else else
@ -352,7 +352,7 @@ namespace NLGUI
else else
height = width / ratio; height = width / ratio;
} }
// apply max-width, max-height rules if asked // apply max-width, max-height rules if asked
if (maxw > -1 || maxh > -1) if (maxw > -1 || maxh > -1)
{ {
@ -1680,7 +1680,7 @@ namespace NLGUI
typedef pair<string, string> TTmplParam; typedef pair<string, string> TTmplParam;
vector<TTmplParam> tmplParams; vector<TTmplParam> tmplParams;
string templateName; string templateName;
if (!style.empty()) if (!style.empty())
{ {
@ -1796,7 +1796,7 @@ namespace NLGUI
it = styles.find("background-repeat"); it = styles.find("background-repeat");
bool repeat = (it != styles.end() && it->second == "1"); bool repeat = (it != styles.end() && it->second == "1");
// Webig only // Webig only
it = styles.find("background-scale"); it = styles.find("background-scale");
bool scale = (it != styles.end() && it->second == "1"); bool scale = (it != styles.end() && it->second == "1");
@ -3331,12 +3331,12 @@ namespace NLGUI
} }
else else
if( name == "error_color_global_color" ) if( name == "error_color_global_color" )
{ {
return toString( ErrorColorGlobalColor ); return toString( ErrorColorGlobalColor );
} }
else else
if( name == "link_color_global_color" ) if( name == "link_color_global_color" )
{ {
return toString( LinkColorGlobalColor ); return toString( LinkColorGlobalColor );
} }
else else
@ -3346,67 +3346,67 @@ namespace NLGUI
} }
else else
if( name == "h1_color_global_color" ) if( name == "h1_color_global_color" )
{ {
return toString( H1ColorGlobalColor ); return toString( H1ColorGlobalColor );
} }
else else
if( name == "h2_color_global_color" ) if( name == "h2_color_global_color" )
{ {
return toString( H2ColorGlobalColor ); return toString( H2ColorGlobalColor );
} }
else else
if( name == "h3_color_global_color" ) if( name == "h3_color_global_color" )
{ {
return toString( H3ColorGlobalColor ); return toString( H3ColorGlobalColor );
} }
else else
if( name == "h4_color_global_color" ) if( name == "h4_color_global_color" )
{ {
return toString( H4ColorGlobalColor ); return toString( H4ColorGlobalColor );
} }
else else
if( name == "h5_color_global_color" ) if( name == "h5_color_global_color" )
{ {
return toString( H5ColorGlobalColor ); return toString( H5ColorGlobalColor );
} }
else else
if( name == "h6_color_global_color" ) if( name == "h6_color_global_color" )
{ {
return toString( H6ColorGlobalColor ); return toString( H6ColorGlobalColor );
} }
else else
if( name == "text_font_size" ) if( name == "text_font_size" )
{ {
return toString( TextFontSize ); return toString( TextFontSize );
} }
else else
if( name == "h1_font_size" ) if( name == "h1_font_size" )
{ {
return toString( H1FontSize ); return toString( H1FontSize );
} }
else else
if( name == "h2_font_size" ) if( name == "h2_font_size" )
{ {
return toString( H2FontSize ); return toString( H2FontSize );
} }
else else
if( name == "h3_font_size" ) if( name == "h3_font_size" )
{ {
return toString( H3FontSize ); return toString( H3FontSize );
} }
else else
if( name == "h4_font_size" ) if( name == "h4_font_size" )
{ {
return toString( H4FontSize ); return toString( H4FontSize );
} }
else else
if( name == "h5_font_size" ) if( name == "h5_font_size" )
{ {
return toString( H5FontSize ); return toString( H5FontSize );
} }
else else
if( name == "h6_font_size" ) if( name == "h6_font_size" )
{ {
return toString( H6FontSize ); return toString( H6FontSize );
} }
else else
@ -3615,7 +3615,7 @@ namespace NLGUI
} }
else else
if( name == "error_color_global_color" ) if( name == "error_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
ErrorColorGlobalColor = b; ErrorColorGlobalColor = b;
@ -3623,7 +3623,7 @@ namespace NLGUI
} }
else else
if( name == "link_color_global_color" ) if( name == "link_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
LinkColorGlobalColor = b; LinkColorGlobalColor = b;
@ -3639,7 +3639,7 @@ namespace NLGUI
} }
else else
if( name == "h1_color_global_color" ) if( name == "h1_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
H1ColorGlobalColor = b; H1ColorGlobalColor = b;
@ -3647,7 +3647,7 @@ namespace NLGUI
} }
else else
if( name == "h2_color_global_color" ) if( name == "h2_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
H2ColorGlobalColor = b; H2ColorGlobalColor = b;
@ -3655,7 +3655,7 @@ namespace NLGUI
} }
else else
if( name == "h3_color_global_color" ) if( name == "h3_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
H3ColorGlobalColor = b; H3ColorGlobalColor = b;
@ -3663,7 +3663,7 @@ namespace NLGUI
} }
else else
if( name == "h4_color_global_color" ) if( name == "h4_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
H4ColorGlobalColor = b; H4ColorGlobalColor = b;
@ -3671,7 +3671,7 @@ namespace NLGUI
} }
else else
if( name == "h5_color_global_color" ) if( name == "h5_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
H5ColorGlobalColor = b; H5ColorGlobalColor = b;
@ -3679,7 +3679,7 @@ namespace NLGUI
} }
else else
if( name == "h6_color_global_color" ) if( name == "h6_color_global_color" )
{ {
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
H6ColorGlobalColor = b; H6ColorGlobalColor = b;
@ -3687,7 +3687,7 @@ namespace NLGUI
} }
else else
if( name == "text_font_size" ) if( name == "text_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
TextFontSize = i; TextFontSize = i;
@ -3695,7 +3695,7 @@ namespace NLGUI
} }
else else
if( name == "h1_font_size" ) if( name == "h1_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
H1FontSize = i; H1FontSize = i;
@ -3703,7 +3703,7 @@ namespace NLGUI
} }
else else
if( name == "h2_font_size" ) if( name == "h2_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
H2FontSize = i; H2FontSize = i;
@ -3711,7 +3711,7 @@ namespace NLGUI
} }
else else
if( name == "h3_font_size" ) if( name == "h3_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
H3FontSize = i; H3FontSize = i;
@ -3719,7 +3719,7 @@ namespace NLGUI
} }
else else
if( name == "h4_font_size" ) if( name == "h4_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
H4FontSize = i; H4FontSize = i;
@ -3727,7 +3727,7 @@ namespace NLGUI
} }
else else
if( name == "h5_font_size" ) if( name == "h5_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
H5FontSize = i; H5FontSize = i;
@ -3735,7 +3735,7 @@ namespace NLGUI
} }
else else
if( name == "h6_font_size" ) if( name == "h6_font_size" )
{ {
uint i; uint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
H6FontSize = i; H6FontSize = i;
@ -3920,7 +3920,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "h4_color", BAD_CAST toString( H4Color ).c_str() ); xmlSetProp( node, BAD_CAST "h4_color", BAD_CAST toString( H4Color ).c_str() );
xmlSetProp( node, BAD_CAST "h5_color", BAD_CAST toString( H5Color ).c_str() ); xmlSetProp( node, BAD_CAST "h5_color", BAD_CAST toString( H5Color ).c_str() );
xmlSetProp( node, BAD_CAST "h6_color", BAD_CAST toString( H6Color ).c_str() ); xmlSetProp( node, BAD_CAST "h6_color", BAD_CAST toString( H6Color ).c_str() );
xmlSetProp( node, BAD_CAST "error_color_global_color", xmlSetProp( node, BAD_CAST "error_color_global_color",
BAD_CAST toString( ErrorColorGlobalColor ).c_str() ); BAD_CAST toString( ErrorColorGlobalColor ).c_str() );
xmlSetProp( node, BAD_CAST "link_color_global_color", xmlSetProp( node, BAD_CAST "link_color_global_color",
@ -4580,7 +4580,7 @@ namespace NLGUI
getParagraph()->addChild (buttonGroup); getParagraph()->addChild (buttonGroup);
paragraphChange (); paragraphChange ();
} }
} }
else else
{ {
@ -6094,14 +6094,14 @@ namespace NLGUI
} }
// *************************************************************************** // ***************************************************************************
int CGroupHTML::luaInsertText(CLuaState &ls) int CGroupHTML::luaInsertText(CLuaState &ls)
{ {
const char *funcName = "insertText"; const char *funcName = "insertText";
CLuaIHM::checkArgCount(ls, funcName, 3); CLuaIHM::checkArgCount(ls, funcName, 3);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN);
string name = ls.toString(1); string name = ls.toString(1);
ucstring text; ucstring text;
@ -6271,6 +6271,10 @@ namespace NLGUI
renderHtmlString(html); renderHtmlString(html);
} }
void CGroupHTML::setHome(const std::string &home)
{
Home = home;
}
// *************************************************************************** // ***************************************************************************
inline bool isDigit(ucchar c, uint base = 16) inline bool isDigit(ucchar c, uint base = 16)
@ -6732,7 +6736,7 @@ namespace NLGUI
maxw = std::max(minw, maxw); maxw = std::max(minw, maxw);
maxh = std::max(minh, maxh); maxh = std::max(minh, maxh);
float ratio = (float) width / std::max(1, height); float ratio = (float) width / std::max(1, height);
if (width > maxw) if (width > maxw)
{ {
@ -6791,7 +6795,7 @@ namespace NLGUI
height = minh; height = minh;
} }
} }
// *************************************************************************** // ***************************************************************************
std::string CGroupHTML::HTMLOListElement::getListMarkerText() const std::string CGroupHTML::HTMLOListElement::getListMarkerText() const
{ {

@ -32,6 +32,7 @@
#include "nel/gui/action_handler.h" #include "nel/gui/action_handler.h"
#include "../dummy_progress.h" #include "../dummy_progress.h"
#include "group_compas.h" #include "group_compas.h"
#include "group_html_cs.h"
#include "../connection.h" #include "../connection.h"
#include "../net_manager.h" #include "../net_manager.h"
#include "people_interraction.h" // for MaxNumPeopleInTeam #include "people_interraction.h" // for MaxNumPeopleInTeam
@ -114,10 +115,10 @@ static void popupLandMarkNameDialog()
gc->center(); gc->center();
CWidgetManager::getInstance()->setTopWindow(gc); CWidgetManager::getInstance()->setTopWindow(gc);
gc->enableBlink(1); gc->enableBlink(1);
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb")); CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb"));
if (!eb) return; if (!eb) return;
// Load ComboBox for Landmarks & sort entries // Load ComboBox for Landmarks & sort entries
CDBGroupComboBox *cb = dynamic_cast<CDBGroupComboBox *>(gc->getGroup("landmarktypes")); CDBGroupComboBox *cb = dynamic_cast<CDBGroupComboBox *>(gc->getGroup("landmarktypes"));
cb->sortText(); cb->sortText();
@ -126,7 +127,7 @@ static void popupLandMarkNameDialog()
{ {
CGroupMap *map = dynamic_cast<CGroupMap *>(LastSelectedLandMark->getParent()); CGroupMap *map = dynamic_cast<CGroupMap *>(LastSelectedLandMark->getParent());
if (!map) return; if (!map) return;
const CUserLandMark userLM = map->getUserLandMark(LastSelectedLandMark); const CUserLandMark userLM = map->getUserLandMark(LastSelectedLandMark);
NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(userLM.Type)); NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(userLM.Type));
@ -1207,22 +1208,54 @@ void CGroupMap::checkCoords()
// **** retrieve pos of respawn and update it, or hide it if there's no target // **** retrieve pos of respawn and update it, or hide it if there's no target
uint i; uint i;
uint offset = 0;
if (!_ArkPoints.empty())
{
offset = _ArkPoints.size();
if (_ArkPoints.size() < _RespawnLM.size())
{
for (i = (uint)_ArkPoints.size(); i < _RespawnLM.size(); i++)
{
delCtrl(_RespawnLM[i]);
_RespawnLM[i] = NULL;
}
}
if (_ArkPoints.empty()) // Ark points replace Respawn Points _RespawnLM.resize(_ArkPoints.size(), NULL);
for(i = 0; i < _ArkPoints.size(); i++)
{
if (_RespawnLM[i] == NULL)
{
_RespawnLM[i] = createArkPointButton(_ArkPoints[i]);
_RespawnLM[i]->setId(this->getId() + ":arklm_" + NLMISC::toString(i));
_RespawnLM[i]->setParent(this);
ucstring title;
title.fromUtf8(_ArkPoints[i].Title);
_RespawnLM[i]->setDefaultContextHelp(title);
_RespawnLM[i]->HandleEvents = true;
addCtrl(_RespawnLM[i]);
updateLMPosFromDBPos(_RespawnLM[i], _ArkPoints[i].x, _ArkPoints[i].y);
}
}
}
if (_ArkPoints.empty() || !isIsland())
{ {
if (_RespawnPos.size() < _RespawnLM.size()) if (offset + _RespawnPos.size() < _RespawnLM.size())
{ {
for (i = (uint)_RespawnPos.size(); i < _RespawnLM.size(); i++) for (i = offset + _RespawnPos.size(); i < _RespawnLM.size(); i++)
{ {
delCtrl(_RespawnLM[i]); delCtrl(_RespawnLM[i]);
_RespawnLM[i] = NULL; _RespawnLM[i] = NULL;
} }
} }
_RespawnLM.resize(_RespawnPos.size(), NULL); _RespawnLM.resize(offset + _RespawnPos.size(), NULL);
for(i = 0; i < _RespawnPos.size(); ++i) for(int j = 0; j < _RespawnPos.size(); ++j)
{ {
i = offset + j;
if (_RespawnLM[i] == NULL) if (_RespawnLM[i] == NULL)
{ {
_RespawnLM[i] = createLandMarkButton(_RespawnLMOptions); _RespawnLM[i] = createLandMarkButton(_RespawnLMOptions);
@ -1245,38 +1278,11 @@ void CGroupMap::checkCoords()
addCtrl(_RespawnLM[i]); addCtrl(_RespawnLM[i]);
} }
if (_RespawnLM[i]) if (_RespawnLM[i])
updateLMPosFromDBPos(_RespawnLM[i], _RespawnPos[i].x, _RespawnPos[i].y); updateLMPosFromDBPos(_RespawnLM[i], _RespawnPos[j].x, _RespawnPos[j].y);
} }
} }
else
{
if (_ArkPoints.size() < _RespawnLM.size())
{
for (i = (uint)_ArkPoints.size(); i < _RespawnLM.size(); i++)
{
delCtrl(_RespawnLM[i]);
_RespawnLM[i] = NULL;
}
}
_RespawnLM.resize(_ArkPoints.size(), NULL);
for(i = 0; i < _ArkPoints.size(); i++)
{
if (_RespawnLM[i] == NULL)
{
_RespawnLM[i] = createArkPointButton(_ArkPoints[i]);
_RespawnLM[i]->setId(this->getId() + ":arklm_" + NLMISC::toString(i));
_RespawnLM[i]->setParent(this);
ucstring title;
title.fromUtf8(_ArkPoints[i].Title);
_RespawnLM[i]->setDefaultContextHelp(title);
_RespawnLM[i]->HandleEvents = true;
addCtrl(_RespawnLM[i]);
updateLMPosFromDBPos(_RespawnLM[i], _ArkPoints[i].x, _ArkPoints[i].y);
}
}
}
if ((_MapMode == MapMode_Death) || (_MapMode == MapMode_SpawnSquad)) if ((_MapMode == MapMode_Death) || (_MapMode == MapMode_SpawnSquad))
{ {
if (_RespawnPosReseted) if (_RespawnPosReseted)
@ -1381,7 +1387,7 @@ void CGroupMap::checkCoords()
{ {
if (_TeammateLM[i]) if (_TeammateLM[i])
{ {
sint32 px, py; sint32 px, py;
if (_TeammatePosStates[i]->getPos(px, py)) if (_TeammatePosStates[i]->getPos(px, py))
@ -2271,6 +2277,21 @@ void CGroupMap::setMap(SMap *map)
invalidateCoords(); invalidateCoords();
createContinentLandMarks(); createContinentLandMarks();
nlinfo("setMap (%f,%f) (%f,%f)", _CurMap->MinX, _CurMap->MinY, _CurMap->MaxX, _CurMap->MaxY);
delArkPoints();
CGroupHTML *groupHtml = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:lm_events:html"));
if (groupHtml)
{
groupHtml->setHome(groupHtml->Home+toString("&min_x=%f&min_y=%f&max_x=%f&max_y=%f", _CurMap->MinX, _CurMap->MinY, _CurMap->MaxX, _CurMap->MaxY));
if (groupHtml->isBrowsing())
groupHtml->stopBrowse();
groupHtml->browse(groupHtml->Home.c_str());
}
if (_CurContinent != NULL) if (_CurContinent != NULL)
_MapMaterial.setTexture(1, _CurContinent->FoW.Tx); _MapMaterial.setTexture(1, _CurContinent->FoW.Tx);
else else
@ -2626,7 +2647,7 @@ static void hideTeleportButtonsInPopupMenuIfNotEnoughPriv()
CInterfaceElement *ie = CWidgetManager::getInstance()->getElementFromId("ui:interface:map_menu:teleport"); CInterfaceElement *ie = CWidgetManager::getInstance()->getElementFromId("ui:interface:map_menu:teleport");
if(ie) ie->setActive(showTeleport); if(ie) ie->setActive(showTeleport);
ie = CWidgetManager::getInstance()->getElementFromId("ui:interface:map_menu_island:teleport"); ie = CWidgetManager::getInstance()->getElementFromId("ui:interface:map_menu_island:teleport");
if(ie) ie->setActive(showTeleport); if(ie) ie->setActive(showTeleport);
@ -2723,7 +2744,7 @@ CGroupMap::CLandMarkButton *CGroupMap::createArkPointButton(const CArkPoint &poi
lmb->setColorOver(point.Color); lmb->setColorOver(point.Color);
lmb->setColorPushed(point.Color); lmb->setColorPushed(point.Color);
lmb->setModulateGlobalColorAll(false); lmb->setModulateGlobalColorAll(false);
lmb->setPosRef(Hotspot_MM); lmb->setPosRef(Hotspot_MM);
return lmb; return lmb;
} }
@ -2772,13 +2793,13 @@ void CGroupMap::addLandMark(TLandMarkButtonVect &destList, const NLMISC::CVector
void CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucstring &title, NLMISC::CRGBA color) void CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucstring &title, NLMISC::CRGBA color)
{ {
if (_CurContinent == NULL) return; if (_CurContinent == NULL) return;
CUserLandMark ulm; CUserLandMark ulm;
mapToWorld(ulm.Pos, pos); mapToWorld(ulm.Pos, pos);
ulm.Title = title; ulm.Title = title;
ulm.Type = 5; ulm.Type = 5;
_CurContinent->UserLandMarks.push_back(ulm); _CurContinent->UserLandMarks.push_back(ulm);
CLandMarkOptions options(_UserLMOptions); CLandMarkOptions options(_UserLMOptions);
options.ColorNormal = options.ColorOver = options.ColorPushed = color; options.ColorNormal = options.ColorOver = options.ColorPushed = color;
// create a new button and add it to the list // create a new button and add it to the list
@ -2894,7 +2915,7 @@ CUserLandMark CGroupMap::getUserLandMark(CCtrlButton *button) const
} }
} }
return ulm; return ulm;
} }
@ -2907,7 +2928,7 @@ uint CGroupMap::getNumUserLandMarks() const
//============================================================================================================ //============================================================================================================
CLandMarkOptions CGroupMap::getUserLandMarkOptions(uint32 lmindex) const CLandMarkOptions CGroupMap::getUserLandMarkOptions(uint32 lmindex) const
{ {
if (_CurContinent == NULL || _CurContinent->UserLandMarks.size() < lmindex) if (_CurContinent == NULL || _CurContinent->UserLandMarks.size() < lmindex)
return _UserLMOptions; return _UserLMOptions;
CLandMarkOptions clmo(_UserLMOptions); CLandMarkOptions clmo(_UserLMOptions);
@ -3936,9 +3957,9 @@ REGISTER_ACTION_HANDLER(CAHMapTeleport, "map_teleport");
//========================================================================================================= //=========================================================================================================
// update LandMarks Colors // update LandMarks Colors
class CUpdateLandMarksColor : public IActionHandler{public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) class CUpdateLandMarksColor : public IActionHandler{public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CUserLandMark::_LandMarksColor[CUserLandMark::Misc] = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:LANDMARK:COLORS:MISC")->getValueRGBA(); CUserLandMark::_LandMarksColor[CUserLandMark::Misc] = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:LANDMARK:COLORS:MISC")->getValueRGBA();
CUserLandMark::_LandMarksColor[CUserLandMark::Tribe] = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:LANDMARK:COLORS:TRIBE")->getValueRGBA(); CUserLandMark::_LandMarksColor[CUserLandMark::Tribe] = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:LANDMARK:COLORS:TRIBE")->getValueRGBA();
@ -3972,10 +3993,10 @@ class CUpdateLandMarksColor : public IActionHandler{public: virtual void execute
CUserLandMark::_LandMarksColor[CUserLandMark::Teleporter] = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:LANDMARK:COLORS:TELEPORTER")->getValueRGBA(); CUserLandMark::_LandMarksColor[CUserLandMark::Teleporter] = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:LANDMARK:COLORS:TELEPORTER")->getValueRGBA();
CGroupMap *pGM = dynamic_cast<CGroupMap *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map")); CGroupMap *pGM = dynamic_cast<CGroupMap *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map"));
if (pGM == NULL) return; if (pGM == NULL) return;
pGM->updateUserLandMarks(); pGM->updateUserLandMarks();
}}; }};
REGISTER_ACTION_HANDLER (CUpdateLandMarksColor, "update_landmarks_color"); REGISTER_ACTION_HANDLER (CUpdateLandMarksColor, "update_landmarks_color");

Loading…
Cancel
Save