From c75071b4887035feb940adbbe9a73d6fceb3bbfc Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Mon, 15 Feb 2021 02:17:50 +0100 Subject: [PATCH 01/28] Handle hiding the flag and inversing translations for each language --- .../src/interface_v3/chat_text_manager.cpp | 21 ++++++++++++------- .../interface_v3/group_in_scene_bubble.cpp | 9 +++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index ec0aee822..c8a07f0f8 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -424,27 +424,30 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C ucstring::size_type pos = 0; - // Manage Translations - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false); - bool originalFirst = node->getValueBool(); - string::size_type startTr = msg.find(ucstring("{:")); string::size_type endOfOriginal = msg.find(ucstring("}@{")); // Original/Translated case, example: {:enHello the world!}@{ Bonjour le monde ! if (startTr != string::npos && endOfOriginal != string::npos) { + string lang = toUpper(msg.substr(startTr+2, 2)).toString(); + + CCDBNodeLeaf *nodeInverse = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:TRANSLATION:" + lang + ":INVERSE_DISPLAY", false); + bool inverse = nodeInverse->getValueBool(); + CCDBNodeLeaf *nodeHideFlag = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:TRANSLATION:" + lang + ":HIDE_FLAG", false); + bool hideFlag = nodeHideFlag->getValueBool(); + CViewBase *vt = createMsgTextSimple(msg.substr(0, startTr), col, justified, NULL); para->addChild(vt); string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga"; ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5); - ucstring translation = msg.substr(endOfOriginal+3); + ucstring translation = msg.substr(endOfOriginal+4); CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam()); ctrlButton->setTexture(texture); ctrlButton->setTextureOver(texture); ctrlButton->setTexturePushed(texture); - if (!originalFirst) + if (!inverse) { ctrlButton->setDefaultContextHelp(original); pos = endOfOriginal+3; @@ -456,7 +459,11 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C textSize = endOfOriginal; } ctrlButton->setId("tr"); - para->addChild(ctrlButton); + if (hideFlag) { + delete ctrlButton; + } else { + para->addChild(ctrlButton); + } } // quickly check if text has links or not diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index 015800173..e2fca2053 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -875,16 +875,19 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, // Clean bubble from translation system - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false); - bool originalFirst = node->getValueBool(); ucstring::size_type pos = 0; ucstring::size_type textSize = ucsText.size(); string::size_type startTr = ucsText.find(ucstring("{:")); string::size_type endOfOriginal = ucsText.find(ucstring("}@{")); + + string lang = toUpper(ucsText.substr(startTr+2, 2)).toString(); + CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:TRANSLATION:" + lang + ":INVERSE_DISPLAY", false); + bool inverse = node->getValueBool(); + if (endOfOriginal != string::npos) { - if (!originalFirst) + if (!inverse) { pos = endOfOriginal+4; } From 4bcf9270eb0dd420abeb829b77b5e9d9cdc29964 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 15 Feb 2021 13:25:37 +0200 Subject: [PATCH 02/28] Show reload link when curl fails to open connection to website --- code/nel/include/nel/gui/group_html.h | 3 +++ code/nel/src/gui/group_html.cpp | 28 ++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 590c43a89..a78e203c0 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -115,6 +115,9 @@ namespace NLGUI // Browse error void browseError (const char *msg); + // Error message with html content + void browseErrorHtml(const std::string &html); + bool isBrowsing(); // Update coords diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 50b381a3c..f2aba9fa0 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -2642,6 +2642,17 @@ namespace NLGUI invalidateCoords(); } + void CGroupHTML::browseErrorHtml(const std::string &html) + { + releaseDownloads(); + removeContent(); + + renderHtmlString(html); + + updateRefreshButton(); + invalidateCoords(); + } + // *************************************************************************** bool CGroupHTML::isBrowsing() @@ -3964,11 +3975,22 @@ namespace NLGUI { if (!success) { + CUrlParser uri(_CurlWWW->Url); + + // potentially unwanted chars + std::string url = _CurlWWW->Url; + url = strFindReplaceAll(url, string("<"), string("%3C")); + url = strFindReplaceAll(url, string(">"), string("%3E")); + url = strFindReplaceAll(url, string("\""), string("%22")); + url = strFindReplaceAll(url, string("'"), string("%27")); + std::string err; - err = "Connection failed with cURL error: "; + err = "cURL error"; + err += "

