From f192068bc46371483c5d730edb74d87bb754d4cc Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 16 Mar 2016 19:15:11 +0100 Subject: [PATCH] Merge with develop --- code/nel/src/misc/path.cpp | 17 +++--- .../gamedev/interfaces_v3/bg_downloader.lua | 2 +- .../gamedev/interfaces_v3/bot_chat_v4.lua | 58 +++++++++---------- .../data/gamedev/interfaces_v3/help.lua | 22 +++---- .../gamedev/interfaces_v3/out_v2_appear.lua | 31 ++++------ .../ring_access_point_filter.lua | 2 +- .../data/gamedev/interfaces_v3/taskbar.lua | 24 ++++---- .../data/gamedev/interfaces_v3/webig.lua | 2 +- code/ryzom/client/src/login_patch.cpp | 46 ++++++++------- code/ryzom/client/unix/upgd_nl.sh | 2 +- 10 files changed, 100 insertions(+), 106 deletions(-) diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index b5375e005..b4057e315 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -1963,14 +1963,15 @@ bool CFile::createEmptyFile (const std::string& filename) bool CFile::fileExists (const string& filename) { //H_AUTO(FileExists); -#ifdef NL_OS_WINDOWS - DWORD attr = GetFileAttributesW(utf8ToWide(filename)); - // attributes are valid and file is not a directory - if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return false; - return true; -#else - return access(filename.c_str(), R_OK) != -1; -#endif + FILE *file = nlfopen(filename, "rb"); + + if (file) + { + fclose(file); + return true; + } + + return false; } diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua b/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua index c2569b301..161012d9e 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/bg_downloader.lua @@ -32,7 +32,7 @@ end ------------------------------------------------------------------------------------------------------------ function bgdownloader:setIcon(icon) - local bm = self:getProgressGroup():find("bm"); + local bm = self:getProgressGroup():find("bm") if icon == "" then bm.active = false else diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/bot_chat_v4.lua b/code/ryzom/client/data/gamedev/interfaces_v3/bot_chat_v4.lua index 2b9d8fb3c..f0b3ec913 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/bot_chat_v4.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/bot_chat_v4.lua @@ -4,7 +4,7 @@ ------------------------------------------------------------------------------------------------------------ -- create the game namespace without reseting if already created in an other file. if (game==nil) then - game= {}; + game = {} end @@ -12,14 +12,14 @@ end -- called to construct guild flags background in the modal window function game:bcCreateGuildInitFlags() - local ui = getUICaller(); + local ui = getUICaller() for i = 0,14 do - local uiBack = getUI(getUIId(ui) .. ':back' .. i); - uiBack.image1.back = i+1; - uiBack.image1.symbol = 0; - uiBack.image1.color1 = runExpr('makeRGB(255,255,255)'); - uiBack.image1.color2 = runExpr('makeRGB(0,0,0)'); + local uiBack = getUI(getUIId(ui) .. ':back' .. i) + uiBack.image1.back = i+1 + uiBack.image1.symbol = 0 + uiBack.image1.color1 = runExpr('makeRGB(255,255,255)') + uiBack.image1.color2 = runExpr('makeRGB(0,0,0)') end end @@ -28,37 +28,37 @@ end -- trap some parts should be deprecated ... try to clean it up function game:bcMissionsUpdate() - local mt = getDbProp('UI:TEMP:MISSION:MISSION_TYPE'); + local mt = getDbProp('UI:TEMP:MISSION:MISSION_TYPE') -- init bot_chat_missions title - local title = 'uiBotChatMissions'; - if (mt == 3) then title = 'uiBotChatZCCharges'; - elseif (mt == 4) then title = 'uiBotChatBuilding'; - elseif (mt == 5) then title = 'uiBotChatRMBuy'; - elseif (mt == 6) then title = 'uiBotChatRMUpgrade'; + local title = 'uiBotChatMissions' + if (mt == 3) then title = 'uiBotChatZCCharges' + elseif (mt == 4) then title = 'uiBotChatBuilding' + elseif (mt == 5) then title = 'uiBotChatRMBuy' + elseif (mt == 6) then title = 'uiBotChatRMUpgrade' end - local ui = getUI('ui:interface:bot_chat_missions'); - ui.title = title; + local ui = getUI('ui:interface:bot_chat_missions') + ui.title = title -- init desc - title = 'uiSelectMission'; - if (mt == 3) then title = 'uiSelectZCCharge'; - elseif (mt == 4) then title = 'uiSelectBuilding'; - elseif (mt == 5) then title = 'uiSelectRMBuy'; - elseif (mt == 6) then title = 'uiSelectRMUpgrade'; + title = 'uiSelectMission' + if (mt == 3) then title = 'uiSelectZCCharge' + elseif (mt == 4) then title = 'uiSelectBuilding' + elseif (mt == 5) then title = 'uiSelectRMBuy' + elseif (mt == 6) then title = 'uiSelectRMUpgrade' end - ui.header_opened.mission_title.hardtext = title; + ui.header_opened.mission_title.hardtext = title - ui.header_opened.zc_duty.active = (mt == 3); - ui.header_opened.xp_guild.active = ((mt == 5) or (mt == 6)); + ui.header_opened.zc_duty.active = (mt == 3) + ui.header_opened.xp_guild.active = ((mt == 5) or (mt == 6)) -- init bot_chat_accept_mission title - title = 'uiAcceptMission'; - if (mt == 3) then title = 'uiAcceptZCCharge'; - elseif (mt == 4) then title = 'uiAcceptBuilding'; - elseif (mt == 5) then title = 'uiAcceptRMBuy'; - elseif (mt == 6) then title = 'uiAcceptRMUpgrade'; + title = 'uiAcceptMission' + if (mt == 3) then title = 'uiAcceptZCCharge' + elseif (mt == 4) then title = 'uiAcceptBuilding' + elseif (mt == 5) then title = 'uiAcceptRMBuy' + elseif (mt == 6) then title = 'uiAcceptRMUpgrade' end - ui = getUI('ui:interface:bot_chat_accept_mission'); + ui = getUI('ui:interface:bot_chat_accept_mission') ui.title = title; end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/help.lua b/code/ryzom/client/data/gamedev/interfaces_v3/help.lua index 07a7fcd2c..d6c6da720 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/help.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/help.lua @@ -3,36 +3,36 @@ ------------------------------------------------------------------------------------------------------------ -- create the game namespace without reseting if already created in an other file. if (help==nil) then - help= {}; + help = {} end ------------------------------------------------------------------------------------------------------------ -- function help:closeCSBrowserHeader() - local ui = getUI('ui:interface:cs_browser'); + local ui = getUI('ui:interface:cs_browser') -- save size - ui_cs_browser_h = ui.h; - ui_cs_browser_w = ui.w; + ui_cs_browser_h = ui.h + ui_cs_browser_w = ui.w -- reduce window size - ui.pop_min_h = 32; - ui.h = 0; - ui.w = 216; + ui.pop_min_h = 32 + ui.h = 0 + ui.w = 216 end ------------------------------------------------------------------------------------------------------------ -- function help:openCSBrowserHeader() - local ui = getUI('ui:interface:cs_browser'); - ui.pop_min_h = 96; + local ui = getUI('ui:interface:cs_browser') + ui.pop_min_h = 96 -- set size from saved values if (ui_cs_browser_h ~= nil) then - ui.h = ui_cs_browser_h; + ui.h = ui_cs_browser_h end if (ui_cs_browser_w ~= nil) then - ui.w = ui_cs_browser_w; + ui.w = ui_cs_browser_w end end \ No newline at end of file diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua b/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua index fd3116aee..43727200a 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/out_v2_appear.lua @@ -20,15 +20,13 @@ end -- Fyros function outgame:getFyrosFirstName() - local nbFyrosFirstNames = 0 - for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end + local nbFyrosFirstNames = #fyrosFirstNames return fyrosFirstNames[math.random(nbFyrosFirstNames)] end function outgame:getFyrosLastName() - local nbFyrosLastNames = 0 - for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end + local nbFyrosLastNames = #fyrosLastNames return fyrosLastNames[math.random(nbFyrosLastNames)] end @@ -44,12 +42,10 @@ function outgame:getMatisFirstName(sex) local FirstName = "" if tonumber(dbNameSex) == 1 then - local nbMatisMaleFirstNames = 0 - for _ in pairs(matisMaleFirstNames) do nbMatisMaleFirstNames = nbMatisMaleFirstNames + 1 end + local nbMatisMaleFirstNames = #matisMaleFirstNames FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)] else - local nbMatisFemaleFirstNames = 0 - for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end + local nbMatisFemaleFirstNames = #matisFemaleFirstNames FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)] end @@ -57,44 +53,37 @@ function outgame:getMatisFirstName(sex) end function outgame:getMatisLastName() - - local nbMatisLastNames = 0 - for _ in pairs(matisLastNames) do nbMatisLastNames = nbMatisLastNames + 1 end + local nbMatisLastNames = #matisLastNames return matisLastNames[math.random(nbMatisLastNames)] end -- Tryker function outgame:getTrykerFirstName() - local nbTrykerFirstNames = 0 - for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end + local nbTrykerFirstNames = #trykerFirstNames return trykerFirstNames[math.random(nbTrykerFirstNames)] end function outgame:getTrykerLastName() - local nbTrykerLastNames = 0 - for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end + local nbTrykerLastNames = #trykerLastNames return trykerLastNames[math.random(nbTrykerLastNames)] end -- Zoraļ function outgame:getZoraiFirstName() - local nbFirstNamesOne = 0 - for _ in pairs(zoraiFirstNamesOne) do nbFirstNamesOne = nbFirstNamesOne + 1 end + local nbFirstNamesOne = #zoraiFirstNamesOne local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)] - local nbFirstNamesTwo = 0 - for _ in pairs(zoraiFirstNamesTwo) do nbFirstNamesTwo = nbFirstNamesTwo + 1 end + local nbFirstNamesTwo = #zoraiFirstNamesTwo local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)] return FirstNameOne .. "-" .. FirstNameTwo end function outgame:getZoraiLastName() - local nbLastNames = 0 - for _ in pairs(zoraiLastNames) do nbLastNames = nbLastNames + 1 end + local nbLastNames = #zoraiLastNames return zoraiLastNames[math.random(nbLastNames)] end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point_filter.lua b/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point_filter.lua index aa1b7b7cc..44a0451d7 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point_filter.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/ring_access_point_filter.lua @@ -109,7 +109,7 @@ function game.RingAccessPointFilter:validate() if config.Local == 1 then ucUrl = ucstring(NicoMagicURL) -- for test in local mode else - ucUrl = getDynString(game.NpcWebPage.UrlTextId); + ucUrl = getDynString(game.NpcWebPage.UrlTextId) end debugInfo(tostring(ucUrl)) local utf8Url = ucUrl:toUtf8() diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.lua b/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.lua index 7ac4c68dd..9dc6035fb 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.lua @@ -2,39 +2,39 @@ ------------------------------------------------------------------------------------------------------------ -- create the game namespace without reseting if already created in an other file. if (game==nil) then - game= {}; + game = {} end ------------------------------------------------------------------------------------------------------------ -- function game:getMilkoTooltipWithKey(prop, tooltip, tooltip_pushed, name, param) - local tt; + local tt -- Check if button is toggled and choose the good tooltip if (prop ~= '' and tooltip_pushed ~= '') then - local db = getDbProp(prop); + local db = getDbProp(prop) if (db == 1) then - tt = tooltip_pushed; + tt = tooltip_pushed else - tt = tooltip; + tt = tooltip end else tt = tooltip; end -- Get key shortcut - local text = i18n.get(tt); - local key = runExpr('getKey(\'' .. name .. '\',\'' .. param .. '\',1)'); + local text = i18n.get(tt) + local key = runExpr('getKey(\'' .. name .. '\',\'' .. param .. '\',1)') if (key ~= nil and key ~= '') then - key = ' @{2F2F}(' .. key .. ')'; - text = concatUCString(text, key); + key = ' @{2F2F}(' .. key .. ')' + text = concatUCString(text, key) end - setContextHelpText(text); + setContextHelpText(text) end function game:taskbarDisableTooltip(ui) - local uiGroup = getUI(ui); - disableContextHelpForControl(uiGroup); + local uiGroup = getUI(ui) + disableContextHelpForControl(uiGroup) end \ No newline at end of file diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/webig.lua b/code/ryzom/client/data/gamedev/interfaces_v3/webig.lua index 9b88c02f7..516cc62d7 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/webig.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/webig.lua @@ -180,7 +180,7 @@ function webig:doRemoveDbSheetQuantity(sheet_list, ctrl) end end ---assert(nil, "RELOADABLE SCRIPT"); +--assert(nil, "RELOADABLE SCRIPT") diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index baf7044df..bbd896ec9 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -922,21 +922,23 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool contentPrefix += "set RYZOM_CLIENT=\"%1\"\n"; contentPrefix += "set UNPACKPATH=\"%2\"\n"; contentPrefix += "set ROOTPATH=\"%3\"\n"; + contentPrefix += "set STARTUPPATH=\"%4\"\n"; contentPrefix += toString("set UPGRADE_FILE=\"%%ROOTPATH%%\\%s\"\n", UpgradeBatchFilename.c_str()); contentPrefix += "\n"; - contentPrefix += "set LOGIN=%4\n"; - contentPrefix += "set PASSWORD=%5\n"; - contentPrefix += "set SHARDID=%6\n"; + contentPrefix += "set LOGIN=%5\n"; + contentPrefix += "set PASSWORD=%6\n"; + contentPrefix += "set SHARDID=%7\n"; #else contentPrefix += "#!/bin/sh\n"; contentPrefix += "export RYZOM_CLIENT=$1\n"; contentPrefix += "export UNPACKPATH=$2\n"; contentPrefix += "export ROOTPATH=$3\n"; + contentPrefix += "export STARTUPPATH=$4\n"; contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str()); contentPrefix += "\n"; - contentPrefix += "LOGIN=$4\n"; - contentPrefix += "PASSWORD=$5\n"; - contentPrefix += "SHARDID=$6\n"; + contentPrefix += "LOGIN=$5\n"; + contentPrefix += "PASSWORD=$6\n"; + contentPrefix += "SHARDID=$7\n"; #endif contentPrefix += "\n"; @@ -958,7 +960,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (wantRyzomRestart) { // client shouldn't be in memory anymore else it couldn't be overwritten - contentSuffix += toString("start \"\" /D \"%%ROOTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); + contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); } #else if (wantRyzomRestart) @@ -976,7 +978,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (wantRyzomRestart) { // change to previous client directory - contentSuffix += "cd \"$ROOTPATH\"\n\n"; + contentSuffix += "cd \"$STARTUPPATH\"\n\n"; // launch new client contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); @@ -1017,10 +1019,25 @@ void CPatchManager::executeBatchFile() std::string batchFilename; + std::vector arguments; + + std::string startupPath = Args.getStartupPath(); + + // 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path #ifdef NL_OS_WINDOWS batchFilename = CPath::standardizeDosPath(ClientRootPath); + + arguments.push_back(CPath::standardizeDosPath(RyzomFilename)); + arguments.push_back(CPath::standardizeDosPath(ClientPatchPath)); + arguments.push_back(CPath::standardizeDosPath(ClientRootPath)); + arguments.push_back(CPath::standardizeDosPath(startupPath)); #else batchFilename = ClientRootPath; + + arguments.push_back(RyzomFilename); + arguments.push_back(ClientPatchPath); + arguments.push_back(ClientRootPath); + arguments.push_back(startupPath); #endif batchFilename += UpdateBatchFilename; @@ -1028,19 +1045,6 @@ void CPatchManager::executeBatchFile() // make script executable CFile::setRWAccess(batchFilename); - std::vector arguments; - - // 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path -#ifdef NL_OS_WINDOWS - arguments.push_back(CPath::standardizeDosPath(RyzomFilename)); - arguments.push_back(CPath::standardizeDosPath(ClientPatchPath)); - arguments.push_back(CPath::standardizeDosPath(ClientRootPath)); -#else - arguments.push_back(RyzomFilename); - arguments.push_back(ClientPatchPath); - arguments.push_back(ClientRootPath); -#endif - // append login, password and shard if (!LoginLogin.empty()) { diff --git a/code/ryzom/client/unix/upgd_nl.sh b/code/ryzom/client/unix/upgd_nl.sh index 6c44db85b..4a18675ef 100644 --- a/code/ryzom/client/unix/upgd_nl.sh +++ b/code/ryzom/client/unix/upgd_nl.sh @@ -10,6 +10,6 @@ fi chmod +x "$ROOTPATH/ryzom_client" chmod +x "$ROOTPATH/crash_report" chmod +x "$ROOTPATH/ryzom_client_patcher" -chmod +x "$ROOTPATH/ryzom_configuration" +chmod +x "$ROOTPATH/ryzom_configuration_qt" exit 0