Connection failed with cURL error

"; err += error; - err += "\nURL '" + _CurlWWW->Url + "'"; - browseError(err.c_str()); + err += "
(" + uri.scheme + "://" + uri.host + ") reload"; + err += ""; + browseErrorHtml(err); return; } From 91b3ff25b48d88062dec670408da0c65c483a227 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Tue, 16 Feb 2021 00:04:04 +0100 Subject: [PATCH 03/28] Add disabling of translation per channel --- .../src/interface_v3/chat_text_manager.cpp | 2 +- .../client/src/interface_v3/chat_window.cpp | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index c8a07f0f8..32558f642 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -450,7 +450,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C if (!inverse) { ctrlButton->setDefaultContextHelp(original); - pos = endOfOriginal+3; + pos = endOfOriginal+4; } else { diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 13f7bc66d..51e4a96a3 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -216,7 +216,23 @@ void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGr gl = dynamic_cast(_Chat->getGroup("cb:text_list")); - CViewBase *child = ctm.createMsgText(msg, col); + + + CCDBNodeLeaf *nodeNoTranslation = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:TRANSLATION:" + toUpper(CChatGroup::groupTypeToString(gt)) + ":DISABLE", false); + bool noTranslation = nodeNoTranslation->getValueBool(); + + ucstring msgNoTranslate = msg; + + if (noTranslation) { + string::size_type startTr = msg.find(ucstring("{:")); + string::size_type endOfOriginal = msg.find(ucstring("}@{")); + + if (startTr != string::npos && endOfOriginal != string::npos) { + msgNoTranslate = msg.substr(0, startTr) + msg.substr(startTr+5, endOfOriginal-startTr-5); + } + } + + CViewBase *child = ctm.createMsgText(msgNoTranslate, col); if (child) { if (gl) gl->addChild(child); @@ -568,6 +584,18 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC ucstring newmsg = msg; ucstring prefix; + CCDBNodeLeaf *nodeNoTranslation = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:TRANSLATION:" + toUpper(CChatGroup::groupTypeToString(gt)) + ":DISABLE", false); + bool noTranslation = nodeNoTranslation->getValueBool(); + + if (noTranslation) { + string::size_type startTr = msg.find(ucstring("{:")); + string::size_type endOfOriginal = msg.find(ucstring("}@{")); + + if (startTr != string::npos && endOfOriginal != string::npos) { + newmsg = newmsg.substr(0, startTr) + newmsg.substr(startTr+5, endOfOriginal-startTr-5); + } + } + CViewBase *child = NULL; if (gl != NULL) { From 719f178f70aa628be65713105df65fa23fd4784b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:55:35 +0800 Subject: [PATCH 04/28] Disconnect if UDP Login fails, ryzom/ryzomcore#622 --- code/ryzom/client/src/network_connection.cpp | 12 ++++++++++++ code/ryzom/client/src/network_connection.h | 1 + 2 files changed, 13 insertions(+) diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index 731677043..c1e9d8975 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -680,6 +680,7 @@ bool CNetworkConnection::connect(string &result) _LatestLoginTime = ryzomGetLocalTime (); _LatestSyncTime = _LatestLoginTime; _LatestProbeTime = _LatestLoginTime; + m_LoginAttempts = 0; nlinfo("CNET[%p]: Client connected to shard, attempting login", this); return true; @@ -1091,6 +1092,17 @@ bool CNetworkConnection::stateLogin() { sendSystemLogin(); _LatestLoginTime = _UpdateTime; + if (m_LoginAttempts > 24) + { + m_LoginAttempts = 0; + disconnect(); // will send disconnection message + nlwarning("CNET[%p]: Too many LOGIN attempts, connection problem", this); + return false; // exit now from loop, don't expect a new state + } + else + { + ++m_LoginAttempts; + } } return false; diff --git a/code/ryzom/client/src/network_connection.h b/code/ryzom/client/src/network_connection.h index d11702682..84bb26d43 100644 --- a/code/ryzom/client/src/network_connection.h +++ b/code/ryzom/client/src/network_connection.h @@ -822,6 +822,7 @@ private: void sendSystemLogin(); bool stateLogin(); NLMISC::TTime _LatestLoginTime; + int m_LoginAttempts; // void receiveSystemSync(NLMISC::CBitMemStream &msgin); From 2528e542cbeb4b12a715e4c3a5c6db212c6e17f7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:56:10 +0800 Subject: [PATCH 05/28] Don't probe if normal received in probe state, otherwise server will not enter probe state, ryzom/ryzomcore#622, ryzom/ryzomcore#133 --- code/ryzom/client/src/network_connection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index c1e9d8975..4778641c0 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -2320,6 +2320,7 @@ bool CNetworkConnection::stateProbe() else { nlwarning("CNET[%p]: received normal in state Probe", this); + _LatestProbeTime = _UpdateTime; } } } From bf2f8e39a5a979e0144b5dd9dc4db2362161e825 Mon Sep 17 00:00:00 2001 From: Nuno Date: Fri, 2 Apr 2021 19:04:36 +0200 Subject: [PATCH 06/28] Added nopatch arg for use with Ryztart --- code/ryzom/client/src/client.cpp | 1 + code/ryzom/client/src/far_tp.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index e824f6529..4e933b6da 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -180,6 +180,7 @@ int main(int argc, char **argv) Args.setVersion(getDisplayVersion()); Args.setDescription("Ryzom client"); + Args.addArg("n", "nopatch", "value", "Use this to not use patch system"); Args.addArg("p", "profile", "id", "Use this profile to determine what directory to use by default"); Args.addAdditionalArg("login", "Login to use", true, false); Args.addAdditionalArg("password", "Password to use", true, false); diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp index 0a594e540..1c2a6e612 100644 --- a/code/ryzom/client/src/far_tp.cpp +++ b/code/ryzom/client/src/far_tp.cpp @@ -49,12 +49,12 @@ #include "login_progress_post_thread.h" #include "interface_v3/action_handler_base.h" #include "item_group_manager.h" +#include "nel/misc/cmd_args.h" #ifdef DEBUG_NEW #define new DEBUG_NEW #endif - using namespace NLMISC; using namespace NLNET; using namespace NL3D; @@ -210,6 +210,7 @@ extern bool IsInRingSession; extern void selectTipsOfTheDay (uint tips); #define BAR_STEP_TP 2 +extern NLMISC::CCmdArgs Args; CLoginStateMachine::TEvent CLoginStateMachine::waitEvent() { @@ -462,12 +463,14 @@ void CLoginStateMachine::run() case st_check_patch: /// check the data to check if patch needed CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_PostLogin, "login_step_post_login")); - if (!ClientCfg.PatchWanted) + + if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1")) { // client don't want to be patched ! _CurrentState = st_display_eula; break; } + initPatchCheck(); SM_BEGIN_EVENT_TABLE if (isBGDownloadEnabled()) @@ -1517,4 +1520,3 @@ void CFarTP::farTPmainLoop() if(welcomeWindow) initWelcomeWindow(); } - From de90245f271dbd3e8344d6c2e7b1e82669f651e0 Mon Sep 17 00:00:00 2001 From: Nuno Date: Fri, 16 Apr 2021 14:08:37 +0200 Subject: [PATCH 07/28] Added GvE and GvG to TPVPType enum --- code/ryzom/common/src/game_share/outpost.cpp | 2 ++ code/ryzom/common/src/game_share/outpost.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/code/ryzom/common/src/game_share/outpost.cpp b/code/ryzom/common/src/game_share/outpost.cpp index b2cbde97f..d94254c83 100644 --- a/code/ryzom/common/src/game_share/outpost.cpp +++ b/code/ryzom/common/src/game_share/outpost.cpp @@ -33,6 +33,8 @@ namespace OUTPOSTENUMS NL_STRING_CONVERSION_TABLE_ENTRY(RVR) NL_STRING_CONVERSION_TABLE_ENTRY(Full) NL_STRING_CONVERSION_TABLE_ENTRY(UnknownPVPType) + NL_STRING_CONVERSION_TABLE_ENTRY(GVE) + NL_STRING_CONVERSION_TABLE_ENTRY(GVG) NL_END_STRING_CONVERSION_TABLE(TPVPType, StaticCOutpostTPVPTypeConversion, UnknownPVPType) NL_BEGIN_STRING_CONVERSION_TABLE (TPVPSide) diff --git a/code/ryzom/common/src/game_share/outpost.h b/code/ryzom/common/src/game_share/outpost.h index a951d1afb..391779ad0 100644 --- a/code/ryzom/common/src/game_share/outpost.h +++ b/code/ryzom/common/src/game_share/outpost.h @@ -50,7 +50,9 @@ namespace OUTPOSTENUMS PVE, // can only be attacked if the outpost is held by a tribe and if the attacking guild comes from the same continent as the outpost PVP, // can only be attacked if the attacking guild comes from the same continent as the outpost RVR, // can only be attacked if the attacking guild comes from another continent as the outpost - Full // same as RVR but cant be set by the high council + Full, // same as RVR but cant be set by the high council + GVE, // Only one guild vs tribes + GVG, // Only one guild vs another guild }; enum TPVPSide From 6402a31e4e27fb6155a1c94c7a0c164b9ad85afe Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 21 Apr 2021 18:47:13 +0200 Subject: [PATCH 08/28] Added boost allegories family --- code/ryzom/common/src/game_share/brick_families.cpp | 1 + code/ryzom/common/src/game_share/brick_families.h | 3 ++- code/ryzom/common/src/game_share/fame.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/ryzom/common/src/game_share/brick_families.cpp b/code/ryzom/common/src/game_share/brick_families.cpp index 684eb0d25..c36593da0 100644 --- a/code/ryzom/common/src/game_share/brick_families.cpp +++ b/code/ryzom/common/src/game_share/brick_families.cpp @@ -558,6 +558,7 @@ namespace BRICK_FAMILIES NL_STRING_CONVERSION_TABLE_ENTRY(BSCMC) NL_STRING_CONVERSION_TABLE_ENTRY(BSCMD) NL_STRING_CONVERSION_TABLE_ENTRY(BSGMC) + NL_STRING_CONVERSION_TABLE_ENTRY(BSGMCB) NL_STRING_CONVERSION_TABLE_ENTRY(BSXCA) diff --git a/code/ryzom/common/src/game_share/brick_families.h b/code/ryzom/common/src/game_share/brick_families.h index 49a73fbaa..7903f6e5e 100644 --- a/code/ryzom/common/src/game_share/brick_families.h +++ b/code/ryzom/common/src/game_share/brick_families.h @@ -675,7 +675,8 @@ namespace BRICK_FAMILIES BSCMD, // heal Focus EndPowerParameter = BSCMD, - BSGMC, // jewels s2e0 + BSGMC, // allegories + BSGMCB, // boost allegories BeginMagicPowerCredit, BSXCA = BeginMagicPowerCredit, // recast time diff --git a/code/ryzom/common/src/game_share/fame.cpp b/code/ryzom/common/src/game_share/fame.cpp index 19c3cbb80..03bf10e45 100644 --- a/code/ryzom/common/src/game_share/fame.cpp +++ b/code/ryzom/common/src/game_share/fame.cpp @@ -633,7 +633,7 @@ sint32 CStaticFames::getStaticFameIndexed(uint factionIndex1, uint factionIndex2 if (factionIndex1 >= _FameTableSize || factionIndex2 >= _FameTableSize) { - nlwarning("FAME: CStaticFames::getStaticFame invalid faction, return 0"); + //nlwarning("FAME: CStaticFames::getStaticFame invalid faction, return 0"); return 0; } From c09f82db16b23de92aff3164666a9203abbbb362 Mon Sep 17 00:00:00 2001 From: Nuno Date: Fri, 23 Apr 2021 18:29:31 +0200 Subject: [PATCH 09/28] Added boost icons --- .../client/src/interface_v3/dbctrl_sheet.cpp | 19 ++++++++++++++++++- .../client/src/interface_v3/dbctrl_sheet.h | 1 + 2 files changed, 19 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 7b188742c..9485cb2b7 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -1086,6 +1086,7 @@ void CDBCtrlSheet::clearIconBuffs() { _EnchantIcons.clear(); _BuffIcons.clear(); + _BoostIcons.clear(); } // *************************************************************************** @@ -1118,8 +1119,15 @@ void CDBCtrlSheet::infoReceived() if (brick) { if (!brick->isRoot() && !brick->isCredit() && !brick->isParameter()) + if (brick->BrickFamily == BRICK_FAMILIES::BSGMCB) // Boost of Allegories, use it as boost icon { if (!haveRoot) + _BoostIcons.push_back(SBuffIcon(rVR.getTextureIdFromName(brick->getIcon()), brick->IconColor)); + rVR.getTextureSizeFromId(_BoostIcons.back().TextureId, _BoostIcons.back().IconW, _BoostIcons.back().IconH); + } + else if (!brick->isRoot() && !brick->isCredit() && !brick->isParameter()) + { + if (!haveRoot && !brick->getIconBack().empty()) { _EnchantIcons.push_back(SBuffIcon(rVR.getTextureIdFromName(brick->getIconBack()), brick->IconBackColor)); rVR.getTextureSizeFromId(_EnchantIcons.back().TextureId, _EnchantIcons.back().IconW, _EnchantIcons.back().IconH); @@ -2444,10 +2452,18 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti } yIcon -= hIcon; rVR.drawRotFlipBitmap(_RenderLayer + 1, xIcon, yIcon, wIcon, hIcon, 0, false, _EnchantIcons[0].TextureId, fastMulRGB(curSheetColor, _EnchantIcons[0].Color)); - rVR.drawRotFlipBitmap(_RenderLayer+1, xIcon, yIcon, wIcon, hIcon, 0, false, _EnchantIcons[i].TextureId, fastMulRGB(curSheetColor, _EnchantIcons[i].Color)); + rVR.drawRotFlipBitmap(_RenderLayer + 1, xIcon, yIcon, wIcon, hIcon, 0, false, _EnchantIcons[i].TextureId, fastMulRGB(curSheetColor, _EnchantIcons[i].Color)); + + + if ((i - 1) < _BoostIcons.size()) { + nlinfo("Boost icon = %s", rVR.getTextureNameFromId(_BoostIcons[i-1].TextureId).c_str()); + rVR.drawRotFlipBitmap(_RenderLayer + 2, xIcon+wIcon-_BoostIcons[i-1].IconW, yIcon, _BoostIcons[i-1].IconW, _BoostIcons[i-1].IconH, 0, false, _BoostIcons[i-1].TextureId, fastMulRGB(curSheetColor, _BoostIcons[i-1].Color)); + } } } + + // Draw Quality. -1 for lookandfeel. Draw it with global color if (_DispQuality != -1) { @@ -3804,6 +3820,7 @@ void CDBCtrlSheet::resetAllTexIDs() _ItemInfoChanged = true; _EnchantIcons.clear(); _BuffIcons.clear(); + _BoostIcons.clear(); } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h index f9a85dd05..0052335fb 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -682,6 +682,7 @@ protected: }; std::vector _BuffIcons; std::vector _EnchantIcons; + std::vector _BoostIcons; // Level Brick or Quality union From d665e1fc455d49f362f64ef979c278000582cefa Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 25 Apr 2021 14:25:26 +0300 Subject: [PATCH 10/28] Fix detecting jpg image --- code/nel/src/misc/bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index c21b30fb7..dfd2be701 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -3570,7 +3570,7 @@ void CBitmap::loadSize(NLMISC::IStream &f, uint32 &retWidth, uint32 &retHeight) } while(!eof); } - else if(fileType == JPG_HEADER) + else if(memcmp(&fileType, &JPG_HEADER, 2) == 0) { uint8 blockMarker1 = 0; uint8 blockMarker2 = 0; From 155418b20beb113f70801ac1231974fcd6142285 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 25 Apr 2021 09:55:20 +0300 Subject: [PATCH 11/28] Fix temp file collision and image update on http/304 response --- code/nel/include/nel/gui/group_html.h | 1 + code/nel/src/gui/group_html.cpp | 100 +++++++++++++------------- 2 files changed, 52 insertions(+), 49 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index a78e203c0..8b4a635b9 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -857,6 +857,7 @@ namespace NLGUI CCurlWWWData *data; std::string url; std::string dest; + std::string tmpdest; std::string luaScript; std::string md5sum; TDataType type; diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index f2aba9fa0..dd5be59e7 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -524,18 +524,19 @@ namespace NLGUI return false; } - string tmpdest = download.dest + ".tmp"; + // use browser Id so that two browsers would not use same temp file + download.tmpdest = localImageName(_Id + download.dest) + ".tmp"; // erase the tmp file if exists - if (CFile::fileExists(tmpdest)) + if (CFile::fileExists(download.tmpdest)) { - CFile::deleteFile(tmpdest); + CFile::deleteFile(download.tmpdest); } - FILE *fp = nlfopen (tmpdest, "wb"); + FILE *fp = nlfopen (download.tmpdest, "wb"); if (fp == NULL) { - nlwarning("Can't open file '%s' for writing: code=%d '%s'", tmpdest.c_str (), errno, strerror(errno)); + nlwarning("Can't open file '%s' for writing: code=%d '%s'", download.tmpdest.c_str (), errno, strerror(errno)); return false; } @@ -543,7 +544,7 @@ namespace NLGUI if (!curl) { fclose(fp); - CFile::deleteFile(tmpdest); + CFile::deleteFile(download.tmpdest); nlwarning("Creating cURL handle failed, unable to download '%s'", download.url.c_str()); return false; @@ -607,54 +608,57 @@ namespace NLGUI void CGroupHTML::finishCurlDownload(const CDataDownload &download) { - std::string tmpfile = download.dest + ".tmp"; - if (download.type == ImgType) { - // there is race condition if two browser instances are downloading same file - // second instance deletes first tmpfile and creates new file for itself. - if (CFile::getFileSize(tmpfile) > 0) + if (CFile::fileExists(download.tmpdest) && CFile::getFileSize(download.tmpdest) > 0) { try { // verify that image is not corrupted uint32 w, h; - CBitmap::loadSize(tmpfile, w, h); + CBitmap::loadSize(download.tmpdest, w, h); if (w != 0 && h != 0) { - // if not tmpfile, then img is already in cache - if (CFile::fileExists(tmpfile)) - { - if (CFile::fileExists(download.dest)) - { - CFile::deleteFile(download.dest); - } - - // to reload image on page, the easiest seems to be changing texture - // to temp file temporarily. that forces driver to reload texture from disk - // ITexture::touch() seem not to do this. - // cache was updated, first set texture as temp file - for(uint i = 0; i < download.imgs.size(); i++) - { - setImage(download.imgs[i].Image, tmpfile, download.imgs[i].Type); - setImageSize(download.imgs[i].Image, download.imgs[i].Style); - } - - CFile::moveFile(download.dest, tmpfile); - } + if (CFile::fileExists(download.dest)) + CFile::deleteFile(download.dest); + // to reload image on page, the easiest seems to be changing texture + // to temp file temporarily. that forces driver to reload texture from disk + // ITexture::touch() seem not to do this. + // cache was updated, first set texture as temp file for(uint i = 0; i < download.imgs.size(); i++) { - setImage(download.imgs[i].Image, download.dest, download.imgs[i].Type); + setImage(download.imgs[i].Image, download.tmpdest, download.imgs[i].Type); setImageSize(download.imgs[i].Image, download.imgs[i].Style); } + CFile::moveFile(download.dest, download.tmpdest); } } catch(const NLMISC::Exception &e) { // exception message has .tmp file name, so keep it for further analysis - nlwarning("Invalid image (%s): %s", download.url.c_str(), e.what()); + nlwarning("Invalid image (%s) from url (%s): %s", download.tmpdest.c_str(), download.url.c_str(), e.what()); + } + } + + if (CFile::fileExists(download.dest) && CFile::getFileSize(download.dest) > 0) + { + try + { + // verify that image is not corrupted + uint32 w, h; + CBitmap::loadSize(download.dest, w, h); + if (w != 0 && h != 0) + for(uint i = 0; i < download.imgs.size(); i++) + { + setImage(download.imgs[i].Image, download.dest, download.imgs[i].Type); + setImageSize(download.imgs[i].Image, download.imgs[i].Style); + } + } + catch(const NLMISC::Exception &e) + { + nlwarning("Invalid image (%s) from url (%s): %s", download.dest.c_str(), download.url.c_str(), e.what()); } } @@ -663,13 +667,13 @@ namespace NLGUI if (download.type == StylesheetType) { - if (CFile::fileExists(tmpfile)) + if (CFile::fileExists(download.tmpdest)) { if (CFile::fileExists(download.dest)) { CFile::deleteFile(download.dest); } - CFile::moveFile(download.dest, tmpfile); + CFile::moveFile(download.dest, download.tmpdest); } cssDownloadFinished(download.url, download.dest); @@ -680,20 +684,20 @@ namespace NLGUI { bool verified = false; // no tmpfile if file was already in cache - if (CFile::fileExists(tmpfile)) + if (CFile::fileExists(download.tmpdest)) { - verified = download.md5sum.empty() || (download.md5sum != getMD5(tmpfile).toString()); + verified = download.md5sum.empty() || (download.md5sum != getMD5(download.tmpdest).toString()); if (verified) { if (CFile::fileExists(download.dest)) { CFile::deleteFile(download.dest); } - CFile::moveFile(download.dest, tmpfile); + CFile::moveFile(download.dest, download.tmpdest); } else { - CFile::deleteFile(tmpfile); + CFile::deleteFile(download.tmpdest); } } else if (CFile::fileExists(download.dest)) @@ -745,7 +749,7 @@ namespace NLGUI if (type != OverImage) { std::string temp = dest; - if (!CFile::fileExists(temp)) + if (!CFile::fileExists(temp) || CFile::getFileSize(temp) == 0) { temp = placeholder; } @@ -971,9 +975,9 @@ namespace NLGUI { fclose(it->fp); - if (CFile::fileExists(it->dest + ".tmp")) + if (CFile::fileExists(it->tmpdest)) { - CFile::deleteFile(it->dest + ".tmp"); + CFile::deleteFile(it->tmpdest); } } } @@ -4102,10 +4106,9 @@ namespace NLGUI obj.LastModified = data.data->getLastModified(); CHttpCache::getInstance()->store(data.dest, obj); - std::string tmpfile = data.dest + ".tmp"; - if (code == 304 && CFile::fileExists(tmpfile)) + if (code == 304 && CFile::fileExists(data.tmpdest)) { - CFile::deleteFile(tmpfile); + CFile::deleteFile(data.tmpdest); } } else if ((code >= 301 && code <= 303) || code == 307 || code == 308) @@ -4133,10 +4136,9 @@ namespace NLGUI LOG_DL("Redirect '%s'", location.c_str()); // no finished callback called, so cleanup old temp - std::string tmpfile = data.dest + ".tmp"; - if (CFile::fileExists(tmpfile)) + if (CFile::fileExists(data.tmpdest)) { - CFile::deleteFile(tmpfile); + CFile::deleteFile(data.tmpdest); } return; } From d8f54820c4a984af88dfe9978107e7e6e49fbb99 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 25 Apr 2021 11:05:07 +0300 Subject: [PATCH 12/28] Ignore first linebreak after pre, textarea open tag --- code/nel/src/gui/html_parser.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/nel/src/gui/html_parser.cpp b/code/nel/src/gui/html_parser.cpp index 3d7303706..91c287a7d 100644 --- a/code/nel/src/gui/html_parser.cpp +++ b/code/nel/src/gui/html_parser.cpp @@ -66,7 +66,15 @@ namespace NLGUI { if (node->type == XML_TEXT_NODE) { - parent.Children.push_back(CHtmlElement(CHtmlElement::TEXT_NODE, (const char*)(node->content))); + // linebreak right after pre,textare open tag should be removed + if (parent.Children.empty() && (*node->content == '\n') && (parent.ID == HTML_PRE || parent.ID == HTML_TEXTAREA)) + { + parent.Children.push_back(CHtmlElement(CHtmlElement::TEXT_NODE, (const char*)(node->content) + 1)); + } + else + { + parent.Children.push_back(CHtmlElement(CHtmlElement::TEXT_NODE, (const char*)(node->content))); + } } else if (node->type == XML_ELEMENT_NODE) From 291d332b56c0b6560ae719662f169a0c0360e1cf Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 2 Jan 2021 16:45:39 +0200 Subject: [PATCH 13/28] Fix css style order when using external css files --- code/nel/include/nel/gui/group_html.h | 7 ++- code/nel/include/nel/gui/html_parser.h | 17 ++++-- code/nel/src/gui/group_html.cpp | 83 ++++++++++++++++---------- code/nel/src/gui/html_parser.cpp | 16 ++--- 4 files changed, 80 insertions(+), 43 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 8b4a635b9..d04593870 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -27,6 +27,7 @@ #include "nel/gui/ctrl_button.h" #include "nel/gui/group_table.h" #include "nel/gui/html_element.h" +#include "nel/gui/html_parser.h" #include "nel/gui/css_style.h" // forward declaration @@ -378,7 +379,9 @@ namespace NLGUI // true if renderer is waiting for css files to finish downloading (link rel=stylesheet) bool _WaitingForStylesheet; // list of css file urls that are queued up for download - std::vector _StylesheetQueue; + std::vector _StylesheetQueue; + //