From 888c21cd975da3fb8098981ea01049f1f26e85bf Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 12:30:14 +0100 Subject: [PATCH 01/48] Changed: Fix typo --HG-- branch : develop --- code/web/public_php/ams/inc/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/web/public_php/ams/inc/login.php b/code/web/public_php/ams/inc/login.php index 753873f38..d813bfd00 100644 --- a/code/web/public_php/ams/inc/login.php +++ b/code/web/public_php/ams/inc/login.php @@ -1,6 +1,6 @@ Date: Tue, 15 Mar 2016 12:30:52 +0100 Subject: [PATCH 02/48] Changed: Updated Configuration translations --HG-- branch : develop --- .../translations/ryzom_configuration_es.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_es.ts b/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_es.ts index b7498d3bc..97dba7b82 100644 --- a/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_es.ts +++ b/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_es.ts @@ -241,7 +241,7 @@ Specify if Ryzom is to be run in OpenGL or Direct3D: - + Especificar si Ryzom debe ser ejecutado con OpenGL o Direct3D: @@ -276,7 +276,7 @@ Specify a video mode: - + Especificar un modo de video: Specify a video mode @@ -353,7 +353,7 @@ Slow down the game (process low priority) - + Realentizar el juego (prioridad de procesamiento bajo) Slow down the game ( process low priority ) @@ -385,7 +385,7 @@ Software sound buffer (may increase FPS) - + Buffer de sonido software (puede aumentar los FPS) Software sound buffer ( may increase FPS ) From 2dd97967ff15df10cc2804ee3e899216a2a9ceba Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 12:31:20 +0100 Subject: [PATCH 03/48] Changed: Remove Hungarian because this language is not supported by Ryzom --HG-- branch : develop --- .../tools/client/client_config_qt/general_settings_widget.ui | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.ui b/code/ryzom/tools/client/client_config_qt/general_settings_widget.ui index 722a195d9..20e7a394b 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.ui +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.ui @@ -43,11 +43,6 @@ German - - - Hungarian - - From c3d3024507f91cce1c2738c626f6b94c3613abdc Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 12:34:45 +0100 Subject: [PATCH 04/48] Changed: Remived useless semicolons --HG-- branch : develop --- .../gamedev/interfaces_v3/out_v2_appear.lua | 191 +++++++++--------- 1 file changed, 96 insertions(+), 95 deletions(-) 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 1c8a86342..95d2f2354 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 @@ -3,8 +3,8 @@ ------------------------------------------------------------------------------------------------------------ -- create the game namespace without reseting if already created in an other file. -if (outgame==nil) then - outgame= {}; +if (outgame == nil) then + outgame = {} end @@ -20,14 +20,14 @@ end -- Fyros function outgame:getFyrosFirstName() - local nbFyrosFirstNames = 0; + local nbFyrosFirstNames = 0 for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end return fyrosFirstNames[math.random(nbFyrosFirstNames)] end function outgame:getFyrosLastName() - local nbFyrosLastNames = 0; + local nbFyrosLastNames = 0 for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end return fyrosLastNames[math.random(nbFyrosLastNames)] @@ -36,29 +36,29 @@ end -- Matis function outgame:getMatisFirstName(sex) -- 1 = male, 2 = female - local dbNameSex = getDbProp("UI:TEMP:NAME_SEX"); + local dbNameSex = getDbProp("UI:TEMP:NAME_SEX") if sex ~= nil then - dbNameSex = sex; + dbNameSex = sex end local FirstName = "" if tonumber(dbNameSex) == 1 then - local nbMatisMaleFirstNames = 0; + local nbMatisMaleFirstNames = 0 for _ in pairs(matisMaleFirstNames) do nbMatisMaleFirstNames = nbMatisMaleFirstNames + 1 end - FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)]; + FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)] else - local nbMatisFemaleFirstNames = 0; + local nbMatisFemaleFirstNames = 0 for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end - FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)]; + FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)] end - return FirstName; + return FirstName end function outgame:getMatisLastName() - local nbMatisLastNames = 0; + local nbMatisLastNames = 0 for _ in pairs(matisLastNames) do nbMatisLastNames = nbMatisLastNames + 1 end return matisLastNames[math.random(nbMatisLastNames)] @@ -66,14 +66,14 @@ end -- Tryker function outgame:getTrykerFirstName() - local nbTrykerFirstNames = 0; + local nbTrykerFirstNames = 0 for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end return trykerFirstNames[math.random(nbTrykerFirstNames)] end function outgame:getTrykerLastName() - local nbTrykerLastNames = 0; + local nbTrykerLastNames = 0 for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end return trykerLastNames[math.random(nbTrykerLastNames)] @@ -81,32 +81,33 @@ end -- Zoraļ function outgame:getZoraiFirstName() - local nbFirstNamesOne = 0; + local nbFirstNamesOne = 0 for _ in pairs(zoraiFirstNamesOne) do nbFirstNamesOne = nbFirstNamesOne + 1 end - local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)]; + local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)] - local nbFirstNamesTwo = 0; + local nbFirstNamesTwo = 0 for _ in pairs(zoraiFirstNamesTwo) do nbFirstNamesTwo = nbFirstNamesTwo + 1 end - local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)]; + local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)] return FirstNameOne .. "-" .. FirstNameTwo end + function outgame:getZoraiLastName() - local nbLastNames = 0; + local nbLastNames = 0 for _ in pairs(zoraiLastNames) do nbLastNames = nbLastNames + 1 end return zoraiLastNames[math.random(nbLastNames)] end function outgame:procGenerateName() - local uiNameFull = getUI("ui:outgame:appear_name:name_full"); - local uiGenText = getUI("ui:outgame:appear_name:eb"); - local dbNameRace = getDbProp("UI:TEMP:NAME_RACE"); - local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME"); - local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME"); + local uiNameFull = getUI("ui:outgame:appear_name:name_full") + local uiGenText = getUI("ui:outgame:appear_name:eb") + local dbNameRace = getDbProp("UI:TEMP:NAME_RACE") + local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME") + local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME") - local nameResult = ""; - local fullnameResult = ""; + local nameResult = "" + local fullnameResult = "" -- Look at outgame:procUpdateNameRaceLabel() for the "race" list. -- fy ma try zo --> @@ -168,92 +169,92 @@ function outgame:procGenerateName() fullnameResult = firstName .. " " .. lastName nameResult = firstName - uiNameFull.hardtext = fullnameResult; + uiNameFull.hardtext = fullnameResult - nameResult = string.gsub(nameResult, "'", ""); - nameResult = string.gsub(nameResult, " ", ""); - nameResult = string.gsub(nameResult, "-", ""); - nameResult = string.lower( nameResult ); - nameResult = nameResult:gsub("^%l", string.upper); - uiGenText.input_string = nameResult; + nameResult = string.gsub(nameResult, "'", "") + nameResult = string.gsub(nameResult, " ", "") + nameResult = string.gsub(nameResult, "-", "") + nameResult = string.lower(nameResult) + nameResult = nameResult:gsub("^%l", string.upper) + uiGenText.input_string = nameResult end -- Name sex slider update. function outgame:procUpdateNameSexLabel() local nameSexType = { "uiCP_Sex_Male", "uiCP_Sex_Female" } - local uiNameSexText = getUI("ui:outgame:appear_name:name_sex_slider:name_sex"); - local uiNameSex = getDbProp("UI:TEMP:NAME_SEX"); + local uiNameSexText = getUI("ui:outgame:appear_name:name_sex_slider:name_sex") + local uiNameSex = getDbProp("UI:TEMP:NAME_SEX") - tempstr = tostring(i18n.get(nameSexType[tonumber(uiNameSex)])); - tempstr = string.lower(tempstr); - tempstr = (tempstr:gsub("^%l", string.upper)); + tempstr = tostring(i18n.get(nameSexType[tonumber(uiNameSex)])) + tempstr = string.lower(tempstr) + tempstr = (tempstr:gsub("^%l", string.upper)) - uiNameSexText.hardtext = tempstr; + uiNameSexText.hardtext = tempstr end -- Name race slider update. function outgame:procUpdateNameRaceLabel() local nameRaceType = { "Fyros", "Matis", "Tryker", "Zoraļ", "uiCP_Maraudeur" } - local uiNameRaceText = getUI("ui:outgame:appear_name:name_race_slider:name_race"); - local dbNameRace = getDbProp("UI:TEMP:NAME_RACE"); + local uiNameRaceText = getUI("ui:outgame:appear_name:name_race_slider:name_race") + local dbNameRace = getDbProp("UI:TEMP:NAME_RACE") - local uiNameSexSlider = getUI("ui:outgame:appear_name:name_sex_slider"); + local uiNameSexSlider = getUI("ui:outgame:appear_name:name_sex_slider") - local uiNameSubRaceFirstNameSlider = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider"); - local uiNameSubRaceLastNameSlider = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider"); + local uiNameSubRaceFirstNameSlider = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider") + local uiNameSubRaceLastNameSlider = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider") - local uiNameGenerate = getUI("ui:outgame:appear_name:generate"); + local uiNameGenerate = getUI("ui:outgame:appear_name:generate") -- Show/Hide sex slider uiNameGenerate.y = "-50" if tonumber(dbNameRace) == 2 then - uiNameSexSlider.active = true; + uiNameSexSlider.active = true uiNameGenerate.y = "-65" else - uiNameSexSlider.active = false; + uiNameSexSlider.active = false end -- Show/Hide sub race slider if tonumber(dbNameRace) == 5 then - uiNameSubRaceFirstNameSlider.active = true; - uiNameSubRaceLastNameSlider.active = true; + uiNameSubRaceFirstNameSlider.active = true + uiNameSubRaceLastNameSlider.active = true uiNameGenerate.y = "-105" else - uiNameSubRaceFirstNameSlider.active = false; - uiNameSubRaceLastNameSlider.active = false; + uiNameSubRaceFirstNameSlider.active = false + uiNameSubRaceLastNameSlider.active = false end - uiNameRaceText.hardtext = tostring(nameRaceType[tonumber(dbNameRace)]); + uiNameRaceText.hardtext = tostring(nameRaceType[tonumber(dbNameRace)]) end -local matisF = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Female")) )):gsub("^%l", string.upper); -local matisM = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Male")) )):gsub("^%l", string.upper); +local matisF = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Female")) )):gsub("^%l", string.upper) +local matisM = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Male")) )):gsub("^%l", string.upper) function outgame:procUpdateNameSubRaceFirstNameLabel() local nameSubRaceFirstNameType = { "Fyros", matisM, matisF, "Tryker", "Zoraļ" } - local uiNameSubRaceFirstNameText = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider:name_race"); - local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME"); + local uiNameSubRaceFirstNameText = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider:name_race") + local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME") - uiNameSubRaceFirstNameText.hardtext= tostring(nameSubRaceFirstNameType[tonumber(dbNameSubRaceFirstName)]); + uiNameSubRaceFirstNameText.hardtext= tostring(nameSubRaceFirstNameType[tonumber(dbNameSubRaceFirstName)]) end function outgame:procUpdateNameSubRaceLastNameLabel() local nameSubRaceLastNameType = { "Fyros", "Matis", "Tryker", "Zoraļ" } - local uiNameSubRaceLastNameText = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider:name_race"); - local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME"); + local uiNameSubRaceLastNameText = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider:name_race") + local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME") - uiNameSubRaceLastNameText.hardtext= tostring(nameSubRaceLastNameType[tonumber(dbNameSubRaceLastName)]); + uiNameSubRaceLastNameText.hardtext= tostring(nameSubRaceLastNameType[tonumber(dbNameSubRaceLastName)]) end ------------------------------------------------------------------------------------------------------------ -- called to construct icons function outgame:activePackElement(id, icon) - local uiDesc = getUI("ui:outgame:appear:job_options:options:desc"); - uiDesc['ico' .. tostring(id)].active= true; - uiDesc['ico' .. tostring(id)].texture= icon; - uiDesc['ico' .. tostring(id) .. 'txt'].active= true; + local uiDesc = getUI("ui:outgame:appear:job_options:options:desc") + uiDesc['ico' .. tostring(id)].active = true + uiDesc['ico' .. tostring(id)].texture = icon + uiDesc['ico' .. tostring(id) .. 'txt'].active = true end @@ -261,13 +262,13 @@ end -- called to construct pack text function outgame:setPackJobText(id, spec) -- Set Pack content - local uiPackText = getUI("ui:outgame:appear:job_options:options:desc:pack_" .. id); - uiPackText.hardtext= "uiCP_Job_" .. id .. tostring(spec); + local uiPackText = getUI("ui:outgame:appear:job_options:options:desc:pack_" .. id) + uiPackText.hardtext= "uiCP_Job_" .. id .. tostring(spec) -- Set specialization text - local uiResText = getUI("ui:outgame:appear:job_options:options:result:res"); + local uiResText = getUI("ui:outgame:appear:job_options:options:result:res") if(spec==2) then - uiResText.hardtext= "uiCP_Res_" .. id; + uiResText.hardtext= "uiCP_Res_" .. id end end @@ -275,63 +276,63 @@ end -- called to construct pack function outgame:buildActionPack() - local uiDesc = getUI("ui:outgame:appear:job_options:options:desc"); + local uiDesc = getUI("ui:outgame:appear:job_options:options:desc") if (uiDesc==nil) then - return; + return end -- Reset All for i = 1,20 do - uiDesc['ico' .. tostring(i)].active= false; - uiDesc['ico' .. tostring(i) .. 'txt'].active= false; + uiDesc['ico' .. tostring(i)].active = false + uiDesc['ico' .. tostring(i) .. 'txt'].active = false end -- Build Default Combat - self:activePackElement(1, 'f1.tga'); -- Dagger - self:activePackElement(2, 'f2.tga'); -- Accurate Attack + self:activePackElement(1, 'f1.tga') -- Dagger + self:activePackElement(2, 'f2.tga') -- Accurate Attack -- Build Default Magic - self:activePackElement(6, 'm2.tga'); -- Gloves - self:activePackElement(7, 'm1.tga'); -- Acid + self:activePackElement(6, 'm2.tga') -- Gloves + self:activePackElement(7, 'm1.tga') -- Acid -- Build Default Forage - self:activePackElement(11, 'g1.tga'); -- Forage Tool - self:activePackElement(12, 'g2.tga'); -- Basic Extract + self:activePackElement(11, 'g1.tga') -- Forage Tool + self:activePackElement(12, 'g2.tga') -- Basic Extract -- Build Default Craft - self:activePackElement(16, 'c2.tga'); -- Craft Tool - self:activePackElement(17, 'c1.tga'); -- 50 raw mat - self:activePackElement(18, 'c3.tga'); -- Craft Root - self:activePackElement(19, 'c4.tga'); -- Boots Plan + self:activePackElement(16, 'c2.tga') -- Craft Tool + self:activePackElement(17, 'c1.tga') -- 50 raw mat + self:activePackElement(18, 'c3.tga') -- Craft Root + self:activePackElement(19, 'c4.tga') -- Boots Plan -- Build Option if (getDbProp('UI:TEMP:JOB_FIGHT') == 2) then - self:activePackElement(3, 'f3.tga'); -- Increase damage + self:activePackElement(3, 'f3.tga') -- Increase damage elseif (getDbProp('UI:TEMP:JOB_MAGIC') == 2) then - self:activePackElement(8, 'm5.tga'); -- Fear + self:activePackElement(8, 'm5.tga') -- Fear elseif (getDbProp('UI:TEMP:JOB_FORAGE') == 2) then - self:activePackElement(13, 'g3.tga'); -- Basic Prospection + self:activePackElement(13, 'g3.tga') -- Basic Prospection elseif (getDbProp('UI:TEMP:JOB_CRAFT') == 2) then - self:activePackElement(20, 'c6.tga'); -- Gloves Plan - self:activePackElement(17, 'c5.tga'); -- Replace 17, with 100x RawMat + self:activePackElement(20, 'c6.tga') -- Gloves Plan + self:activePackElement(17, 'c5.tga') -- Replace 17, with 100x RawMat end -- Reset Text - self:setPackJobText('F', 1); - self:setPackJobText('M', 1); - self:setPackJobText('G', 1); - self:setPackJobText('C', 1); + self:setPackJobText('F', 1) + self:setPackJobText('M', 1) + self:setPackJobText('G', 1) + self:setPackJobText('C', 1) -- Set correct text for specalized version if (getDbProp('UI:TEMP:JOB_FIGHT') == 2) then - self:setPackJobText('F', 2); + self:setPackJobText('F', 2) elseif (getDbProp('UI:TEMP:JOB_MAGIC') == 2) then - self:setPackJobText('M', 2); + self:setPackJobText('M', 2) elseif (getDbProp('UI:TEMP:JOB_FORAGE') == 2) then - self:setPackJobText('G', 2); + self:setPackJobText('G', 2) elseif (getDbProp('UI:TEMP:JOB_CRAFT') == 2) then - self:setPackJobText('C', 2); + self:setPackJobText('C', 2) end end From 61934be39a660e89e3d8b22ae2aaa4e5a942291d Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 12:35:47 +0100 Subject: [PATCH 05/48] =?UTF-8?q?Fixed:=20Fyros=20and=20Matis=20are=20usin?= =?UTF-8?q?g=20first=20name=20first=20while=20Trykers=20and=20Zora=C3=AFs?= =?UTF-8?q?=20are=20using=20last=20name=20first?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : develop --- .../data/gamedev/interfaces_v3/out_v2_appear.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 95d2f2354..fd3116aee 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 @@ -113,22 +113,29 @@ function outgame:procGenerateName() -- fy ma try zo --> local firstName = "test2" local lastName = "test" + + -- Fyros and Matis are using "first name, last name" order + -- Trykers and Zoraļs are using "last name, first name" order if tonumber(dbNameRace) == 1 then -- Fyros firstName = self:getFyrosFirstName() lastName = self:getFyrosLastName() + fullnameResult = firstName .. " " .. lastName elseif tonumber(dbNameRace) == 2 then -- Matis firstName = self:getMatisFirstName() lastName = self:getMatisLastName() + fullnameResult = firstName .. " " .. lastName elseif tonumber(dbNameRace) == 3 then -- Tryker firstName = self:getTrykerFirstName() lastName = self:getTrykerLastName() + fullnameResult = lastName .. " " .. firstName elseif tonumber(dbNameRace) == 4 then -- Zorai firstName = self:getZoraiFirstName() lastName = self:getZoraiLastName() + fullnameResult = lastName .. " " .. firstName elseif tonumber(dbNameRace) == 5 then -- Maraudeurs @@ -164,9 +171,11 @@ function outgame:procGenerateName() -- Zorai lastName = self:getZoraiLastName() end + + fullnameResult = firstName .. " " .. lastName end - fullnameResult = firstName .. " " .. lastName + -- always use first name for character name nameResult = firstName uiNameFull.hardtext = fullnameResult From f1b882c0f38c4ad567c5b49725f8de0b65860212 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 12:36:21 +0100 Subject: [PATCH 06/48] Changed: Removed useless dependencies on DirectX --HG-- branch : develop --- code/nel/src/3d/driver/opengl/CMakeLists.txt | 2 -- code/nel/src/3d/driver/opengles/CMakeLists.txt | 2 -- code/nel/src/misc/CMakeLists.txt | 6 ------ 3 files changed, 10 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/CMakeLists.txt b/code/nel/src/3d/driver/opengl/CMakeLists.txt index edff05d2a..21d790668 100644 --- a/code/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengl/CMakeLists.txt @@ -40,8 +40,6 @@ NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB}) NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB}) IF(WIN32) - INCLUDE_DIRECTORIES(BEFORE ${DXSDK_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS) ENDIF() diff --git a/code/nel/src/3d/driver/opengles/CMakeLists.txt b/code/nel/src/3d/driver/opengles/CMakeLists.txt index e6d10fae5..8cac2dfea 100644 --- a/code/nel/src/3d/driver/opengles/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengles/CMakeLists.txt @@ -38,8 +38,6 @@ NL_ADD_LIB_SUFFIX(${NLDRV_OGLES_LIB}) NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB}) IF(WIN32) - INCLUDE_DIRECTORIES(BEFORE ${DXSDK_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) ADD_DEFINITIONS(/DDRIVER_OPENGLES_EXPORTS) ENDIF() diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index fb6752982..53993161c 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -201,12 +201,6 @@ ELSE(WITH_STATIC OR WIN32) TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY}) ENDIF(WITH_STATIC OR WIN32) -# For DirectInput (di_event_emitter) -IF(WIN32) - INCLUDE_DIRECTORIES(BEFORE ${DXSDK_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY} winmm dbghelp) -ENDIF(WIN32) - IF(UNIX) TARGET_LINK_LIBRARIES(nelmisc -lc -ldl) IF(NOT APPLE) From d113bb7b1022a33cfc8f0b30950929566281a75f Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 17:44:21 +0100 Subject: [PATCH 07/48] Changed: Search client_default.cfg also in ETC_RYZOM_PREFIX --HG-- branch : develop --- code/ryzom/client/src/client_cfg.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index e59dd6886..48e187263 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -2223,6 +2223,7 @@ bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const #endif std::string currentPath = CPath::standardizePath(CPath::getCurrentPath()); + std::string etcPath = CPath::standardizePath(getRyzomEtcPrefix()); // look in the current working directory first if (CFile::isExists(currentPath + defaultConfigFileName)) @@ -2232,13 +2233,14 @@ bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const else if (CFile::isExists(Args.getStartupPath() + defaultConfigFileName)) p_name = Args.getStartupPath() + defaultConfigFileName; - // look in prefix path + // look in application directory else if (CFile::isExists(defaultConfigPath + defaultConfigFileName)) p_name = defaultConfigPath + defaultConfigFileName; - // if some client_default.cfg was found return true - if (p_name.size()) - return true; + // look in etc prefix path + else if (!etcPath.empty() && CFile::isExists(etcPath + defaultConfigFileName)) + p_name = etcPath + defaultConfigFileName; - return false; + // if some client_default.cfg was found return true + return !p_name.empty(); } From 5121cdb7d48546282d7e3bf07f9e6b33c2535998 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Mar 2016 17:55:58 +0100 Subject: [PATCH 08/48] Changed: Use # in Lua to get the size of an array --HG-- branch : develop --- .../gamedev/interfaces_v3/out_v2_appear.lua | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) 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 From c39190b38dabb28d6373e8412c8de2b4bc914cdf Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 16 Mar 2016 19:12:34 +0100 Subject: [PATCH 09/48] Changed: Use same algorithm as before Windows unicodes fixes (try to open the file instead of checking its attributes) --HG-- branch : develop --- code/nel/src/misc/path.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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; } From 8bc243ffe12925d6eed161d97b492e68326eecab Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 16 Mar 2016 19:13:07 +0100 Subject: [PATCH 10/48] Changed: Removed some semicolons in Lua when useless --HG-- branch : develop --- .../gamedev/interfaces_v3/bg_downloader.lua | 2 +- .../gamedev/interfaces_v3/bot_chat_v4.lua | 58 +++++++++---------- .../data/gamedev/interfaces_v3/help.lua | 22 +++---- .../ring_access_point_filter.lua | 2 +- .../data/gamedev/interfaces_v3/taskbar.lua | 24 ++++---- .../data/gamedev/interfaces_v3/webig.lua | 2 +- 6 files changed, 55 insertions(+), 55 deletions(-) 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/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") From 413dd8eb93271e9530cd119d38b1dc87fbb44e0c Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 16 Mar 2016 19:13:57 +0100 Subject: [PATCH 11/48] Fixed: We need to restart client from the same startup directory as parent one --HG-- branch : develop --- code/ryzom/client/src/login_patch.cpp | 46 +++++++++++++++------------ 1 file changed, 25 insertions(+), 21 deletions(-) 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()) { From 1356c1d447f6ad31716d7b6e67a039ba4fb837ab Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 16 Mar 2016 19:14:23 +0100 Subject: [PATCH 12/48] Fixed: Renamed ryzom_configuration to ryzom_configuration_qt under Linux --HG-- branch : develop --- code/ryzom/client/unix/upgd_nl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a77fee685b8aa5ccde26e3b8f4b2df2643a6b603 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 15:07:49 +0100 Subject: [PATCH 13/48] Changed: Implement CI18N::setSystemLanguageCode, if we must force it Fixed: CI18N::getSystemLanguageCode under Windows (use 2 different methods) --HG-- branch : develop --- code/nel/include/nel/misc/i18n.h | 4 + code/nel/src/misc/i18n.cpp | 124 +++++++++++++++++++++++++++---- 2 files changed, 114 insertions(+), 14 deletions(-) diff --git a/code/nel/include/nel/misc/i18n.h b/code/nel/include/nel/misc/i18n.h index 1102a8907..5f270a490 100644 --- a/code/nel/include/nel/misc/i18n.h +++ b/code/nel/include/nel/misc/i18n.h @@ -127,6 +127,9 @@ public: /// Returns the code of the language ("fr", "en", ...) defined on system static std::string getSystemLanguageCode (); + /// Define the code of the language ("fr", "en", ...) defined on system + static bool setSystemLanguageCode (const std::string &languageCode); + /// Find a string in the selected language and return his association. static const ucstring &get (const std::string &label); @@ -230,6 +233,7 @@ private: static std::vector _LanguageCodes; static std::vector _LanguageNames; + static std::string _SystemLanguageCode; static bool _LanguagesNamesLoaded; diff --git a/code/nel/src/misc/i18n.cpp b/code/nel/src/misc/i18n.cpp index 2f1bee325..fc4cbf341 100644 --- a/code/nel/src/misc/i18n.cpp +++ b/code/nel/src/misc/i18n.cpp @@ -43,6 +43,7 @@ string CI18N::_SelectedLanguageCode; CI18N::ILoadProxy *CI18N::_LoadProxy = 0; vector CI18N::_LanguageCodes; vector CI18N::_LanguageNames; +std::string CI18N::_SystemLanguageCode; bool CI18N::noResolution = false; void CI18N::setLoadProxy(ILoadProxy *loadProxy) @@ -248,10 +249,8 @@ bool CI18N::isLanguageCodeSupported(const std::string &lang) std::string CI18N::getSystemLanguageCode () { - static std::string s_cachedSystemLanguage; - - if (!s_cachedSystemLanguage.empty()) - return s_cachedSystemLanguage; + if (!_SystemLanguageCode.empty()) + return _SystemLanguageCode; #ifdef NL_OS_MAC // under OS X, locale is only defined in console, not in UI @@ -317,7 +316,7 @@ std::string CI18N::getSystemLanguageCode () // only keep language code if supported by NeL if (isLanguageCodeSupported(lang)) { - s_cachedSystemLanguage = lang; + _SystemLanguageCode = lang; break; } } @@ -328,21 +327,118 @@ std::string CI18N::getSystemLanguageCode () } #endif - // use system locale (works under Linux and Windows) - if (s_cachedSystemLanguage.empty()) +#ifdef NL_OS_WINDOWS + // use user locale under Windows (since Vista) + if (_SystemLanguageCode.empty() && false) { - std::string lang = NLMISC::toLower(std::string(setlocale(LC_CTYPE, ""))); + // GetUserDefaultLocaleName prototype + typedef int (WINAPI* GetUserDefaultLocaleNamePtr)(LPWSTR lpLocaleName, int cchLocaleName); - // only keep 2 first characters - if (lang.size() > 1) - s_cachedSystemLanguage = lang.substr(0, 2); + // get pointer on GetUserDefaultLocaleName, kernel32.dll is always in memory so no need to call LoadLibrary + GetUserDefaultLocaleNamePtr nlGetUserDefaultLocaleName = (GetUserDefaultLocaleNamePtr)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetUserDefaultLocaleName"); + + // only use it if found + if (nlGetUserDefaultLocaleName) + { + // get user locale + wchar_t buffer[LOCALE_NAME_MAX_LENGTH]; + sint res = nlGetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH); + + // convert wide string to std::string + std::string lang = wideToUtf8(buffer); + + // only keep 2 first characters + if (lang.size() > 1) + _SystemLanguageCode = lang.substr(0, 2); + } + } +#endif + + // use system locale (works under OS X, Linux and Windows) + if (_SystemLanguageCode.empty()) + { + // get default locale + char *locale = setlocale(LC_CTYPE, ""); + + if (locale) + { + std::string lang(locale); + +#ifdef NL_OS_WINDOWS + // be sure supported languages are initialized + initLanguages(); + + // locales names are different under Windows, for example: French_France.1252 + for(uint i = 0; i < _LanguageNames.size(); ++i) + { + std::string name = _LanguageNames[i].toUtf8(); + + // so we compare the language name with the supported ones + if (lang.compare(0, name.length(), name) == 0) + { + // found, so use its code + _SystemLanguageCode = _LanguageCodes[i]; + break; + } + } +#else + std::string lang = NLMISC::toLower(lang); + + // only keep 2 first characters + if (lang.size() > 1) + _SystemLanguageCode = lang.substr(0, 2); +#endif + } } // english is default language - if (s_cachedSystemLanguage.empty()) - s_cachedSystemLanguage = "en"; + if (_SystemLanguageCode.empty()) + _SystemLanguageCode = "en"; - return s_cachedSystemLanguage; + return _SystemLanguageCode; +} + +bool CI18N::setSystemLanguageCode (const std::string &languageCode) +{ + // be sure supported languages are initialized + initLanguages(); + + std::string lang = NLMISC::toLower(languageCode); + + // specified language is really a code (2 characters) + if (lang.length() == 2) + { + // check if language code is supported + for(uint i = 0; i < _LanguageCodes.size(); ++i) + { + std::string code = NLMISC::toLower(_LanguageCodes[i]); + + if (lang == code) + { + // found, so use it + _SystemLanguageCode = lang; + return true; + } + } + } + // specified language is something else + else + { + // check if language name is supported + for(uint i = 0; i < _LanguageNames.size(); ++i) + { + std::string name = NLMISC::toLower(_LanguageNames[i].toUtf8()); + + if (name == lang) + { + // found, so use its code + _SystemLanguageCode = _LanguageCodes[i]; + return true; + } + } + } + + return false; } void CI18N::removeCComment(ucstring &commentedString) From 962b43d2bd999c86eec5520e9c0d947242461d07 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 15:09:02 +0100 Subject: [PATCH 14/48] Fixed: Possible crashes if ov_info returns NULL --HG-- branch : develop --- code/nel/src/sound/audio_decoder_vorbis.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/nel/src/sound/audio_decoder_vorbis.cpp b/code/nel/src/sound/audio_decoder_vorbis.cpp index e438d43cc..1c11c32d7 100644 --- a/code/nel/src/sound/audio_decoder_vorbis.cpp +++ b/code/nel/src/sound/audio_decoder_vorbis.cpp @@ -195,13 +195,17 @@ uint32 CAudioDecoderVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 m uint8 CAudioDecoderVorbis::getChannels() { vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return (uint8)vi->channels; + if (vi) return (uint8)vi->channels; + nlwarning("ov_info returned NULL"); + return 0; } uint CAudioDecoderVorbis::getSamplesPerSec() { vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return (uint)vi->rate; + if (vi) return (uint)vi->rate; + nlwarning("ov_info returned NULL"); + return 0; } uint8 CAudioDecoderVorbis::getBitsPerSample() From 6e816dfaa2fc2840e3ba9650f4f0dd0d9b74b338 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 18:10:01 +0100 Subject: [PATCH 15/48] Changed: Init log before calling prelogInit() --HG-- branch : develop --- code/ryzom/client/src/client.cpp | 4 ++++ code/ryzom/client/src/init.cpp | 37 +++++++++++++++++++------------- code/ryzom/client/src/init.h | 3 +++ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index e4a77b3c6..1e140d3cc 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -289,6 +289,10 @@ int main(int argc, char **argv) #else // TODO for Linux : splashscreen + + // initialize log + initLog(); + #endif // initialize patch manager and set the ryzom full path, before it's used diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 864451718..18c8ba022 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -796,6 +796,28 @@ static bool addRyzomIconBitmap(const std::string &directory, vector &bi } #endif +//--------------------------------------------------- +// initLog : +// Initialize the client.log file +//--------------------------------------------------- +void initLog() +{ + // Add a displayer for Debug Infos. + createDebug(); + + // Client.Log displayer + nlassert( !ErrorLog->getDisplayer("CLIENT.LOG") ); + CFileDisplayer *ClientLogDisplayer = new CFileDisplayer(getLogDirectory() + "client.log", true, "CLIENT.LOG"); + DebugLog->addDisplayer (ClientLogDisplayer); + InfoLog->addDisplayer (ClientLogDisplayer); + WarningLog->addDisplayer (ClientLogDisplayer); + ErrorLog->addDisplayer (ClientLogDisplayer); + AssertLog->addDisplayer (ClientLogDisplayer); + + // Display the client version. + nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str()); +} + //--------------------------------------------------- // prelogInit : // Initialize the application before login @@ -848,21 +870,6 @@ void prelogInit() // Due to Bug #906, we disable the stl xml allocation // nlverify (xmlMemSetup (XmlFree4NeL, XmlMalloc4NeL, XmlRealloc4NeL, XmlStrdup4NeL) == 0); - // Add a displayer for Debug Infos. - createDebug(); - - // Client.Log displayer - nlassert( !ErrorLog->getDisplayer("CLIENT.LOG") ); - CFileDisplayer *ClientLogDisplayer = new CFileDisplayer(getLogDirectory() + "client.log", true, "CLIENT.LOG"); - DebugLog->addDisplayer (ClientLogDisplayer); - InfoLog->addDisplayer (ClientLogDisplayer); - WarningLog->addDisplayer (ClientLogDisplayer); - ErrorLog->addDisplayer (ClientLogDisplayer); - AssertLog->addDisplayer (ClientLogDisplayer); - - // Display the client version. - nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str()); - // Init the debug memory initDebugMemory(); diff --git a/code/ryzom/client/src/init.h b/code/ryzom/client/src/init.h index cdcdfb418..f179bf13d 100644 --- a/code/ryzom/client/src/init.h +++ b/code/ryzom/client/src/init.h @@ -27,6 +27,9 @@ namespace NLMISC class IProgressCallback; } +// Initialize the log +void initLog(); + // Initialize the application before login step void prelogInit(); From 94f4e901c94b0e4622a4f4de7efc38568abbce9a Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:06:20 +0100 Subject: [PATCH 16/48] Changed: Fix clang warnings --HG-- branch : develop --- code/nel/include/nel/gui/view_pointer.h | 14 +++++++------- code/ryzom/client/src/entity_cl.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/nel/include/nel/gui/view_pointer.h b/code/nel/include/nel/gui/view_pointer.h index 382135a92..1cc7a4b0c 100644 --- a/code/nel/include/nel/gui/view_pointer.h +++ b/code/nel/include/nel/gui/view_pointer.h @@ -71,13 +71,13 @@ namespace NLGUI private: /// Drawing helpers - virtual bool drawResizer(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } - virtual bool drawRotate(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } - virtual bool drawScale(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } - virtual bool drawColorPicker(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } - virtual bool drawLink(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } - virtual bool drawBrowse(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } - virtual bool drawPan(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } + virtual bool drawResizer(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } + virtual bool drawRotate(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } + virtual bool drawScale(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } + virtual bool drawColorPicker(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } + virtual bool drawLink(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } + virtual bool drawBrowse(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } + virtual bool drawPan(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; } virtual bool drawCustom(CCtrlBase* pCB); protected: diff --git a/code/ryzom/client/src/entity_cl.h b/code/ryzom/client/src/entity_cl.h index fb04576bc..328ec1cc7 100644 --- a/code/ryzom/client/src/entity_cl.h +++ b/code/ryzom/client/src/entity_cl.h @@ -86,7 +86,7 @@ namespace NL3D class CEntitySheet; class CEntityCL; -class CAttackInfo; +struct CAttackInfo; class CItemSheet; From d7121b4b7adc1c65220a34b964559057e14dee72 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:07:52 +0100 Subject: [PATCH 17/48] Changed: Don't need to use Windows functions with locale because the bug also occurs under Linux and OS X --HG-- branch : develop --- code/nel/include/nel/misc/i_xml.h | 3 -- code/nel/include/nel/misc/o_xml.h | 3 -- code/nel/src/misc/i_xml.cpp | 63 ++++++------------------------- code/nel/src/misc/o_xml.cpp | 22 ----------- 4 files changed, 12 insertions(+), 79 deletions(-) diff --git a/code/nel/include/nel/misc/i_xml.h b/code/nel/include/nel/misc/i_xml.h index 20ee8a7e0..b078eb7ee 100644 --- a/code/nel/include/nel/misc/i_xml.h +++ b/code/nel/include/nel/misc/i_xml.h @@ -236,9 +236,6 @@ private: // If not NULL, binary mode detected, use this stream in serials IStream *_BinaryStream; - - // System dependant structure for locale - void* _Locale; }; diff --git a/code/nel/include/nel/misc/o_xml.h b/code/nel/include/nel/misc/o_xml.h index 8346a6884..5bafacd60 100644 --- a/code/nel/include/nel/misc/o_xml.h +++ b/code/nel/include/nel/misc/o_xml.h @@ -181,9 +181,6 @@ private: // Error message std::string _ErrorString; - - // System dependant structure for locale - void* _Locale; }; diff --git a/code/nel/src/misc/i_xml.cpp b/code/nel/src/misc/i_xml.cpp index e722f3eee..fbd8f5d9f 100644 --- a/code/nel/src/misc/i_xml.cpp +++ b/code/nel/src/misc/i_xml.cpp @@ -24,11 +24,6 @@ // Include from libxml2 #include -#if defined(NL_OS_WINDOWS) && defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 80 -#define USE_LOCALE_ATOF -#include -#endif - using namespace std; #define NLMISC_READ_BUFFER_SIZE 1024 @@ -46,26 +41,10 @@ const char SEPARATOR = ' '; // *************************************************************************** -#define readnumber(dest,thetype,digits,convfunc) \ +#define readnumber(dest,digits) \ string number_as_string; \ serialSeparatedBufferIn( number_as_string ); \ - dest = (thetype)convfunc( number_as_string.c_str() ); - -#ifdef USE_LOCALE_ATOF - -#define readnumberlocale(dest,thetype,digits,convfunc) \ - string number_as_string; \ - serialSeparatedBufferIn( number_as_string ); \ - dest = (thetype)convfunc( number_as_string.c_str(), (_locale_t)_Locale ); - -#define nl_atof _atof_l - -#else - -#define readnumberlocale(dest,thetype,digits,convfunc) readnumber(dest,thetype,digits,convfunc) -#define nl_atof atof - -#endif + NLMISC::fromString(number_as_string, dest); // *************************************************************************** @@ -91,13 +70,6 @@ CIXml::CIXml () : IStream (true /* Input mode */) _ErrorString = ""; _TryBinaryMode = false; _BinaryStream = NULL; - -#ifdef USE_LOCALE_ATOF - // create C numeric locale - _Locale = _create_locale(LC_NUMERIC, "C"); -#else - _Locale = NULL; -#endif } // *************************************************************************** @@ -113,13 +85,6 @@ CIXml::CIXml (bool tryBinaryMode) : IStream (true /* Input mode */) _ErrorString = ""; _TryBinaryMode = tryBinaryMode; _BinaryStream = NULL; - -#ifdef USE_LOCALE_ATOF - // create C numeric locale - _Locale = _create_locale(LC_NUMERIC, "C"); -#else - _Locale = NULL; -#endif } // *************************************************************************** @@ -128,10 +93,6 @@ CIXml::~CIXml () { // Release release (); - -#ifdef USE_LOCALE_ATOF - if (_Locale) _free_locale((_locale_t)_Locale); -#endif } // *************************************************************************** @@ -468,7 +429,7 @@ void CIXml::serial(uint8 &b) else { // Read the number - readnumber( b, uint8, 3, atoi ); + readnumber( b, 3 ); } } @@ -482,7 +443,7 @@ void CIXml::serial(sint8 &b) } else { - readnumber( b, sint8, 4, atoi ); + readnumber( b, 4 ); } } @@ -496,7 +457,7 @@ void CIXml::serial(uint16 &b) } else { - readnumber( b, uint16, 5, atoi ); + readnumber( b, 5 ); } } @@ -510,7 +471,7 @@ void CIXml::serial(sint16 &b) } else { - readnumber( b, sint16, 6, atoi ); + readnumber( b, 6 ); } } @@ -529,7 +490,7 @@ void CIXml::serial(uint32 &b) } else { - readnumber( b, uint32, 10, atoui ); + readnumber( b, 10 ); } } @@ -543,7 +504,7 @@ void CIXml::serial(sint32 &b) } else { - readnumber( b, sint32, 11, atoi ); + readnumber( b, 11 ); } } @@ -557,7 +518,7 @@ void CIXml::serial(uint64 &b) } else { - readnumber( b, uint64, 20, atoiInt64 ); + readnumber( b, 20 ); } } @@ -571,7 +532,7 @@ void CIXml::serial(sint64 &b) } else { - readnumber( b, sint64, 20, atoiInt64 ); + readnumber( b, 20 ); } } @@ -585,7 +546,7 @@ void CIXml::serial(float &b) } else { - readnumberlocale( b, float, 128, nl_atof ); + readnumber( b, 128 ); } } @@ -599,7 +560,7 @@ void CIXml::serial(double &b) } else { - readnumberlocale( b, double, 128, nl_atof ); + readnumber( b, 128 ); } } diff --git a/code/nel/src/misc/o_xml.cpp b/code/nel/src/misc/o_xml.cpp index d07362904..6df48ef80 100644 --- a/code/nel/src/misc/o_xml.cpp +++ b/code/nel/src/misc/o_xml.cpp @@ -43,22 +43,11 @@ const char SEPARATOR = ' '; // *************************************************************************** -#ifdef USE_LOCALE_SPRINTF - -#define writenumber(src,format,digits) \ - char number_as_cstring [digits+1]; \ - _sprintf_l( number_as_cstring, format, (_locale_t)_Locale, src ); \ - serialSeparatedBufferOut( number_as_cstring ); - -#else - #define writenumber(src,format,digits) \ char number_as_cstring [digits+1]; \ sprintf( number_as_cstring, format, src ); \ serialSeparatedBufferOut( number_as_cstring ); -#endif - // *************************************************************************** // XML callbacks // *************************************************************************** @@ -149,13 +138,6 @@ COXml::COXml () : IStream (false /* Output mode */) // Push begin _PushBegin = false; - -#ifdef USE_LOCALE_SPRINTF - // create C numeric locale - _Locale = _create_locale(LC_NUMERIC, "C"); -#else - _Locale = NULL; -#endif } // *************************************************************************** @@ -215,10 +197,6 @@ COXml::~COXml () { // Flush document to the internal stream flush (); - -#ifdef USE_LOCALE_SPRINTF - if (_Locale) _free_locale((_locale_t)_Locale); -#endif } // *************************************************************************** From 97647b2264a3e775b51ada5e968e65b25b205640 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:08:43 +0100 Subject: [PATCH 18/48] Fixed: Set numeric locale in CApplicationContext --HG-- branch : develop --- code/nel/src/misc/app_context.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/nel/src/misc/app_context.cpp b/code/nel/src/misc/app_context.cpp index 2383fcda5..5206681f9 100644 --- a/code/nel/src/misc/app_context.cpp +++ b/code/nel/src/misc/app_context.cpp @@ -19,6 +19,8 @@ #include "nel/misc/dynloadlib.h" #include "nel/misc/command.h" +#include + #ifdef DEBUG_NEW #define new DEBUG_NEW #endif @@ -85,6 +87,9 @@ void INelContext::contextReady() _NelContext = this; *(_getInstance()) = this; + // set numeric locale to C to avoid the use of decimal separators different of a dot + char *locale = setlocale(LC_NUMERIC, "C"); + // register any pending thinks // register local instance counter in the global instance counter manager From 05e0500aaf41e278be43c44ea7ef6b25f0b3236f Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:09:26 +0100 Subject: [PATCH 19/48] Changed: Check if LC_NUMERIC is correct before loading or saving config files --HG-- branch : develop --- code/nel/src/misc/config_file/config_file.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/code/nel/src/misc/config_file/config_file.cpp b/code/nel/src/misc/config_file/config_file.cpp index 093992487..bab1c123b 100644 --- a/code/nel/src/misc/config_file/config_file.cpp +++ b/code/nel/src/misc/config_file/config_file.cpp @@ -316,6 +316,13 @@ CConfigFile::~CConfigFile () void CConfigFile::load (const string &fileName, bool lookupPaths ) { + char *locale = setlocale(LC_NUMERIC, NULL); + + if (!locale || strcmp(locale, "C")) + { + nlerror("Numeric locale not defined to C, an external library possibly redefined it!"); + } + if(fileName.empty()) { nlwarning ("CF: Can't load a empty file name configfile"); @@ -597,8 +604,12 @@ bool CConfigFile::exists (const std::string &varName) void CConfigFile::save () const { - // Avoid any problem, Force Locale to default - setlocale(LC_ALL, "C"); + char *locale = setlocale(LC_NUMERIC, NULL); + + if (!locale || strcmp(locale, "C")) + { + nlerror("Numeric locale not defined to C, an external library possibly redefined it!"); + } FILE *fp = nlfopen (getFilename(), "w"); if (fp == NULL) From 40c7c82a2d329d43d73c3647acff3068ed8e3e84 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:09:43 +0100 Subject: [PATCH 20/48] Changed: Removed wrong check --HG-- branch : develop --- code/nel/src/misc/i18n.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/misc/i18n.cpp b/code/nel/src/misc/i18n.cpp index fc4cbf341..e230eab2d 100644 --- a/code/nel/src/misc/i18n.cpp +++ b/code/nel/src/misc/i18n.cpp @@ -329,7 +329,7 @@ std::string CI18N::getSystemLanguageCode () #ifdef NL_OS_WINDOWS // use user locale under Windows (since Vista) - if (_SystemLanguageCode.empty() && false) + if (_SystemLanguageCode.empty()) { // GetUserDefaultLocaleName prototype typedef int (WINAPI* GetUserDefaultLocaleNamePtr)(LPWSTR lpLocaleName, int cchLocaleName); From 4074f095ebe3a1d839f48486470935d845af5eb7 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:10:19 +0100 Subject: [PATCH 21/48] Fixed: Move setrlimit after initializing logs --HG-- branch : develop --- code/ryzom/client/src/client.cpp | 26 +------------------ code/ryzom/client/src/init.cpp | 43 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 1e140d3cc..dcce43cc0 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -30,13 +30,6 @@ #include #endif -#ifdef NL_OS_MAC -#include -#include -#include "nel/misc/dynloadlib.h" -#include "app_bundle_utils.h" -#endif - #include "nel/misc/debug.h" #include "nel/misc/command.h" #include "nel/net/tcp_sock.h" @@ -226,23 +219,6 @@ int main(int argc, char **argv) } #endif // TEST_CRASH_COUNTER -#ifdef NL_OS_MAC - struct rlimit rlp, rlp2, rlp3; - - getrlimit(RLIMIT_NOFILE, &rlp); - - rlp2.rlim_cur = 1024; - rlp2.rlim_max = rlp.rlim_max; - setrlimit(RLIMIT_NOFILE, &rlp2); - - getrlimit(RLIMIT_NOFILE, &rlp3); - nlinfo("rlimit before %d %d\n", rlp.rlim_cur, rlp.rlim_max); - nlinfo("rlimit after %d %d\n", rlp3.rlim_cur, rlp3.rlim_max); - - // add the bundle's plugins path as library search path (for nel drivers) - CLibrary::addLibPath(getAppBundlePath() + "/Contents/PlugIns/nel/"); -#endif - #if defined(NL_OS_WINDOWS) #ifdef TEST_CRASH_COUNTER @@ -289,11 +265,11 @@ int main(int argc, char **argv) #else // TODO for Linux : splashscreen +#endif // initialize log initLog(); -#endif // initialize patch manager and set the ryzom full path, before it's used CPatchManager *pPM = CPatchManager::getInstance(); diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 18c8ba022..a55a09db9 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -105,6 +105,12 @@ extern HINSTANCE HInstance; extern HWND SlashScreen; #endif // NL_OS_WINDOWS +#ifdef NL_OS_MAC +#include +#include +#include "nel/misc/dynloadlib.h" +#endif + #include "app_bundle_utils.h" #include @@ -816,6 +822,43 @@ void initLog() // Display the client version. nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str()); + +#ifdef NL_OS_MAC + struct rlimit rlp, rlp2, rlp3; + + getrlimit(RLIMIT_NOFILE, &rlp); + + rlim_t value = 1024; + + rlp2.rlim_cur = std::min(value, rlp.rlim_max); + rlp2.rlim_max = rlp.rlim_max; + + if (setrlimit(RLIMIT_NOFILE, &rlp2)) + { + if (errno == EINVAL) + { + nlwarning("Unable to set rlimit with error: the specified limit is invalid"); + } + else if (errno == EPERM) + { + nlwarning("Unable to set rlimit with error: the limit specified would have raised the maximum limit value and the caller is not the super-user"); + } + else + { + nlwarning("Unable to set rlimit with error: unknown error"); + } + } + + getrlimit(RLIMIT_NOFILE, &rlp3); + nlinfo("rlimit before %llu %llu", (uint64)rlp.rlim_cur, (uint64)rlp.rlim_max); + nlinfo("rlimit after %llu %llu", (uint64)rlp3.rlim_cur, (uint64)rlp3.rlim_max); + + // add the bundle's plugins path as library search path (for nel drivers) + if (CFile::isExists(getAppBundlePath() + "/Contents/PlugIns/nel")) + { + CLibrary::addLibPath(getAppBundlePath() + "/Contents/PlugIns/nel/"); + } +#endif } //--------------------------------------------------- From cf20e21f838abf6dd47271fc891892ba28ad93b8 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:11:03 +0100 Subject: [PATCH 22/48] Changed: Use named arguments in uiFilterMenuDynamic translation --HG-- branch : develop --- .../ryzom/client/src/interface_v3/people_interraction.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 62e6c0990..71cb5f7ec 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2635,7 +2635,13 @@ public: { ucstring title; STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - pMenu->addLineAtIndex(5 + insertion_index, title+" @{T8}/"+s, "chat_target_selected", "dyn"+s, "dyn"+s); + + // replace dynamic channel name and shortcut + ucstring res = CI18N::get("uiFilterMenuDynamic"); + strFindReplace(res, "%channel", title); + strFindReplace(res, "%shortcut", s); + + pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s); insertion_index++; } } From f376317f101326c22165248367fee58d45f773e0 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:26:43 +0100 Subject: [PATCH 23/48] Fixed: Compilation --HG-- branch : develop --- code/nel/src/misc/i18n.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/nel/src/misc/i18n.cpp b/code/nel/src/misc/i18n.cpp index e230eab2d..b64116c1c 100644 --- a/code/nel/src/misc/i18n.cpp +++ b/code/nel/src/misc/i18n.cpp @@ -382,11 +382,9 @@ std::string CI18N::getSystemLanguageCode () } } #else - std::string lang = NLMISC::toLower(lang); - // only keep 2 first characters if (lang.size() > 1) - _SystemLanguageCode = lang.substr(0, 2); + _SystemLanguageCode = NLMISC::toLower(lang).substr(0, 2); #endif } } From a7b3532687f2055d30c9500367e9d3ab5f11d786 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 22:26:58 +0100 Subject: [PATCH 24/48] Changed: Minor changes --HG-- branch : develop --- code/ryzom/common/src/game_share/mirrored_data_set_inline.h | 2 +- code/ryzom/tools/client/client_patcher/main.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/code/ryzom/common/src/game_share/mirrored_data_set_inline.h b/code/ryzom/common/src/game_share/mirrored_data_set_inline.h index 50ab076b7..69607b7dd 100644 --- a/code/ryzom/common/src/game_share/mirrored_data_set_inline.h +++ b/code/ryzom/common/src/game_share/mirrored_data_set_inline.h @@ -205,7 +205,7 @@ inline bool CMirroredDataSet::propIsList( TPropertyIndex propIndex ) const * Display the values of one property for all entities */ template -inline void CMirroredDataSet::displayPropValues( TPropertyIndex propIndex, T* pt, NLMISC::CLog& log ) const +inline void CMirroredDataSet::displayPropValues( TPropertyIndex propIndex, T* /* pt */, NLMISC::CLog& log ) const { // std::stringstream ss; // ss << "Mirror property " << propIndex << ":" << endl; diff --git a/code/ryzom/tools/client/client_patcher/main.cpp b/code/ryzom/tools/client/client_patcher/main.cpp index f03943345..08be87fbe 100644 --- a/code/ryzom/tools/client/client_patcher/main.cpp +++ b/code/ryzom/tools/client/client_patcher/main.cpp @@ -5,8 +5,6 @@ #include "nel/misc/cmd_args.h" -#include - #ifdef NL_OS_WINDOWS #include #endif From e191e1675b0ff4d0910ffaf7de6870303ab15c7f Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Mar 2016 15:34:00 +0100 Subject: [PATCH 25/48] Fixed: Define _DARWIN_UNLIMITED_STREAMS to fix setrlimit under OS X --HG-- branch : develop --- code/CMakeModules/nel.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 1d19212c9..3995dcbf8 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -871,7 +871,7 @@ MACRO(NL_SETUP_BUILD) ENDIF(ANDROID) IF(APPLE) - ADD_PLATFORM_FLAGS("-gdwarf-2") + ADD_PLATFORM_FLAGS("-gdwarf-2 -D_DARWIN_UNLIMITED_STREAMS") ENDIF(APPLE) # Fix "relocation R_X86_64_32 against.." error on x64 platforms From 0d773e3e79068fb7401582b9de3a6952df3aa453 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Mar 2016 16:21:06 +0100 Subject: [PATCH 26/48] Fixed: Use nlfopen in tools and servers --HG-- branch : develop --- code/nel/include/nel/pipeline/tool_logger.h | 5 ++- code/nel/samples/3d/cluster_viewer/main.cpp | 3 +- code/nel/samples/net/service/chat_service.cpp | 2 +- code/nel/samples/net/udp/bench_service.cpp | 7 ++-- code/nel/samples/net/udp/client.cpp | 5 ++- code/nel/tools/3d/file_info/main.cpp | 5 +-- code/nel/tools/3d/lightmap_optimizer/main.cpp | 3 +- .../nel_export/nel_export_lightmap_v2.cpp | 9 +++-- .../3d/shapes_exporter/shapes_exporter.cpp | 5 ++- code/nel/tools/3d/tga_2_dds/tga2dds.cpp | 5 ++- code/nel/tools/3d/zone_welder/zone_welder.cpp | 3 +- code/nel/tools/3d/zviewer/zviewer.cpp | 5 ++- .../tools/georges/georges2csv/georges2csv.cpp | 6 ++- .../tools/misc/data_mirror/data_mirrorDlg.cpp | 30 ++++++++++----- code/nel/tools/misc/disp_sheet_id/main.cpp | 3 +- .../misc/make_sheet_id/make_sheet_id.cpp | 5 ++- code/nel/tools/misc/xml_packer/xml_packer.cpp | 15 ++++---- .../admin_executor_service.cpp | 8 ++-- .../nel_launcher_windows_ext2/patch.cpp | 3 +- .../server/src/admin_modules/aes_module.cpp | 15 ++++---- .../server/src/admin_modules/as_module.cpp | 5 ++- .../server/src/ai_data_service/pacs_scan.cpp | 7 ++-- .../src/ai_service/ai_script_data_manager.cpp | 2 +- .../src/entities_game_service/deposit.cpp | 3 +- .../game_item_manager/game_item.cpp | 3 +- .../game_item_manager/game_item_manager.cpp | 2 +- .../entities_game_service/harvest_source.cpp | 4 +- .../phrase_manager/fg_prospection_phrase.cpp | 4 +- .../player_manager/cdb_synchronised.cpp | 2 +- .../player_manager/player.cpp | 4 +- .../cl_contest_logger.cpp | 2 +- .../rr_repository_reciever.cpp | 2 +- .../src/log_analyser_service/commands.cpp | 2 +- .../src/logger_service/logger_service.cpp | 3 +- .../src/patchman_service/file_manager.cpp | 3 +- .../rr_repository_reciever.cpp | 2 +- .../spt_server_patch_terminal.cpp | 5 ++- .../ryzom/server/src/pd_lib/pd_server_utils.h | 3 +- .../src/pd_support_service/daily_commands.cpp | 3 +- .../pd_support_service/hourly_commands.cpp | 3 +- .../testing_tool_service.cpp | 3 +- .../mission_compiler_feDlg.cpp | 5 ++- .../mission_compiler_lib/mission_compiler.cpp | 3 +- .../tools/leveldesign/mp_generator/main.cpp | 3 +- .../tools/leveldesign/mp_generator/utils.h | 4 +- .../named_items_2_csv/named_items_2_csv.cpp | 12 +++--- .../primitive_id_assignator.cpp | 3 +- .../tools/leveldesign/uni_conv/uni_conv.cpp | 3 +- .../world_editor/world_editor/main_frm.cpp | 3 +- code/ryzom/tools/occ2huff/occ2huff.cpp | 2 +- code/ryzom/tools/pd_parser/templatizer.h | 2 +- .../phrase_generator/phrase_generator.cpp | 37 ++++++++++--------- .../sheet_random_generator.cpp | 5 ++- .../sheet_random_generator/srg_utilities.h | 17 +++++---- code/ryzom/tools/translation_tools/main.cpp | 3 +- code/ryzom/tools/xml_packer/xml_packer.cpp | 13 ++++--- .../mission_compiler/validation_file.cpp | 3 +- .../increment_version/increment_version.cpp | 3 +- .../path_content_diff/path_content_diff.cpp | 3 +- 59 files changed, 193 insertions(+), 140 deletions(-) diff --git a/code/nel/include/nel/pipeline/tool_logger.h b/code/nel/include/nel/pipeline/tool_logger.h index 55b3b2455..714f46d2d 100644 --- a/code/nel/include/nel/pipeline/tool_logger.h +++ b/code/nel/include/nel/pipeline/tool_logger.h @@ -39,6 +39,7 @@ // NeL includes #include #include +#include // Project includes @@ -102,7 +103,7 @@ public: { releaseError(); - m_ErrorLog = fopen(errorLog.c_str(), "wt"); + m_ErrorLog = nlfopen(errorLog, "wt"); fwrite(s_ErrorHeader.c_str(), 1, s_ErrorHeader.length(), m_ErrorLog); fwrite("\n", 1, 1, m_ErrorLog); fflush(m_ErrorLog); @@ -113,7 +114,7 @@ public: { releaseDepend(); - m_DependLog = fopen(dependLog.c_str(), "wt"); + m_DependLog = nlfopen(dependLog, "wt"); fwrite(s_DependHeader.c_str(), 1, s_DependHeader.length(), m_DependLog); fwrite("\n", 1, 1, m_DependLog); // fflush(m_DependLog); diff --git a/code/nel/samples/3d/cluster_viewer/main.cpp b/code/nel/samples/3d/cluster_viewer/main.cpp index d7956adbe..ef05d557e 100644 --- a/code/nel/samples/3d/cluster_viewer/main.cpp +++ b/code/nel/samples/3d/cluster_viewer/main.cpp @@ -23,6 +23,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include "nel/misc/bitmap.h" #include "nel/misc/events.h" @@ -115,7 +116,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector &D float posx, posy, posz; float roti, rotj, rotk; - FILE *f = fopen (CPath::lookup(ScriptName).c_str(),"rb"); + FILE *f = nlfopen (CPath::lookup(ScriptName), "rb"); fseek (f, 0, SEEK_END); uint file_size = ftell (f); fseek (f, 0, SEEK_SET); diff --git a/code/nel/samples/net/service/chat_service.cpp b/code/nel/samples/net/service/chat_service.cpp index 36b438e44..c2efc71f4 100644 --- a/code/nel/samples/net/service/chat_service.cpp +++ b/code/nel/samples/net/service/chat_service.cpp @@ -60,7 +60,7 @@ public: nlinfo ("init() was called"); -// fp = fopen (NLMISC::CFile::findNewFile("stat.csv").c_str(), "wt"); +// fp = nlfopen (NLMISC::CFile::findNewFile("stat.csv"), "wt"); } bool update () diff --git a/code/nel/samples/net/udp/bench_service.cpp b/code/nel/samples/net/udp/bench_service.cpp index 4b75a6b93..22f570260 100644 --- a/code/nel/samples/net/udp/bench_service.cpp +++ b/code/nel/samples/net/udp/bench_service.cpp @@ -33,6 +33,7 @@ #endif +#include "nel/misc/common.h" #include "nel/misc/debug.h" #include "nel/misc/mem_stream.h" #include "nel/misc/path.h" @@ -276,11 +277,11 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u } string fn = StatPathName + ConnectionName + "_" + ha + "_" + getDate() + ".pong"; - FILE *fp = fopen (fn.c_str(), "rt"); + FILE *fp = nlfopen (fn, "rt"); if (fp == NULL) { // new file, add the header - FILE *fp = fopen (fn.c_str(), "wt"); + FILE *fp = nlfopen (fn, "wt"); if (fp != NULL) { fprintf (fp, "#%s\t%s\t%s\t%s\n", "PingTime", "PongTime", "Delta", "PingNumber"); @@ -292,7 +293,7 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u fclose (fp); } - fp = fopen (fn.c_str(), "at"); + fp = nlfopen (fn, "at"); if (fp == NULL) { nlwarning ("Can't open pong file name '%s'", fn.c_str()); diff --git a/code/nel/samples/net/udp/client.cpp b/code/nel/samples/net/udp/client.cpp index 90de35bb2..0cdb98c53 100644 --- a/code/nel/samples/net/udp/client.cpp +++ b/code/nel/samples/net/udp/client.cpp @@ -21,6 +21,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/debug.h" +#include "nel/misc/common.h" #include "nel/misc/mem_stream.h" #include "nel/misc/time_nl.h" #include "nel/misc/config_file.h" @@ -112,7 +113,7 @@ void exit (const string &reason) void createConfigFile() { - FILE *fp = fopen ("client.cfg", "wt"); + FILE *fp = nlfopen ("client.cfg", "wt"); if (fp == NULL) { InfoLog->displayRawNL ("Can't create client.cfg"); @@ -159,7 +160,7 @@ void checkConnectionName () void loadConfigFile () { - FILE *fp = fopen ("client.cfg", "rt"); + FILE *fp = nlfopen ("client.cfg", "rt"); if (fp == NULL) { createConfigFile(); diff --git a/code/nel/tools/3d/file_info/main.cpp b/code/nel/tools/3d/file_info/main.cpp index b781e43fe..e8c6e072b 100644 --- a/code/nel/tools/3d/file_info/main.cpp +++ b/code/nel/tools/3d/file_info/main.cpp @@ -17,6 +17,7 @@ #include "nel/misc/file.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/3d/scene_group.h" #include "nel/3d/zone.h" #include "nel/3d/skeleton_shape.h" @@ -660,9 +661,7 @@ int main(int argc, const char *argv[]) options.insert (argv[i]); // Open log - FILE *logStream; - logStream= fopen(std::string(getLogDirectory() + "file_info.log").c_str(), "wt"); - + FILE *logStream = nlfopen(getLogDirectory() + "file_info.log", "wt"); // parse dir or file ?? const char *fileName= argv[1]; diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index f7e999799..2e1f0f47c 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -998,7 +998,8 @@ int main(int nNbArg, char **ppArgs) ChDir (sExeDir); // out a text file, with list of - FILE *out= fopen(ppArgs[4], "wt"); + FILE *out = nlfopen(ppArgs[4], "wt"); + if(!out) { outString(string("ERROR: cannot save ")+ppArgs[4]); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp index b79e4884f..f6cd6b80d 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_lightmap_v2.cpp @@ -8,6 +8,7 @@ #include "nel/misc/time_nl.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/triangle.h" #include "nel/misc/bsphere.h" #include "3d/quad_tree.h" @@ -3121,8 +3122,8 @@ void CNelExport::deleteLM(INode& ZeNode) sprintf( tmp, "%d", i ); sSaveName += tmp; sSaveName += ".tga"; - FILE *file; - if( file = fopen(sSaveName.c_str(),"rb") ) + FILE *file = nlfopen(sSaveName, "rb") + if (file) { fclose( file ); DeleteFile( sSaveName.c_str() ); @@ -3521,8 +3522,8 @@ bool CNelExport::exportScene(std::vector& vectNode) sprintf( tmp, "%d", i ); sSaveName += tmp; sSaveName += ".tga"; - FILE *file; - if( file = fopen(sSaveName.c_str(),"rb") ) + FILE *file = nlfopen(sSaveName, "rb"); + if (file) { fclose( file ); DeleteFile( sSaveName.c_str() ); diff --git a/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp b/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp index 0c4d08c4a..a63fcc969 100644 --- a/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp +++ b/code/nel/tools/3d/shapes_exporter/shapes_exporter.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . #include +#include #include #include #include @@ -851,7 +852,7 @@ bool ShapesExporter::renderPS(UInstance &entity, const string &output_path, doub { if(step > 0) { - FILE *fp = fopen(string(CPath::standardizePath(output_path)+"nb_steps.txt").c_str(), "w"); + FILE *fp = nlfopen(CPath::standardizePath(output_path)+"nb_steps.txt", "w"); if(fp) { fprintf(fp, "%d", step); fclose(fp); } } nlinfo("PS duration %f after %f with nothing with %d steps, dt %f", duration, startTime, step, deltaTime); @@ -873,7 +874,7 @@ bool ShapesExporter::createThumbnail(const string &filename, const string &path) uint selectedFrame = 0; if(CFile::getExtension(filename) == "ps") { - FILE *fp = fopen(string(CPath::standardizePath(output_path)+"nb_steps.txt").c_str(), "r"); + FILE *fp = nlfopen(CPath::standardizePath(output_path)+"nb_steps.txt", "r"); if(fp) { char str[100]; diff --git a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp index 7f3275694..5e40a4cca 100644 --- a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp +++ b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp @@ -18,6 +18,7 @@ #include #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/bitmap.h" #include "nel/misc/path.h" #include "nel/misc/debug.h" @@ -49,7 +50,7 @@ std::string getOutputFileName(const std::string &inputFileName); uint8 getType(const std::string &sFileNameDest) { uint32 dds; - FILE *f = fopen(sFileNameDest.c_str(),"rb"); + FILE *f = nlfopen(sFileNameDest, "rb"); if(f==NULL) { return NOT_DEFINED; @@ -105,7 +106,7 @@ uint8 getType(const std::string &sFileNameDest) bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap) { uint32 dds; - FILE *f = fopen(sFileNameDest.c_str(),"rb"); + FILE *f = nlfopen(sFileNameDest, "rb"); if(f==NULL) { return false; diff --git a/code/nel/tools/3d/zone_welder/zone_welder.cpp b/code/nel/tools/3d/zone_welder/zone_welder.cpp index f30a4b38b..7ca1d822a 100644 --- a/code/nel/tools/3d/zone_welder/zone_welder.cpp +++ b/code/nel/tools/3d/zone_welder/zone_welder.cpp @@ -20,6 +20,7 @@ #include #include "nel/misc/types_nl.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/3d/quad_tree.h" #include "nel/3d/zone.h" #include "nel/3d/landscape.h" @@ -978,7 +979,7 @@ int main(sint argc, char **argv) } #if WELD_LOG - fdbg = fopen("log.txt","wt"); + fdbg = nlfopen("log.txt","wt"); fprintf(fdbg,"Center zone : %s\n",argv[1]); #endif diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index 9d64badb1..c5f4419a4 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -743,7 +744,7 @@ void displayZones() \****************************************************************/ void writeConfigFile(const char * configFileName) { - FILE * f = fopen(configFileName,"wt"); + FILE * f = nlfopen(configFileName, "wt"); if(f==NULL) { @@ -801,7 +802,7 @@ void writeConfigFile(const char * configFileName) \****************************************************************/ void initViewerConfig(const char * configFileName) { - FILE * f = fopen(configFileName,"rt"); + FILE *f = nlfopen(configFileName, "rt"); if(f==NULL) { nlwarning("'%s' not found, default values used", configFileName); diff --git a/code/nel/tools/georges/georges2csv/georges2csv.cpp b/code/nel/tools/georges/georges2csv/georges2csv.cpp index 018a6abff..339479bfe 100644 --- a/code/nel/tools/georges/georges2csv/georges2csv.cpp +++ b/code/nel/tools/georges/georges2csv/georges2csv.cpp @@ -32,6 +32,7 @@ #include "nel/misc/file.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" //#include "nel/memory/memory_manager.h" #include "nel/misc/i18n.h" @@ -685,12 +686,13 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType { const uint BUFFER_SIZE = 16*1024; char lineBuffer[BUFFER_SIZE]; - FILE *s; vector fields; vector args; - if ((s = fopen(file.c_str(), "r")) == NULL) + FILE *s = nlfopen(file, "r"); + + if (s == NULL) { fprintf(stderr, "Can't find file %s to convert\n", file.c_str()); return; diff --git a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp index 100bd4e9c..340655e36 100644 --- a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp +++ b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp @@ -20,6 +20,7 @@ #include "progress_dialog.h" #include #include "nel/misc/file.h" +#include "nel/misc/common.h" using namespace std; using namespace NLMISC; @@ -468,9 +469,13 @@ void CData_mirrorDlg::OnOK() if (!LogDirectory.empty()) { string sTmp = LogDirectory + "data_mirror.txt"; - FILE *f = fopen(sTmp.c_str(),"at"); - fprintf(f,"Modified file : %s\n", dest.c_str()); - fclose(f); + FILE *f = nlfopen(sTmp ,"at"); + + if (f) + { + fprintf(f,"Modified file : %s\n", dest.c_str()); + fclose(f); + } } } @@ -503,9 +508,12 @@ void CData_mirrorDlg::OnOK() if (!LogDirectory.empty()) { string sTmp = LogDirectory + "data_mirror.txt"; - FILE *f = fopen(sTmp.c_str(),"at"); - fprintf(f,"Added file : %s\n", dest.c_str()); - fclose(f); + FILE *f = nlfopen(sTmp, "at"); + if (f) + { + fprintf(f,"Added file : %s\n", dest.c_str()); + fclose(f); + } } } @@ -535,9 +543,13 @@ void CData_mirrorDlg::OnOK() if (!LogDirectory.empty()) { string sTmp = LogDirectory + "data_mirror.txt"; - FILE *f = fopen(sTmp.c_str(),"at"); - fprintf(f,"Removed file : %s\n", dest.c_str()); - fclose(f); + FILE *f = nlfopen(sTmp, "at"); + + if (f) + { + fprintf(f,"Removed file : %s\n", dest.c_str()); + fclose(f); + } } } } diff --git a/code/nel/tools/misc/disp_sheet_id/main.cpp b/code/nel/tools/misc/disp_sheet_id/main.cpp index 7445023ce..c7fe6f782 100644 --- a/code/nel/tools/misc/disp_sheet_id/main.cpp +++ b/code/nel/tools/misc/disp_sheet_id/main.cpp @@ -40,6 +40,7 @@ int _getch() #include "nel/misc/path.h" #include "nel/misc/sheet_id.h" +#include "nel/misc/common.h" #include @@ -86,7 +87,7 @@ int main(int argc, const char *argv[]) sort(sheets.begin(), sheets.end(), Pred); // display. - FILE *out= fopen("sheetid.txt", "wb"); + FILE *out= nlfopen("sheetid.txt", "wb"); if(out) { for(uint i=0;i #include +#include #include #include @@ -567,9 +568,9 @@ int main( int argc, char ** argv ) // dump the list of extensions in a txt file if( dumpExtensions ) { - FILE * extListOutput; string extListFileName = outputPath + "sheet_ext.txt"; - if( !(extListOutput = fopen(extListFileName.c_str(),"w")) ) + FILE *extListOutput = nlfopen(extListFileName, "w"); + if (!extListOutput) { nlwarning("Can't open output file %s",extListFileName.c_str()); return 1; diff --git a/code/nel/tools/misc/xml_packer/xml_packer.cpp b/code/nel/tools/misc/xml_packer/xml_packer.cpp index 2d7695de4..7f7417020 100644 --- a/code/nel/tools/misc/xml_packer/xml_packer.cpp +++ b/code/nel/tools/misc/xml_packer/xml_packer.cpp @@ -17,6 +17,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/app_context.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/misc/algo.h" @@ -228,7 +229,7 @@ int main(int argc, char *argv[]) // read the index file set fileInIndex; char lineBuffer[1024]; - FILE *fp = fopen(indexFileName.c_str(), "rt"); + FILE *fp = nlfopen(indexFileName, "rt"); while (fgets(lineBuffer, 1024, fp)) fileInIndex.insert(CSString(lineBuffer).strip()); @@ -263,8 +264,8 @@ int main(int argc, char *argv[]) if (!validFiles.empty() && needRepack) { // open the pack file - // FILE *fp = fopen(filename.c_str(), "wt"); - FILE *fp = fopen(packFileName.c_str(), "wt"); + // FILE *fp = nlfopen(filename, "wt"); + FILE *fp = nlfopen(packFileName, "wt"); fprintf(fp, "\n"); @@ -275,7 +276,7 @@ int main(int argc, char *argv[]) printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " \n", CFile::getFilename(subFileName).c_str()); - FILE *subFp = fopen(subFileName.c_str(), "rt"); + FILE *subFp = nlfopen(subFileName, "rt"); nlassert(subFp != NULL); char buffer[MaxLineSize]; char *result; @@ -304,7 +305,7 @@ int main(int argc, char *argv[]) fclose(fp); // write the disposable index file used by pack to check for erased file - fp = fopen(indexFileName.c_str(), "wt"); + fp = nlfopen(indexFileName, "wt"); for (uint i=0; i") char str[1024]; - FILE *fp = fopen(fn.c_str(), "rt"); + FILE *fp = nlfopen(fn, "rt"); if (fp != NULL) { while (true) @@ -1654,7 +1654,7 @@ NLMISC_COMMAND(aesSystem, "Execute a system() call", "") log.displayNL("No stdout"); } - fp = fopen(fne.c_str(), "rt"); + fp = nlfopen(fne, "rt"); if (fp != NULL) { while (true) diff --git a/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp b/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp index a60f129fa..b55c8cdff 100644 --- a/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp +++ b/code/nelns/login_system/nel_launcher_windows_ext2/patch.cpp @@ -27,6 +27,7 @@ #endif #include "nel/misc/debug.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include "nel/misc/thread.h" @@ -586,7 +587,7 @@ private: string dest = filename.substr(0, filename.size ()-4); setRWAccess(dest); if(VerboseLog) nlinfo("Calling fopen('%s','wb')", dest.c_str()); - FILE *fp = fopen (dest.c_str(), "wb"); + FILE *fp = nlfopen (dest, "wb"); if (fp == NULL) { string err = toString("Can't open file '%s' : code=%d %s, (error code 32)", dest.c_str(), errno, strerror(errno)); diff --git a/code/ryzom/server/src/admin_modules/aes_module.cpp b/code/ryzom/server/src/admin_modules/aes_module.cpp index 734dfff64..aee6da68a 100644 --- a/code/ryzom/server/src/admin_modules/aes_module.cpp +++ b/code/ryzom/server/src/admin_modules/aes_module.cpp @@ -19,6 +19,7 @@ #include "nel/misc/singleton.h" #include #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/net/module.h" #include "nel/net/module_builder_parts.h" #include "nel/net/unified_network.h" @@ -297,7 +298,7 @@ namespace ADMIN // read the persistent state file if any string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "rt"); + FILE *fp = nlfopen(filename, "rt"); if (fp != NULL) { char buffer[1024]; @@ -567,7 +568,7 @@ namespace ADMIN if (now > _LastNagiosReport+_NagiosReportDelay) { // write the nagios report - FILE *fp = fopen("aes_nagios_report.txt", "wt"); + FILE *fp = nlfopen("aes_nagios_report.txt", "wt"); if (fp != NULL) { // output the current date @@ -632,7 +633,7 @@ namespace ADMIN { /// The persistent service orders need to be saved string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "wt"); + FILE *fp = nlfopen(filename, "wt"); if (fp != NULL) { { @@ -801,7 +802,7 @@ namespace ADMIN std::string getOfflineServiceState(const std::string& serviceAlias) { // open the file for reading - FILE* f= fopen(getServiceStateFileName(serviceAlias).c_str(),"rt"); + FILE* f= nlfopen(getServiceStateFileName(serviceAlias), "rt"); if (f==NULL) return "STOPPED"; // setup a buffer to hold the text read from the file @@ -825,7 +826,7 @@ namespace ADMIN uint32 getOfflineServicePID(const std::string& serviceAlias) { // open the file for reading - FILE* f= fopen(getServicePIDFileName(serviceAlias).c_str(),"rt"); + FILE* f = nlfopen(getServicePIDFileName(serviceAlias), "rt"); if (f==NULL) return 0; // setup a buffer to hold the text read from the file @@ -853,7 +854,7 @@ namespace ADMIN uint32 getServiceStartLoopCounter(const std::string& serviceAlias) { // open the file for reading - FILE* f= fopen(getServiceLoopCounterFileName(serviceAlias).c_str(),"rt"); + FILE* f= nlfopen(getServiceLoopCounterFileName(serviceAlias), "rt"); if (f==NULL) return 0; @@ -936,7 +937,7 @@ namespace ADMIN NLMISC::CFile::createDirectoryTree(path); // open the file for writing - FILE* f= fopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt"); + FILE* f = nlfopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt"); if (f==NULL) return false; // write the text to the file diff --git a/code/ryzom/server/src/admin_modules/as_module.cpp b/code/ryzom/server/src/admin_modules/as_module.cpp index 9717da358..da4b85485 100644 --- a/code/ryzom/server/src/admin_modules/as_module.cpp +++ b/code/ryzom/server/src/admin_modules/as_module.cpp @@ -18,6 +18,7 @@ #include "nel/misc/types_nl.h" #include #include "nel/misc/file.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/misc/mutable_container.h" #include "nel/net/service.h" @@ -195,7 +196,7 @@ namespace ADMIN // read the persistent state file if any string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "rt"); + FILE *fp = nlfopen(filename, "rt"); if (fp != NULL) { char buffer[1024]; @@ -232,7 +233,7 @@ namespace ADMIN if (_NeedToWriteStateFile) { string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; - FILE *fp = fopen(filename.c_str(), "wt"); + FILE *fp = nlfopen(filename, "wt"); if (fp != NULL) { CSString line; diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index 48dd8c189..b99009bed 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -18,6 +18,7 @@ #include "nel/misc/command.h" #include "nel/misc/variable.h" +#include "nel/misc/common.h" #include "nel/misc/aabbox.h" #include "nel/misc/vector.h" #include "nel/misc/vectord.h" @@ -1979,7 +1980,7 @@ public: CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SPalette imagePalette; - FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); + FILE *outf = nlfopen(OutputPath+name+".bmp", "wb"); if (outf == NULL) return; @@ -2095,8 +2096,8 @@ public: CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SPalette imagePalette; - FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); - FILE *outfh = fopen((OutputPath+name+"_hm.bmp").c_str(),"wb"); + FILE *outf = nlfopen(OutputPath+name+".bmp", "wb"); + FILE *outfh = nlfopen(OutputPath+name+"_hm.bmp", "wb"); if (outf == NULL) return; diff --git a/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp b/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp index d7b25129d..7a94283c0 100644 --- a/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp +++ b/code/ryzom/server/src/ai_service/ai_script_data_manager.cpp @@ -183,7 +183,7 @@ std::string CAIScriptDataManager::dirname() // string fullfilename = dirname() + "/" + name + ".ai_script_data"; // if (!CFile::fileExists(fullfilename) || CFile::getFileSize(fullfilename)==0) // { -// FILE* fp = fopen(fullfilename.c_str(), "w"); +// FILE* fp = nlfopen(fullfilename, "w"); // if (fp) // { // fprintf(fp, "// This file contains data for the AI script\n"); diff --git a/code/ryzom/server/src/entities_game_service/deposit.cpp b/code/ryzom/server/src/entities_game_service/deposit.cpp index d4cd560ad..37b8a03a7 100644 --- a/code/ryzom/server/src/entities_game_service/deposit.cpp +++ b/code/ryzom/server/src/entities_game_service/deposit.cpp @@ -25,6 +25,7 @@ #include "entities_game_service.h" #include "egs_globals.h" #include "nel/misc/noise_value.h" +#include "nel/misc/common.h" #include "nel/misc/variable.h" #include "nel/misc/words_dictionary.h" #include "game_share/time_weather_season/time_date_season_manager.h" @@ -587,7 +588,7 @@ void CDeposit::selectRMsByFilters( std::vector& exactRMCodesS, cons if ( ! depositReportCreated ) { depositReportCreated = true; - depositReportFile = fopen( "deposit_contents.csv", "wt" ); // fclose() auto? + depositReportFile = nlfopen( "deposit_contents.csv", "wt" ); // fclose() auto? if ( depositReportFile ) { fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" ); diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp index 80518f463..390916885 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp @@ -2564,8 +2564,7 @@ void CGameItem::dumpGameItemStats( const string& fileName ) { if( !fileName.empty() ) { - FILE * f; - f = fopen(fileName.c_str(),"w"); + FILE *f = nlfopen(fileName, "w"); if(f) { diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp index 72e9b2c8c..17d4d7d55 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp @@ -791,7 +791,7 @@ void CGameItemManager::destroyItem( CGameItemPtr &ptr ) //void CGameItemManager::dumpGameItemList( const string& fileName ) //{ // FILE * f; -// f = fopen(fileName.c_str(),"w"); +// f = nlfopen(fileName, "w"); // // if(f) // { diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.cpp b/code/ryzom/server/src/entities_game_service/harvest_source.cpp index dcae55a60..3da4285b5 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.cpp +++ b/code/ryzom/server/src/entities_game_service/harvest_source.cpp @@ -1240,8 +1240,8 @@ bool forageTestDoExtract( } // Request and output results - FILE *f = fopen( std::string(getLogDirectory() + "forage_test.csv").c_str(), "at" ); - FILE *f2 = fopen( std::string(getLogDirectory() + "forage_test.log").c_str(), "at" ); + FILE *f = nlfopen(getLogDirectory() + "forage_test.csv", "at" ); + FILE *f2 = nlfopen(getLogDirectory() + "forage_test.log", "at" ); float reqS = 1.0f / (reqPeriod * 10.0f); float req [CHarvestSource::NbPosRTProps]; float abs [CHarvestSource::NbPosRTProps]; diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp index f2fc03eb0..b45a6043d 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp @@ -1884,13 +1884,13 @@ void CDepositMapsBatchTask::run() if ( ! CFile::isExists( pathName ) ) CFile::createDirectory( pathName ); pathName += "/"; - FILE *outputF = fopen( (pathName + "deposit_maps.html").c_str(), "w" ); + FILE *outputF = nlfopen(pathName + "deposit_maps.html", "w"); if ( ! outputF ) { nlwarning( "Can't create file %sdeposit_maps.html", pathName.c_str() ); return; } - FILE *inputF = fopen( _InputFilename.c_str(), "r" ); + FILE *inputF = nlfopen(_InputFilename, "r"); if ( ! inputF ) { fprintf( outputF, "File %s not found", _InputFilename.c_str() ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp b/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp index 2d16c7177..fce468fb4 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp @@ -192,7 +192,7 @@ void CCDBSynchronised::write( const string& fileName ) if ( _DataStructRoot ) { TWriteCallbackArg wca; - wca.F = fopen( fileName.c_str(),"w" ); + wca.F = nlfopen(fileName, "w"); wca.Container = &_DataContainer; ICDBStructNode::CTextId id; _DataStructRoot->foreachLeafCall( cbWrite, id, &wca ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp index fa5e216ae..628a26e9f 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp @@ -102,11 +102,11 @@ void CPlayer::checkCrashMarker() if (!CFile::isExists(LastLoadFileName)) { // create the file if needed - nlverify(LastLoad = fopen(LastLoadFileName, "wb")); + nlverify(LastLoad = nlfopen(LastLoadFileName, "wb")); fclose(LastLoad); } - nlverify(LastLoad = fopen(LastLoadFileName, "r+b")); + nlverify(LastLoad = nlfopen(LastLoadFileName, "r+b")); // check uint32 lastBad[2]; diff --git a/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp b/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp index bbe2217c0..bfc33c1d6 100644 --- a/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp +++ b/code/ryzom/server/src/general_utilities_service/cl_contest_logger.cpp @@ -118,7 +118,7 @@ void CSession::log(const NLMISC::CSString& lang,const NLMISC::CSString& txt) nlassert(!fileName.empty()); nlinfo("Opening new log file: %s",fileName.c_str()); - _Files[lang]= fopen(fileName.c_str(),"wb"); + _Files[lang]= nlfopen(fileName, "wb"); DROP_IF(_Files[lang]==NULL,"Failed to open log file for writing: "+fileName,return); } fprintf(_Files[lang],"%s\n",txt.c_str()); diff --git a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp index ee7669e19..b6423e37a 100644 --- a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp +++ b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp @@ -391,7 +391,7 @@ void CRepositoryReceiver::beginFile(NLNET::IModuleProxy *sender, const std::stri _CurrentFileExpected= fileSize; // open the temp file - _CurrentFileHandle= fopen(rrTempFileName(_TargetDirectory,_EmitterName).c_str(),"wb"); + _CurrentFileHandle= nlfopen(rrTempFileName(_TargetDirectory,_EmitterName), "wb"); BOMB_IF(_CurrentFileHandle==NULL,"Failed to open temporary file for writing: "+rrTempFileName(_TargetDirectory,_EmitterName),return); } diff --git a/code/ryzom/server/src/log_analyser_service/commands.cpp b/code/ryzom/server/src/log_analyser_service/commands.cpp index 1b70ae4e2..90bfcf09c 100644 --- a/code/ryzom/server/src/log_analyser_service/commands.cpp +++ b/code/ryzom/server/src/log_analyser_service/commands.cpp @@ -88,7 +88,7 @@ public: NLMISC::CFile::deleteFile(_TmpFileName); DROP_IF(NLMISC::CFile::fileExists(_TmpFileName),"Failed to delete file: "+_TmpFileName,return); - _File= fopen(_TmpFileName.c_str(),"wb"); + _File = nlfopen(_TmpFileName,"wb"); } ~CSimpleFileDisplayer() diff --git a/code/ryzom/server/src/logger_service/logger_service.cpp b/code/ryzom/server/src/logger_service/logger_service.cpp index cb51c6a6d..d5d0775fc 100644 --- a/code/ryzom/server/src/logger_service/logger_service.cpp +++ b/code/ryzom/server/src/logger_service/logger_service.cpp @@ -19,6 +19,7 @@ #include #include "nel/misc/time_nl.h" #include "nel/misc/thread.h" +#include "nel/misc/common.h" #include "nel/misc/random.h" #include "nel/misc/singleton.h" #include "nel/net/service.h" @@ -926,7 +927,7 @@ public: // prepare the output file string outputFile = queryOptions.OutputPrefix+LogQueryResultFile.get(); - FILE *fp = fopen(outputFile.c_str(), "wt");; + FILE *fp = nlfopen(outputFile, "wt");; if (fp == NULL) { _QueryStatus.write(TThreadStatus(qs_push_state, "ErrorWritingQueryResult")); diff --git a/code/ryzom/server/src/patchman_service/file_manager.cpp b/code/ryzom/server/src/patchman_service/file_manager.cpp index ca3582bc6..52a41a080 100644 --- a/code/ryzom/server/src/patchman_service/file_manager.cpp +++ b/code/ryzom/server/src/patchman_service/file_manager.cpp @@ -21,6 +21,7 @@ // nel #include "nel/misc/variable.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" // game share #include "game_share/utils.h" @@ -599,7 +600,7 @@ namespace PATCHMAN // nldebug("- Reading file data @offset: %d (%d bytes)",newFileEntry.StartOffset,fileSize); // read in the file - FILE* inf= fopen(fileName.c_str(),"rb"); + FILE* inf = nlfopen(fileName, "rb"); BOMB_IF(inf==NULL,"Failed to open input file for reading: "+fileName,return false); uint32 bytesRead=(uint32)fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf); fclose(inf); diff --git a/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp b/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp index 9bc2db322..3d413b0cf 100644 --- a/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp +++ b/code/ryzom/server/src/patchman_service/rr_repository_reciever.cpp @@ -409,7 +409,7 @@ void CRepositoryReceiver::fileList(NLNET::IModuleProxy *sender, uint32 version, // _CurrentFileExpected= fileSize; // // // open the temp file -// _CurrentFileHandle= fopen(rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName).c_str(),"wb"); +// _CurrentFileHandle= nlfopen(rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName), "wb"); // BOMB_IF(_CurrentFileHandle==NULL,"Failed to open temporary file for writing: "+rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName),return); // } // diff --git a/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp b/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp index 2cce1354e..9dc112c3c 100644 --- a/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp +++ b/code/ryzom/server/src/patchman_service/spt_server_patch_terminal.cpp @@ -20,6 +20,7 @@ // nel #include "nel/misc/variable.h" +#include "nel/misc/common.h" #include "nel/net/service.h" #include "nel/net/module.h" #include "nel/net/module_builder_parts.h" @@ -775,7 +776,7 @@ NLMISC_CLASS_COMMAND_IMPL(CServerPatchTerminal, depDevCfg) CSString cfgFileName= appDesc.CmdLine.firstWord()+".cfg"; string fileName = configDirectory+cfgFileName; - FILE *fp = fopen(fileName.c_str(), "wt"); + FILE *fp = nlfopen(fileName, "wt"); nlassert(fp != NULL); fwrite(appDesc.CfgFile.data(), appDesc.CfgFile.size(), 1, fp); fclose(fp); @@ -808,7 +809,7 @@ NLMISC_CLASS_COMMAND_IMPL(CServerPatchTerminal, depDevCfg) batch << "start " << cmdLine; fileName = DevConfigDirectory.get()+"/start_"+appDesc.ShardName+"_"+appDesc.StartOrder+"_"+appDesc.AppName+".bat"; - fp = fopen(fileName.c_str(), "wt"); + fp = nlfopen(fileName, "wt"); nlassert(fp != NULL); fwrite(batch.data(), batch.size(), 1, fp); fclose(fp); diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.h b/code/ryzom/server/src/pd_lib/pd_server_utils.h index ac67e8a7a..2e7c06363 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.h @@ -22,6 +22,7 @@ */ #include #include +#include #include #include @@ -282,7 +283,7 @@ public: if (_File != NULL) return false; - _File = fopen(filename, mode); + _File = nlfopen(filename, mode); if (_File == NULL) return false; diff --git a/code/ryzom/server/src/pd_support_service/daily_commands.cpp b/code/ryzom/server/src/pd_support_service/daily_commands.cpp index e3f6d718c..c96310932 100644 --- a/code/ryzom/server/src/pd_support_service/daily_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/daily_commands.cpp @@ -19,6 +19,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/file.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/net/service.h" #include "game_share/utils.h" @@ -101,7 +102,7 @@ public: ptm = gmtime(&endTime); // write to the log file - FILE* fileHandle= fopen(DailyActivityLogFileName,"ab"); + FILE* fileHandle= nlfopen(DailyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CDailyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); diff --git a/code/ryzom/server/src/pd_support_service/hourly_commands.cpp b/code/ryzom/server/src/pd_support_service/hourly_commands.cpp index 6f77396ae..cad7c25ee 100644 --- a/code/ryzom/server/src/pd_support_service/hourly_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/hourly_commands.cpp @@ -19,6 +19,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/file.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/misc/sstring.h" #include "nel/net/service.h" #include "game_share/utils.h" @@ -101,7 +102,7 @@ public: ptm = gmtime(&endTime); // write to the log file - FILE* fileHandle= fopen(HourlyActivityLogFileName,"ab"); + FILE* fileHandle= nlfopen(HourlyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CHourlyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); diff --git a/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp b/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp index b81886a47..996c838e2 100644 --- a/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp +++ b/code/ryzom/server/src/testing_tool_service/testing_tool_service.cpp @@ -31,6 +31,7 @@ // Nel #include "nel/misc/sheet_id.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/georges/u_form_elm.h" #include "nel/georges/u_form.h" #include "nel/georges/u_form_loader.h" @@ -270,7 +271,7 @@ void CTestingTool::startTestSession( const std::string& sheet ) //---------------------------------------------------------------- void CTestingTool::testSessionProceed() { - _TestSessionReport = fopen( "testSessionReport.txt", "w+t" ); + _TestSessionReport = nlfopen( "testSessionReport.txt", "w+t" ); fputs( "=====================================================================\n", _TestSessionReport ); fputs( "===================== NEW TEST SESSION STARTED ======================\n", _TestSessionReport ); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp index dbd917b0f..d9097d4cf 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp @@ -23,6 +23,7 @@ #include "CompilDialog.h" #include "nel/misc/path.h" +#include "nel/misc/common.h" #include "nel/ligo/primitive.h" #include "../mission_compiler_lib/mission_compiler.h" #include "nel/misc/config_file.h" @@ -201,7 +202,7 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() if (NLMISC::CFile::fileExists(tmpPath)) { - FILE *f = fopen(tmpPath, "r"); + FILE *f = nlfopen(tmpPath, "r"); if (f == NULL) { nlinfo("Can't open the file for reading !\n%s", tmpPath); @@ -762,7 +763,7 @@ void CValidationFile::saveMissionValidationFile(string filename) nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str()); return; } - FILE* file = fopen(pathName.c_str(), "w"); + FILE* file = nlfopen(pathName, "w"); nlassert(file!=NULL); // AuthorizedStates diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index fd119e0df..09d9fc723 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -17,6 +17,7 @@ #include "mission_compiler.h" #include "step.h" #include "nel/misc/i18n.h" +#include "nel/misc/common.h" #include "nel/ligo/primitive_utils.h" using namespace std; @@ -876,7 +877,7 @@ bool CMissionCompiler::publishFiles(const std::string &serverPathPrim, const std bool CMissionCompiler::includeText(const std::string filename, const std::string text) { - FILE *f = fopen(filename.c_str(), "r+"); + FILE *f = nlfopen(filename, "r+"); if (f == NULL) return false; diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index 935ba31d6..1766a3b3b 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -17,6 +17,7 @@ #include "moulinette.h" #include "utils.h" #include "nel/misc/algo.h" +#include "nel/misc/common.h" TRMItem currentDocItem; CRMData SortableData; @@ -1279,7 +1280,7 @@ void ItemNamesSave() CSString data, output; FILE* file; - file = fopen( ITEM_WORDS_WK.c_str(), "rb" ); + file = nlfopen( ITEM_WORDS_WK, "rb" ); char c; fread( &c, 1, 1, file ); diff --git a/code/ryzom/tools/leveldesign/mp_generator/utils.h b/code/ryzom/tools/leveldesign/mp_generator/utils.h index efa42149d..af9f7096a 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/utils.h +++ b/code/ryzom/tools/leveldesign/mp_generator/utils.h @@ -19,6 +19,8 @@ #include +#include "nel/misc/common.h" + // DtName must be the 1st one enum TDataCol { DtName, DtTitle, DtRMFamily, DtGroup, DtEcosystem, DtLevelZone, DtStatQuality, DtProp, DtCreature, DtCreaTitle, DtCraftSlotName, DtCraftCivSpec, DtColor, DtAverageEnergy, DtMaxLevel, DtCustomizedProperties, DtNbCols }; const char *DataColStr [DtNbCols] = { "Code", "Name", "Family", "Group", "Ecosystem", "LevelZone", "Stat Quality", "Properties", "Creature sheets", "Creatures", "Item parts", "Craft civ spec", "Color", "Average energy", "Max level", "Customized" }; @@ -276,7 +278,7 @@ public: if ( ! _Enabled ) return; - _File = fopen( filename.c_str(), "wt" ); + _File = nlfopen( filename, "wt" ); if(!_File) { throw Exception("Could not open html: %s", filename.c_str()); diff --git a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp index 6ab9e2a26..f2fa783dc 100644 --- a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp +++ b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp @@ -57,7 +57,7 @@ vector items; // check the items file (locSlot and item number coherence) int verifItemsFile (const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -89,7 +89,7 @@ int verifItemsFile (const char *filename) // check csv file (locSlot and item number coherence) int verifCsvFile (const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -165,7 +165,7 @@ int getItemsFromFile(const char *filename) // fill 'fields' structure with values from file int getFieldsFromFile(const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -190,7 +190,7 @@ int getFieldsFromFile(const char *filename) // parse the file to count the number of items int getNbItemFromFile(const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -214,7 +214,7 @@ int exportCsv(const char *filename) nlassert(fields.size() != 0); uint i, j; - FILE *f = fopen(filename, "w"); + FILE *f = nlfopen(filename, "w"); if (f == NULL) nlerror("Can't open file : %s", filename); @@ -241,7 +241,7 @@ int importCsv(const char *filename) verifCsvFile(filename); char buffer[1024]; - FILE *f = fopen(filename, "r"); + FILE *f = nlfopen(filename, "r"); if (f == NULL) nlerror("Can't open file : %s", filename); diff --git a/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp b/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp index 08c1b255f..b3737b6a9 100644 --- a/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp +++ b/code/ryzom/tools/leveldesign/primitive_id_assignator/primitive_id_assignator.cpp @@ -19,6 +19,7 @@ #include "nel/misc/config_file.h" #include "nel/misc/path.h" #include "nel/misc/file.h" +#include "nel/misc/common.h" using namespace std; @@ -57,7 +58,7 @@ int main(int argc, char *argv[]) { // build a default config file string fileName = vif.asString(); - FILE *fp = fopen(fileName.c_str(), "wt"); + FILE *fp = nlfopen(fileName.c_str(), "wt"); if (fp == NULL) { nlwarning("Can't open file '%s' for writing", diff --git a/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp b/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp index 1bbe82dcc..fa593d67d 100644 --- a/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp +++ b/code/ryzom/tools/leveldesign/uni_conv/uni_conv.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -121,7 +122,7 @@ int main(int argc, char *argv[]) case ASCII: { string s = str.toString(); - FILE *fp = fopen(outputFile.c_str(), "wt"); + FILE *fp = nlfopen(outputFile, "wt"); fwrite(s.data(), s.size(), 1, fp); fclose(fp); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp index a70813f47..17fd397da 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp @@ -46,6 +46,7 @@ #include "editor_primitive.h" #include "file_dialog_ex.h" #include "nel/misc/mem_stream.h" +#include "nel/misc/common.h" #include @@ -4334,7 +4335,7 @@ void CMainFrame::OnMissionCompiler() GetEnvironmentVariable("TMP", tmpPath, MAX_PATH); strcat(tmpPath, "\\tmptool.txt"); - FILE *f = fopen(tmpPath, "w"); + FILE *f = nlfopen(tmpPath, "w"); if (f==NULL) infoMessage("Can't open file for writing !\n%s", tmpPath); diff --git a/code/ryzom/tools/occ2huff/occ2huff.cpp b/code/ryzom/tools/occ2huff/occ2huff.cpp index 500e76735..55b3f20b1 100644 --- a/code/ryzom/tools/occ2huff/occ2huff.cpp +++ b/code/ryzom/tools/occ2huff/occ2huff.cpp @@ -257,7 +257,7 @@ sint main( sint argc, char ** argv ) // TEST /*printf("Writing debug text file...\n"); - FILE * outputTest = fopen("chat_static_base_test.log","wt"); + FILE * outputTest = nlfopen("chat_static_base_test.log","wt"); for( itBase = base.begin(); itBase != base.end(); ++itBase ) { fprintf(outputTest,"id: %s str: %s occ: %d\n",(*itBase).second.Id.c_str(),(*itBase).second.Str.c_str(), (*itBase).second.Occurence ); diff --git a/code/ryzom/tools/pd_parser/templatizer.h b/code/ryzom/tools/pd_parser/templatizer.h index 308fdeb2e..5087e033a 100644 --- a/code/ryzom/tools/pd_parser/templatizer.h +++ b/code/ryzom/tools/pd_parser/templatizer.h @@ -1009,7 +1009,7 @@ public: std::string result = ITemplatizerBloc::eval(env); FILE* f; - f = fopen(filename.c_str(), (clearfile == "true" ? "w" : "a")); + f = nlfopen(filename, (clearfile == "true" ? "w" : "a")); if (f != NULL) { fwrite(result.c_str(), 1, result.size(), f); diff --git a/code/ryzom/tools/phrase_generator/phrase_generator.cpp b/code/ryzom/tools/phrase_generator/phrase_generator.cpp index 6fa71e9ae..de02680ca 100644 --- a/code/ryzom/tools/phrase_generator/phrase_generator.cpp +++ b/code/ryzom/tools/phrase_generator/phrase_generator.cpp @@ -33,6 +33,7 @@ #include "nel/misc/file.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include #include @@ -275,7 +276,7 @@ void loadCSVFile( const char *filename, TDeliveryCallback deliveryCallback ) vector args; vector::iterator iarg; - if ( (file = fopen( filename, "r" )) == NULL ) + if ( (file = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1282,7 +1283,7 @@ void usage(char *argv0, FILE *out) //----------------------------------------------- void makeIndexFile() { - FILE * indexFile = fopen( ("_" + DocFileNameRoot + "_INDEX.html").c_str(), "wt" ); + FILE * indexFile = nlfopen( "_" + DocFileNameRoot + "_INDEX.html", "wt" ); if( indexFile ) { fprintf( indexFile, ("\n\nSummary of " + DocFileNameRoot + "\n\n").c_str() ); @@ -1295,7 +1296,7 @@ void makeIndexFile() for ( uint l=0; l!=26; ++l ) { string filename = toString( "%s_%c.html", DocFileName.c_str(), 'a'+l ); - PhraseDocFiles[l] = fopen( filename.c_str(), "wt" ); + PhraseDocFiles[l] = nlfopen( filename, "wt" ); fprintf( PhraseDocFiles[l], ("\n\n" + DocFileName + toString( " - %c", (char)('A'+l) ) + "\n\n").c_str() ); fprintf( indexFile, ("" + (char)('A'+l) + " ").c_str() ); } @@ -1304,7 +1305,7 @@ void makeIndexFile() { // One single HTML file fprintf( indexFile, ("Go to action details").c_str() ); - PhraseDocFiles[0] = fopen( (DocFileName + ".html").c_str(), "wt" ); + PhraseDocFiles[0] = nlfopen( DocFileName + ".html", "wt" ); fprintf( PhraseDocFiles[0], ("\n\n" + DocFileName + "\n\n").c_str() ); for ( uint l=1; l!=26; ++l ) { @@ -1393,7 +1394,7 @@ void makeIndexFile() void makeActionsBySkillGroupFile() { // progression by skill - FILE * actionsBySkillGroupFile = fopen( (DocFileName + "__by_skill.html").c_str(), "wt" ); + FILE * actionsBySkillGroupFile = nlfopen( DocFileName + "__by_skill.html", "wt" ); if( actionsBySkillGroupFile ) { fprintf( actionsBySkillGroupFile, ("\n\nProgression of " + DocFileName + "\n\n").c_str() ); @@ -1489,7 +1490,7 @@ void makeActionsBySkillValueFile() //----------------------------------------------- void makeActionsBySkillValueDetailFile() { - FILE * actionsBySkillValueDetailFile = fopen( (DocFileName + "__by_skill_value_detail.html").c_str(), "wt" ); + FILE * actionsBySkillValueDetailFile = nlfopen( DocFileName + "__by_skill_value_detail.html", "wt" ); if( actionsBySkillValueDetailFile ) { fprintf( actionsBySkillValueDetailFile, ("\n\nProgression of " + DocFileName + "\n\n").c_str() ); @@ -1627,9 +1628,9 @@ void makeSkillTreeFile( char filter, string skillFamily, bool withTraduction ) string filenameWithTraduction = skillFamily + "_skill_tree_detailed.html"; FILE * skillTreeFile; if( withTraduction ) - skillTreeFile = fopen( filenameWithTraduction.c_str(), "wt" ); + skillTreeFile = nlfopen( filenameWithTraduction, "wt" ); else - skillTreeFile = fopen( filename.c_str(), "wt" ); + skillTreeFile = nlfopen( filename, "wt" ); fprintf( skillTreeFile,"\n"); fprintf( skillTreeFile,"\n"); fprintf( skillTreeFile,"SKILL TREE ( %s )\n",skillFamily.c_str()); @@ -1980,7 +1981,7 @@ int main(int argc, char* argv[]) // write header and title bar string filename; filename = DocFileNameRoot + "_m.html"; - FILE * brickPhraseDocFile_m = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_m = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_m,"\n"); fprintf( brickPhraseDocFile_m,"\n"); fprintf( brickPhraseDocFile_m,"Brick phrases\n"); @@ -1988,7 +1989,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_m,"\n"); filename = DocFileNameRoot + "_c.html"; - FILE * brickPhraseDocFile_c = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_c = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_c,"\n"); fprintf( brickPhraseDocFile_c,"\n"); fprintf( brickPhraseDocFile_c,"Brick phrases\n"); @@ -1996,7 +1997,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_c,"
\n"); filename = DocFileNameRoot + "_o.html"; - FILE * brickPhraseDocFile_o = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_o = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_o,"\n"); fprintf( brickPhraseDocFile_o,"\n"); fprintf( brickPhraseDocFile_o,"Brick phrases\n"); @@ -2004,7 +2005,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_o,"
\n"); filename = DocFileNameRoot + "_p.html"; - FILE * brickPhraseDocFile_p = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_p = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_p,"\n"); fprintf( brickPhraseDocFile_p,"\n"); fprintf( brickPhraseDocFile_p,"Brick phrases\n"); @@ -2012,7 +2013,7 @@ int main(int argc, char* argv[]) fprintf( brickPhraseDocFile_p,"
\n"); filename = DocFileNameRoot + "_e.html"; - FILE * brickPhraseDocFile_e = fopen( filename.c_str(), "wt" ); + FILE * brickPhraseDocFile_e = nlfopen( filename, "wt" ); fprintf( brickPhraseDocFile_e,"\n"); fprintf( brickPhraseDocFile_e,"\n"); fprintf( brickPhraseDocFile_e,"Brick phrases\n"); @@ -2082,7 +2083,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + ".html"; - FILE * brickDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickDocFile = nlfopen( filename, "wt" ); fprintf( brickDocFile,"\n"); fprintf( brickDocFile,"\n"); fprintf( brickDocFile,"Bricks infos\n"); @@ -2197,7 +2198,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_name.html"; - FILE * brickNameDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickNameDocFile = nlfopen( filename, "wt" ); fprintf( brickNameDocFile,"\n"); fprintf( brickNameDocFile,"\n"); fprintf( brickNameDocFile,"Bricks infos\n"); @@ -2332,7 +2333,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_family.html"; - FILE * brickFamilyDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickFamilyDocFile = nlfopen( filename, "wt" ); fprintf( brickFamilyDocFile,"\n"); fprintf( brickFamilyDocFile,"\n"); fprintf( brickFamilyDocFile,"Bricks infos\n"); @@ -2464,7 +2465,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_required_skill_value.html"; - FILE * brickRequiredDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickRequiredDocFile = nlfopen( filename, "wt" ); fprintf( brickRequiredDocFile,"\n"); fprintf( brickRequiredDocFile,"\n"); fprintf( brickRequiredDocFile,"Bricks infos\n"); @@ -2607,7 +2608,7 @@ int main(int argc, char* argv[]) // write header and title bar filename = DocFileNameRoot + "_learn_skill_value.html"; - FILE * brickLearnDocFile = fopen( filename.c_str(), "wt" ); + FILE * brickLearnDocFile = nlfopen( filename, "wt" ); fprintf( brickLearnDocFile,"\n"); fprintf( brickLearnDocFile,"\n"); fprintf( brickLearnDocFile,"Bricks infos\n"); diff --git a/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp b/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp index 68a6bff3f..eafda628c 100644 --- a/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp +++ b/code/ryzom/tools/sheet_random_generator/sheet_random_generator.cpp @@ -20,6 +20,7 @@ #include "srg_utilities.h" #include "game_share/protection_type.h" #include "nel/misc/string_conversion.h" +#include "nel/misc/common.h" /* * V3 @@ -2449,8 +2450,8 @@ void generateRawMaterials() MainStat.init(); FILE *nameOutputFile; if ( OutputNameList ) - nameOutputFile = fopen( "rm_names_output.csv", "wt" ); - GraphFile = fopen( "rm_output_graph.csv", "wt" ); + nameOutputFile = nlfopen( "rm_names_output.csv", "wt" ); + GraphFile = nlfopen( "rm_output_graph.csv", "wt" ); fprintf( GraphFile, "Graph type: Line with markers displayed at each data value, columns B to E. For deposits, sort by column B\n" ); fprintf( GraphFile, "Ecosystem specialization: 100=Desert, 104=Forest, 108=Lake, 112=Jungle, 116=All\n" ); fprintf( GraphFile, "RM code;Zone;Energy;Originality;Eco. spec.;\n\n" ); diff --git a/code/ryzom/tools/sheet_random_generator/srg_utilities.h b/code/ryzom/tools/sheet_random_generator/srg_utilities.h index c4abce34b..686b22418 100644 --- a/code/ryzom/tools/sheet_random_generator/srg_utilities.h +++ b/code/ryzom/tools/sheet_random_generator/srg_utilities.h @@ -27,6 +27,7 @@ #include "nel/misc/file.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/command.h" +#include "nel/misc/common.h" #include "nel/misc/path.h" #include #include @@ -862,7 +863,7 @@ void loadNomenclatureCodes( const char *title, const vector& longNames, vector::iterator iarg; vector::const_iterator ivs; - if ( (rulesFile = fopen( filename, "r" )) == NULL ) + if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1121,7 +1122,7 @@ void loadCSVFile( const char *filename, TMapDeliveryCallback deliveryCallback, b vector args; vector::iterator iarg; - if ( (file = fopen( filename, "r" )) == NULL ) + if ( (file = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1178,7 +1179,7 @@ void loadCSVFile( const char *filename, TVectorDeliveryCallback deliveryCallback vs args; vs::iterator iarg; - if ( (file = fopen( filename, "r" )) == NULL ) + if ( (file = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1217,7 +1218,7 @@ void loadValueFile( const char *filename, const vector& keyStrings, vector args; vector::iterator iarg; - if ( (rulesFile = fopen( filename, "r" )) == NULL ) + if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1271,7 +1272,7 @@ void loadRulesFile( const char *filename, const vector& keyStrings, vector args; vector::iterator iarg; - if ( (rulesFile = fopen( filename, "r" )) == NULL ) + if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1582,7 +1583,7 @@ void loadTitles( const string& sourceWords, const string& sourceBase, const stri void extractRawMaterialNames() { loadCSVFile( ExtractNamesCsv.c_str(), readRMNames ); - FILE *output = fopen( (CFile::getFilenameWithoutExtension( ExtractNamesCsv ) + "_output.csv").c_str(), "wt" ); + FILE *output = nlfopen( CFile::getFilenameWithoutExtension( ExtractNamesCsv ) + "_output.csv", "wt" ); fprintf( output, "Code;Name\n" ); for ( mss::const_iterator iun=UniqueRMNamesAndSheetCodeHead.begin(); iun!=UniqueRMNamesAndSheetCodeHead.end(); ++iun ) { @@ -2343,7 +2344,7 @@ public: if ( ! _Enabled ) return; - _File = fopen( filename.c_str(), "wt" ); + _File = nlfopen( filename, "wt" ); fprintf( _File, ("\n\n" + title + "\n\n").c_str() ); } @@ -2408,7 +2409,7 @@ public: if ( ! _Enabled ) return; - _File = fopen( filename.c_str(), "wt" ); + _File = nlfopen( filename, "wt" ); } /// diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 9198196c7..000da9551 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -71,6 +71,7 @@ #include "nel/misc/app_context.h" #include "nel/misc/i18n.h" +#include "nel/misc/common.h" #include "nel/misc/file.h" #include "nel/misc/path.h" #include "nel/misc/diff_tool.h" @@ -325,7 +326,7 @@ int readLanguages() else { // append to the existing file - FILE *fp = fopen(filename.c_str(), "ab"); + FILE *fp = nlfopen(filename, "ab"); for (uint i=0; i\n"); @@ -224,7 +225,7 @@ int main(int argc, char *argv[]) printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " \n", CFile::getFilename(subFileName).c_str()); - FILE *subFp = fopen(subFileName.c_str(), "rt"); + FILE *subFp = nlfopen(subFileName, "rt"); nlassert(subFp != NULL); char buffer[MaxLineSize]; char *result; @@ -262,8 +263,8 @@ int main(int argc, char *argv[]) { printf("Unpacking directory '%s'...\n", dirName.c_str()); // open the pack file -// FILE *fp = fopen((dirName+"/tmp."+DefaultExt).c_str(), "rt"); - FILE *fp = fopen(filename.c_str(), "rt"); +// FILE *fp = nlfopen(dirName+"/tmp."+DefaultExt, "rt"); + FILE *fp = nlfopen(filename, "rt"); nlassert(fp != NULL); uint linecount = 0; @@ -303,7 +304,7 @@ int main(int argc, char *argv[]) printf("Extracting file '%s'...\n", CFile::getFilename(subFileName).c_str()); // open the output file - FILE *output = fopen (subFileName.c_str(), "wt"); + FILE *output = nlfopen(subFileName, "wt"); if (output == NULL) { printf ("Error : can not open output file '%s' from pack file '%s'", subFileName.c_str(), filename.c_str()); diff --git a/code/studio/src/plugins/mission_compiler/validation_file.cpp b/code/studio/src/plugins/mission_compiler/validation_file.cpp index e5536f9a7..c284f50cd 100644 --- a/code/studio/src/plugins/mission_compiler/validation_file.cpp +++ b/code/studio/src/plugins/mission_compiler/validation_file.cpp @@ -1,6 +1,7 @@ #include "validation_file.h" #include +#include #include void CValidationFile::loadMissionValidationFile(std::string filename) @@ -53,7 +54,7 @@ void CValidationFile::saveMissionValidationFile(std::string filename) nlwarning("Can't find index file '%s' in search path, no mission will be valid", filename.c_str()); return; } - FILE* file = fopen(pathName.c_str(), "w"); + FILE* file = nlfopen(pathName, "w"); nlassert(file!=NULL); // AuthorizedStates diff --git a/code/tool/increment_version/increment_version.cpp b/code/tool/increment_version/increment_version.cpp index d24127a6c..45cb93ece 100644 --- a/code/tool/increment_version/increment_version.cpp +++ b/code/tool/increment_version/increment_version.cpp @@ -16,6 +16,7 @@ #include #include +#include #include @@ -51,7 +52,7 @@ sint main( sint argc, char ** argv ) // open the output file string outputFilename = string(argv[1]) + ".out"; - FILE * output = fopen(outputFilename.c_str(),"w"); + FILE * output = nlfopen(outputFilename,"w"); if( output == NULL ) { nlwarning("can't open the output file %s",outputFilename.c_str()); diff --git a/code/tool/path_content_diff/path_content_diff.cpp b/code/tool/path_content_diff/path_content_diff.cpp index c2df4b946..b40a4e75f 100644 --- a/code/tool/path_content_diff/path_content_diff.cpp +++ b/code/tool/path_content_diff/path_content_diff.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include #include #include #include @@ -65,7 +66,7 @@ int main( int argc, char ** argv ) CPath::getPathContent(newPath, true, false, true, newPathContent); string outputFileName = CFile::findNewFile("path_content_diff.txt"); - FILE *output = fopen (outputFileName.c_str(), "wt"); + FILE *output = nlfopen(outputFileName, "wt"); if( output == NULL ) { nlwarning("Can't open output file %s",outputFileName.c_str()); From dadfb51257cc272e977c38e71c7e564739cf28ef Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Mar 2016 19:27:00 +0100 Subject: [PATCH 27/48] Fixed: Use presets from client_default.cfg for client_config_qt --HG-- branch : develop --- .../display_settings_details_widget.cpp | 201 ++++++++++-------- .../display_settings_details_widget.h | 76 +++---- 2 files changed, 146 insertions(+), 131 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp index 1e1e19521..780e6a87c 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp @@ -38,29 +38,32 @@ void CDisplaySettingsDetailsWidget::load() { CSystem &s = CSystem::GetInstance(); - landscapeSlider->setValue( getQuality( qualityToLandscapeThreshold, s.config.getFloat( "LandscapeThreshold" ) ) ); - landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToZFar, s.config.getFloat( "Vision" ) ) ) ); - landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToLandscapeTileNear, s.config.getFloat( "LandscapeTileNear" ) ) ) ); - landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToMicrovegetDensity, s.config.getFloat( "MicroVegetDensity" ) ) ) ); + // landscape + landscapeSlider->setValue(getQualityPresetFloat("LandscapeTileNear")); + landscapeSlider->setValue(std::min(landscapeSlider->value(), getQualityPresetFloat("LandscapeThreshold"))); + landscapeSlider->setValue(std::min(landscapeSlider->value(), getQualityPresetFloat("Vision"))); + landscapeSlider->setValue(std::min(landscapeSlider->value(), getQualityPresetFloat("MicroVegetDensity"))); - charactersSlider->setValue( getQuality( qualityToSkinNbMaxPoly, s.config.getInt( "SkinNbMaxPoly" ) ) ); - charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToNbMaxSkeletonNotCLod, s.config.getInt( "NbMaxSkeletonNotCLod" ) ) ) ); - charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToCharacterFarClip, s.config.getFloat( "CharacterFarClip" ) ) ) ); + // FX + fxSlider->setValue(getQualityPresetInteger("FxNbMaxPoly")); - fxSlider->setValue( getQuality( qualityToFxNbMaxPoly, s.config.getInt( "FxNbMaxPoly" ) ) ); + // characters + charactersSlider->setValue(getQualityPresetInteger("SkinNbMaxPoly")); + charactersSlider->setValue(std::min(charactersSlider->value(), getQualityPresetInteger("NbMaxSkeletonNotCLod"))); + charactersSlider->setValue(std::min(charactersSlider->value(), getQualityPresetFloat("CharacterFarClip"))); - int hdTextureInstalled = s.config.getInt( "HDTextureInstalled" ); - if( hdTextureInstalled == 1 ) - texturesSlider->setMaximum( QUALITY_NORMAL ); + int hdTextureInstalled = s.config.getInt("HDTextureInstalled"); + if (hdTextureInstalled == 1) + texturesSlider->setMaximum(QUALITY_NORMAL); else - texturesSlider->setMaximum( QUALITY_MEDIUM ); + texturesSlider->setMaximum(QUALITY_MEDIUM); // Comment taken from the original config tool: // NB: if the player changes its client.cfg, mixing HDEntityTexture=1 and DivideTextureSizeBy2=1, it will // result to a low quality! - if( s.config.getInt( "DivideTextureSizeBy2" ) ) + if (s.config.getInt("DivideTextureSizeBy2")) texturesSlider->setValue( QUALITY_LOW ); - else if( s.config.getInt( "HDEntityTexture" ) && ( hdTextureInstalled == 1 ) ) + else if( s.config.getInt("HDEntityTexture") && ( hdTextureInstalled == 1 ) ) texturesSlider->setValue( QUALITY_NORMAL ); else texturesSlider->setValue( QUALITY_MEDIUM ); @@ -70,38 +73,30 @@ void CDisplaySettingsDetailsWidget::save() { CSystem &s = CSystem::GetInstance(); - s.config.setFloat( "Vision", qualityToZFar[ landscapeSlider->value() ] ); - s.config.setFloat( "LandscapeTileNear", qualityToLandscapeTileNear[ landscapeSlider->value() ] ); - s.config.setFloat( "LandscapeThreshold", qualityToLandscapeThreshold[ landscapeSlider->value() ] ); + // landscape + setFloatPreset("LandscapeTileNear", landscapeSlider->value()); + setFloatPreset("LandscapeThreshold", landscapeSlider->value()); + setFloatPreset("Vision", landscapeSlider->value()); + setIntegerPreset("MicroVeget", landscapeSlider->value()); + setFloatPreset("MicroVegetDensity", landscapeSlider->value()); - if( landscapeSlider->value() > QUALITY_LOW ) - s.config.setInt( "MicroVeget", 1 ); - else - s.config.setInt( "MicroVeget", 0 ); - - s.config.setFloat( "MicroVegetDensity", qualityToMicrovegetDensity[ landscapeSlider->value() ] ); - - - s.config.setInt( "SkinNbMaxPoly", qualityToSkinNbMaxPoly[ charactersSlider->value() ] ); - s.config.setInt( "NbMaxSkeletonNotCLod", qualityToNbMaxSkeletonNotCLod[ charactersSlider->value() ] ); - s.config.setFloat( "CharacterFarClip", qualityToCharacterFarClip[ charactersSlider->value() ] ); - - - s.config.setInt( "FxNbMaxPoly", qualityToFxNbMaxPoly[ fxSlider->value() ] ); - if( fxSlider->value() > QUALITY_LOW ) - { - s.config.setInt( "Shadows", 1 ); - s.config.setInt( "Bloom", 1 ); - s.config.setInt( "SquareBloom", 1 ); - } - else - { - s.config.setInt( "Shadows", 0 ); - s.config.setInt( "Bloom", 0 ); - s.config.setInt( "SquareBloom", 0 ); - } + // FX + setIntegerPreset("FxNbMaxPoly", fxSlider->value()); + setIntegerPreset("Cloud", fxSlider->value()); + setFloatPreset("CloudQuality", fxSlider->value()); + setIntegerPreset("CloudUpdate", fxSlider->value()); + setIntegerPreset("Shadows", fxSlider->value()); + setIntegerPreset("FXAA", fxSlider->value()); + setIntegerPreset("Bloom", fxSlider->value()); + setIntegerPreset("SquareBloom", fxSlider->value()); + setFloatPreset("DensityBloom", fxSlider->value()); + // characters + setIntegerPreset("SkinNbMaxPoly", charactersSlider->value()); + setIntegerPreset("NbMaxSkeletonNotCLod", charactersSlider->value()); + setFloatPreset("CharacterFarClip", charactersSlider->value()); + // misc if( texturesSlider->value() == QUALITY_NORMAL ) s.config.setInt( "HDEntityTexture", 1 ); else if( texturesSlider->value() == QUALITY_LOW ) @@ -144,71 +139,89 @@ void CDisplaySettingsDetailsWidget::onTexturesSliderChange( int value ) emit changed(); } -const float CDisplaySettingsDetailsWidget::qualityToZFar[ QUALITY_STEP ] = +float CDisplaySettingsDetailsWidget::getPresetFloat(const std::string &variable, sint preset) { - 200.0f, - 400.0f, - 500.0f, - 800.0f -}; + CSystem &s = CSystem::GetInstance(); -const float CDisplaySettingsDetailsWidget::qualityToLandscapeTileNear[ QUALITY_STEP ] = + // preset name + std::string varName = variable + NLMISC::toString("_ps%d", preset); + + return s.config.getFloat(varName.c_str()); +} + +int CDisplaySettingsDetailsWidget::getPresetInteger(const std::string &variable, sint preset) { - 20.0f, - 100.0f, - 150.0f, - 200.0f -}; + CSystem &s = CSystem::GetInstance(); -const float CDisplaySettingsDetailsWidget::qualityToLandscapeThreshold[ QUALITY_STEP ] = + // preset name + std::string varName = variable + NLMISC::toString("_ps%d", preset); + + return s.config.getInt(varName.c_str()); +} + +void CDisplaySettingsDetailsWidget::setFloatPreset(const std::string &variable, int preset) { - 100.0f, - 1000.0f, - 2000.0f, - 3000.0f -}; + CSystem &s = CSystem::GetInstance(); + // take value of the preset and set it to variable + s.config.setFloat(variable.c_str(), getPresetFloat(variable, preset)); +} -const float CDisplaySettingsDetailsWidget::qualityToMicrovegetDensity[ QUALITY_STEP ] = +void CDisplaySettingsDetailsWidget::setIntegerPreset(const std::string &variable, int preset) { - 10.0f, - 30.0f, - 80.0f, - 100.0f -}; + CSystem &s = CSystem::GetInstance(); + // take value of the preset and set it to variable + s.config.setInt(variable.c_str(), getPresetInteger(variable, preset)); +} -const sint32 CDisplaySettingsDetailsWidget::qualityToSkinNbMaxPoly[ QUALITY_STEP ] = +int CDisplaySettingsDetailsWidget::getQualityPresetFloat(const std::string &variable) { - 10000, - 70000, - 100000, - 200000 -}; + CSystem &s = CSystem::GetInstance(); -const sint32 CDisplaySettingsDetailsWidget::qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ] = -{ - 10, - 50, - 125, - 255 -}; + float value = s.config.getFloat(variable.c_str()); -const float CDisplaySettingsDetailsWidget::qualityToCharacterFarClip[ QUALITY_STEP ] = -{ - 50.0f, - 100.0f, - 200.0f, - 500.0f -}; + // ascending order + if (getPresetFloat(variable, 0) < getPresetFloat(variable, QUALITY_STEP-1)) + { + uint32 i = 0; + while((i < QUALITY_STEP) && (getPresetFloat(variable, i) < value) ) + i++; + return i; + } + // descending order + else + { + uint32 i = 0; + while((i < QUALITY_STEP) && (getPresetFloat(variable, i) > value)) + i++; + return i; + } +} -const sint32 CDisplaySettingsDetailsWidget::qualityToFxNbMaxPoly[ QUALITY_STEP ] = +int CDisplaySettingsDetailsWidget::getQualityPresetInteger(const std::string &variable) { - 2000, - 10000, - 20000, - 50000 -}; + CSystem &s = CSystem::GetInstance(); + + float value = s.config.getFloat(variable.c_str()); + + // ascending order + if (getPresetFloat(variable, 0) < getPresetFloat(variable, QUALITY_STEP-1)) + { + uint32 i = 0; + while((i < QUALITY_STEP) && (getPresetFloat(variable, i) < value) ) + i++; + return i; + } + // descending order + else + { + uint32 i = 0; + while((i < QUALITY_STEP) && (getPresetFloat(variable, i) > value)) + i++; + return i; + } +} QString CDisplaySettingsDetailsWidget::getQualityString( uint32 quality ) { @@ -245,7 +258,7 @@ QString CDisplaySettingsDetailsWidget::getTextureQualityString( uint32 quality ) break; case TEXQUALITY_HIGH: - return tr( "High (128 MB)" ); + return tr( "High (more than 128 MB)" ); break; default: diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h index 2ae1de132..f831378f1 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h +++ b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h @@ -58,30 +58,48 @@ private slots: private: /** - @brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified value. - @param table - The lookup table you want to use. - @param value - The value that we want to look up. + @brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified float value. + @param variable - The config variable. @return Returns the "quality" that best fits the specified value. */ - template< typename T > - int getQuality( const T *table, T value ) - { - if( table[ 0 ] < table[ QUALITY_STEP - 1 ] ) - { - uint32 i = 0; - while( ( i < QUALITY_STEP ) && ( table[ i ] < value ) ) - i++; - return i; - } - else - { - uint32 i = 0; - while( ( i < QUALITY_STEP ) && ( table[ i ] > value ) ) - i++; - return i; - } - } + int getQualityPresetFloat(const std::string &variable); + /** + @brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified integer value. + @param variable - The config variable. + @return Returns the "quality" that best fits the specified value. + */ + int getQualityPresetInteger(const std::string &variable); + + /** + @brief Return the float value of the variable depending on the preset. + @param variable - The config variable. + @param preset - The preset to use (0-3). + @return Returns the float value. + */ + float getPresetFloat(const std::string &variable, sint preset); + + /** + @brief Return the integer value of the variable depending on the preset. + @param variable - The config variable. + @param preset - The preset to use (0-3). + @return Returns the integer value. + */ + int getPresetInteger(const std::string &variable, sint preset); + + /** + @brief Define the float value of the variable depending on the predefined preset. + @param variable - The config variable. + @param preset - The preset to use (0-3). + */ + void setFloatPreset(const std::string &variable, int preset); + + /** + @brief Define the integer value of the variable depending on the predefined preset. + @param variable - The config variable. + @param preset - The preset to use (0-3). + */ + void setIntegerPreset(const std::string &variable, int preset); /** @brief Retrieves the string that belongs to the specified quality. @@ -97,22 +115,6 @@ private: @return Returns a string describing the texture quality, Returns an empty string if an invalid value is specified. */ static QString getTextureQualityString( uint32 quality ); - - - ///////////////////////// Landscape values /////////////////////// - static const float qualityToZFar[ QUALITY_STEP ]; - static const float qualityToLandscapeTileNear[ QUALITY_STEP ]; - static const float qualityToLandscapeThreshold[ QUALITY_STEP ]; - static const float qualityToMicrovegetDensity[ QUALITY_STEP ]; - - //////////////////////// Character values //////////////////////// - static const sint32 qualityToSkinNbMaxPoly[ QUALITY_STEP ]; - static const sint32 qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ]; - static const float qualityToCharacterFarClip[ QUALITY_STEP ]; - - /////////////////////// FX values //////////////////////////////// - static const sint32 qualityToFxNbMaxPoly[ QUALITY_STEP ]; - }; #endif // DISPLAYSETTINGSDETAILSWIDGET_H From 89be3e39dee8ecbe268ecabf330c5a09aed302ac Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Mar 2016 19:29:03 +0100 Subject: [PATCH 28/48] Fixed: Clang warnings --HG-- branch : develop --- code/nel/include/nel/gui/ctrl_button.h | 2 +- code/nel/include/nel/gui/ctrl_text_button.h | 2 +- code/nel/include/nel/gui/dbgroup_combo_box.h | 2 +- code/nel/src/gui/dbgroup_combo_box.cpp | 2 +- .../src/interface_v3/interface_3d_scene.cpp | 22 +++++++++---------- .../src/interface_v3/interface_3d_scene.h | 12 +++++----- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/code/nel/include/nel/gui/ctrl_button.h b/code/nel/include/nel/gui/ctrl_button.h index 02b827329..1910ea72a 100644 --- a/code/nel/include/nel/gui/ctrl_button.h +++ b/code/nel/include/nel/gui/ctrl_button.h @@ -51,7 +51,7 @@ namespace NLGUI xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; // Init part - virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void updateCoords(); diff --git a/code/nel/include/nel/gui/ctrl_text_button.h b/code/nel/include/nel/gui/ctrl_text_button.h index 4f5251a8b..69898639d 100644 --- a/code/nel/include/nel/gui/ctrl_text_button.h +++ b/code/nel/include/nel/gui/ctrl_text_button.h @@ -49,7 +49,7 @@ namespace NLGUI xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; // Init part - virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual void checkCoords(); virtual void updateCoords(); diff --git a/code/nel/include/nel/gui/dbgroup_combo_box.h b/code/nel/include/nel/gui/dbgroup_combo_box.h index 1aac8bb1f..87e6d758a 100644 --- a/code/nel/include/nel/gui/dbgroup_combo_box.h +++ b/code/nel/include/nel/gui/dbgroup_combo_box.h @@ -64,7 +64,7 @@ namespace NLGUI uint getTextPos(uint nId) const; const ucstring &getTexture(uint i) const; void setGrayed(uint i, bool g); - const bool getGrayed(uint i) const; + bool getGrayed(uint i) const; void removeText(uint nPos); uint getNumTexts() const {return (uint)_Texts.size();} void sortText(); diff --git a/code/nel/src/gui/dbgroup_combo_box.cpp b/code/nel/src/gui/dbgroup_combo_box.cpp index 572d69ad4..184829e4c 100644 --- a/code/nel/src/gui/dbgroup_combo_box.cpp +++ b/code/nel/src/gui/dbgroup_combo_box.cpp @@ -321,7 +321,7 @@ namespace NLGUI } // *************************************************************************** - const bool CDBGroupComboBox::getGrayed(uint i) const + bool CDBGroupComboBox::getGrayed(uint i) const { if(i<_Grayed.size()) return _Grayed[i]; diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp index d7fec407b..bb15d8d4b 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -786,7 +786,7 @@ CInterface3DCharacter::~CInterface3DCharacter() } // ---------------------------------------------------------------------------- -bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) +bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { if (!CInterfaceElement::parse(cur, parentGroup)) return false; @@ -808,7 +808,7 @@ bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterface3DScene *parentGrou _Char3D = new CCharacter3D; _Char3D->copyAnimation(copyAnim); - _Char3D->init (parentGroup->getScene()); + _Char3D->init (dynamic_cast(parentGroup)->getScene()); _Char3D->setPos (pos.x, pos.y, pos.z); _Char3D->setRotEuler ( rot.x * ((float)(NLMISC::Pi / 180)), rot.y * ((float)(NLMISC::Pi / 180)), @@ -1073,7 +1073,7 @@ CInterface3DIG::~CInterface3DIG() } // ---------------------------------------------------------------------------- -bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) +bool CInterface3DIG::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { if (!CInterfaceElement::parse(cur, parentGroup)) return false; @@ -1095,8 +1095,8 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) setRotX (_Rot.x); setRotY (_Rot.y); setRotZ (_Rot.z); - _IG->addToScene (*parentGroup->getScene(), CViewRenderer::getInstance()->getDriver() ); - parentGroup->getScene()->setToGlobalInstanceGroup (_IG); + _IG->addToScene (*dynamic_cast(parentGroup)->getScene(), CViewRenderer::getInstance()->getDriver() ); + dynamic_cast(parentGroup)->getScene()->setToGlobalInstanceGroup (_IG); return true; } @@ -1235,7 +1235,7 @@ CInterface3DShape::~CInterface3DShape() } // ---------------------------------------------------------------------------- -bool CInterface3DShape::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) +bool CInterface3DShape::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { if (!CInterfaceElement::parse(cur, parentGroup)) return false; @@ -1249,7 +1249,7 @@ bool CInterface3DShape::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) ptr = xmlGetProp (cur, (xmlChar*)"name"); if (ptr) _Name = toLower((const char*)ptr); - _Instance = parentGroup->getScene()->createInstance(_Name); + _Instance = dynamic_cast(parentGroup)->getScene()->createInstance(_Name); if (_Instance.empty()) return false; @@ -1385,7 +1385,7 @@ void CInterface3DShape::setName (const std::string &ht) // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- -bool CInterface3DCamera::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) +bool CInterface3DCamera::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { if (!CInterfaceElement::parse(cur, parentGroup)) return false; @@ -1422,12 +1422,12 @@ CInterface3DLight::~CInterface3DLight() } // ---------------------------------------------------------------------------- -bool CInterface3DLight::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) +bool CInterface3DLight::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { if (!CInterfaceElement::parse(cur, parentGroup)) return false; - _Light = parentGroup->getScene()->createPointLight(); + _Light = dynamic_cast(parentGroup)->getScene()->createPointLight(); CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"pos")); if (ptr) _Pos = convertVector(ptr); @@ -1514,7 +1514,7 @@ CInterface3DFX::~CInterface3DFX() } // ---------------------------------------------------------------------------- -bool CInterface3DFX::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) +bool CInterface3DFX::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { if (!CInterfaceElement::parse(cur, parentGroup)) return false; diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.h b/code/ryzom/client/src/interface_v3/interface_3d_scene.h index cabfb0184..5343390c8 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.h +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.h @@ -148,7 +148,7 @@ public: CInterface3DCharacter(); virtual ~CInterface3DCharacter(); - virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); virtual void checkCoords(); @@ -236,7 +236,7 @@ public: virtual ~CInterface3DShape(); - virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); NL3D::UInstance getShape() { return _Instance; } @@ -295,7 +295,7 @@ public: virtual ~CInterface3DIG(); - virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); NL3D::UInstanceGroup *getIG() { return _IG; } @@ -357,7 +357,7 @@ public: _Dist = 0; } - virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); float getFOV() { return _FOV; } NLMISC::CVector getPos() { return _Pos; } NLMISC::CVector getTarget() { return _Target; } @@ -436,7 +436,7 @@ public: virtual ~CInterface3DLight(); - virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); float getPosX() const { return _Pos.x; } float getPosY() const { return _Pos.y; } @@ -498,7 +498,7 @@ public: virtual ~CInterface3DFX(); - virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); + virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); virtual void checkCoords(); From 198323b9b5dbc85707bf73d9fae7cd1c0d782494 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 19 Mar 2016 22:13:38 +0100 Subject: [PATCH 29/48] Compile fix --HG-- branch : develop --- code/nel/include/nel/pipeline/tool_logger.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/nel/include/nel/pipeline/tool_logger.h b/code/nel/include/nel/pipeline/tool_logger.h index 714f46d2d..3abd72f47 100644 --- a/code/nel/include/nel/pipeline/tool_logger.h +++ b/code/nel/include/nel/pipeline/tool_logger.h @@ -103,7 +103,7 @@ public: { releaseError(); - m_ErrorLog = nlfopen(errorLog, "wt"); + m_ErrorLog = NLMISC::nlfopen(errorLog, "wt"); fwrite(s_ErrorHeader.c_str(), 1, s_ErrorHeader.length(), m_ErrorLog); fwrite("\n", 1, 1, m_ErrorLog); fflush(m_ErrorLog); @@ -114,7 +114,7 @@ public: { releaseDepend(); - m_DependLog = nlfopen(dependLog, "wt"); + m_DependLog = NLMISC::nlfopen(dependLog, "wt"); fwrite(s_DependHeader.c_str(), 1, s_DependHeader.length(), m_DependLog); fwrite("\n", 1, 1, m_DependLog); // fflush(m_DependLog); From bbec2c5b3349178f41aab97433f600a9a87148db Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 19 Mar 2016 22:13:38 +0100 Subject: [PATCH 30/48] Fix random thunder activation caused by rounding error in setup interpolation --HG-- branch : develop --- code/nel/src/misc/bitmap.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index 11a27e67e..5574a8597 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -3106,11 +3106,17 @@ bool CBitmap::blit(const CBitmap *src, sint32 x, sint32 y) // Private : float CBitmap::getColorInterp (float x, float y, float colorInXY00, float colorInXY10, float colorInXY01, float colorInXY11) const { + if (colorInXY00 == colorInXY10 + && colorInXY00 == colorInXY01 + && colorInXY00 == colorInXY11) + return colorInXY00; // Fix rounding error for alpha 255... + float res = colorInXY00*(1.0f-x)*(1.0f-y) + colorInXY10*( x)*(1.0f-y) + colorInXY01*(1.0f-x)*( y) + colorInXY11*( x)*( y); - clamp (res, 0.0f, 255.0f); + clamp(res, 0.0f, 255.0f); + return res; } From 55de2f0bd24d03f0311e911693f5f980ec959da3 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 20 Mar 2016 17:08:44 +0100 Subject: [PATCH 31/48] Fixed: Compilation (missing NLMISC namespaces for nlfopen) --HG-- branch : develop --- code/ryzom/common/src/game_share/bmp4image.h | 2 +- code/ryzom/server/src/pd_lib/pd_server_utils.h | 2 +- code/ryzom/tools/pd_parser/templatizer.h | 2 +- .../tools/sheet_random_generator/srg_utilities.h | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/code/ryzom/common/src/game_share/bmp4image.h b/code/ryzom/common/src/game_share/bmp4image.h index 4ecbd79f5..397a553b2 100644 --- a/code/ryzom/common/src/game_share/bmp4image.h +++ b/code/ryzom/common/src/game_share/bmp4image.h @@ -65,7 +65,7 @@ public: /*bool write(char *filename) { - FILE *outf=nlfopen(filename, "wb"); + FILE *outf=NLMISC::nlfopen(filename, "wb"); if (outf==NULL) return false; diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.h b/code/ryzom/server/src/pd_lib/pd_server_utils.h index 2e7c06363..2d3979f6b 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.h @@ -283,7 +283,7 @@ public: if (_File != NULL) return false; - _File = nlfopen(filename, mode); + _File = NLMISC::nlfopen(filename, mode); if (_File == NULL) return false; diff --git a/code/ryzom/tools/pd_parser/templatizer.h b/code/ryzom/tools/pd_parser/templatizer.h index 5087e033a..e6b67708b 100644 --- a/code/ryzom/tools/pd_parser/templatizer.h +++ b/code/ryzom/tools/pd_parser/templatizer.h @@ -1009,7 +1009,7 @@ public: std::string result = ITemplatizerBloc::eval(env); FILE* f; - f = nlfopen(filename, (clearfile == "true" ? "w" : "a")); + f = NLMISC::nlfopen(filename, (clearfile == "true" ? "w" : "a")); if (f != NULL) { fwrite(result.c_str(), 1, result.size(), f); diff --git a/code/ryzom/tools/sheet_random_generator/srg_utilities.h b/code/ryzom/tools/sheet_random_generator/srg_utilities.h index 686b22418..2ba257b61 100644 --- a/code/ryzom/tools/sheet_random_generator/srg_utilities.h +++ b/code/ryzom/tools/sheet_random_generator/srg_utilities.h @@ -863,7 +863,7 @@ void loadNomenclatureCodes( const char *title, const vector& longNames, vector::iterator iarg; vector::const_iterator ivs; - if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) + if ( (rulesFile = NLMISC::nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1122,7 +1122,7 @@ void loadCSVFile( const char *filename, TMapDeliveryCallback deliveryCallback, b vector args; vector::iterator iarg; - if ( (file = nlfopen( filename, "r" )) == NULL ) + if ( (file = NLMISC::nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1179,7 +1179,7 @@ void loadCSVFile( const char *filename, TVectorDeliveryCallback deliveryCallback vs args; vs::iterator iarg; - if ( (file = nlfopen( filename, "r" )) == NULL ) + if ( (file = NLMISC::nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1218,7 +1218,7 @@ void loadValueFile( const char *filename, const vector& keyStrings, vector args; vector::iterator iarg; - if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) + if ( (rulesFile = NLMISC::nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1272,7 +1272,7 @@ void loadRulesFile( const char *filename, const vector& keyStrings, vector args; vector::iterator iarg; - if ( (rulesFile = nlfopen( filename, "r" )) == NULL ) + if ( (rulesFile = NLMISC::nlfopen( filename, "r" )) == NULL ) { nlwarning( "Can't find file %s", filename ); } @@ -1583,7 +1583,7 @@ void loadTitles( const string& sourceWords, const string& sourceBase, const stri void extractRawMaterialNames() { loadCSVFile( ExtractNamesCsv.c_str(), readRMNames ); - FILE *output = nlfopen( CFile::getFilenameWithoutExtension( ExtractNamesCsv ) + "_output.csv", "wt" ); + FILE *output = NLMISC::nlfopen( CFile::getFilenameWithoutExtension( ExtractNamesCsv ) + "_output.csv", "wt" ); fprintf( output, "Code;Name\n" ); for ( mss::const_iterator iun=UniqueRMNamesAndSheetCodeHead.begin(); iun!=UniqueRMNamesAndSheetCodeHead.end(); ++iun ) { @@ -2344,7 +2344,7 @@ public: if ( ! _Enabled ) return; - _File = nlfopen( filename, "wt" ); + _File = NLMISC::nlfopen( filename, "wt" ); fprintf( _File, ("\n\n" + title + "\n\n").c_str() ); } @@ -2409,7 +2409,7 @@ public: if ( ! _Enabled ) return; - _File = nlfopen( filename, "wt" ); + _File = NLMISC::nlfopen( filename, "wt" ); } /// From 89532b2afb93c993d0b11fb637ba75921e1d5cc5 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 20 Mar 2016 17:27:25 +0100 Subject: [PATCH 32/48] Fixed: Compilation (missing NLMISC namespaces for nlfopen) --HG-- branch : develop --- code/nel/tools/3d/lightmap_optimizer/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index 2e1f0f47c..077cc83b5 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -998,7 +998,7 @@ int main(int nNbArg, char **ppArgs) ChDir (sExeDir); // out a text file, with list of - FILE *out = nlfopen(ppArgs[4], "wt"); + FILE *out = NLMISC::nlfopen(ppArgs[4], "wt"); if(!out) { From 2eb1d7b29392dc037c5b3f0e88307a0dced013b0 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 22 Mar 2016 11:11:47 +0200 Subject: [PATCH 33/48] Added: AppZone and WebBrowser components --HG-- branch : develop --- code/ryzom/client/client_default.cfg | 1 + .../data/gamedev/interfaces_v3/appzone.lua | 192 +++++++++++++ .../data/gamedev/interfaces_v3/appzone.xml | 258 ++++++++++++++++++ .../data/gamedev/interfaces_v3/reset.xml | 8 +- .../data/gamedev/interfaces_v3/taskbar.xml | 5 +- .../data/gamedev/interfaces_v3/webbrowser.lua | 161 +++++++++++ .../data/gamedev/interfaces_v3/widgets.xml | 198 +++++++++++++- 7 files changed, 819 insertions(+), 4 deletions(-) create mode 100644 code/ryzom/client/data/gamedev/interfaces_v3/appzone.lua create mode 100644 code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml create mode 100644 code/ryzom/client/data/gamedev/interfaces_v3/webbrowser.lua diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index cc0a1e02b..f020283f9 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -454,6 +454,7 @@ XMLInterfaceFiles = { "config.xml", "widgets.xml", "webig_widgets.xml", + "appzone.xml", "player.xml", "inventory.xml", "interaction.xml", diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/appzone.lua b/code/ryzom/client/data/gamedev/interfaces_v3/appzone.lua new file mode 100644 index 000000000..1332eb3d5 --- /dev/null +++ b/code/ryzom/client/data/gamedev/interfaces_v3/appzone.lua @@ -0,0 +1,192 @@ + +-- global +AppZone = { + id = "ui:interface:appzone", + homeuri = "?action=appzone_toolbar", + launchuri = "?action=launch_app", + addappuri = "?action=list_user_apps", + mode = "h_bar", + imagesize = 26 +} + +-- use client.cfg value when available +local uri getClientCfg("AppZoneUrl") +if uri == nil or uri == '' then + uri = 'http://app.ryzom.com/' +end + +AppZone.homeuri = uri .. AppZone.homeuri +AppZone.launchuri = uri .. AppZone.launchuri +AppZone.addappuri = uri .. AppZone.addappuri + +function AppZone:getRoot() + return getUI(self.id) +end + +function AppZone:onButtonHome() + local webig = getUI("ui:interface:webig") + webig:find("html").url = self.addappuri + webig.active = true +end + +function AppZone:calculateSize(count, spacer, mode) + local w, h + if mode == "h_bar" then + -- icon=32, space=2+2 + w = count * self.imagesize + spacer * 15 + w = w + 55 + 10 + 20 + h = self.imagesize + 2 + elseif mode == "h_box" then + w = count * self.imagesize + w = w + 20 + h = self.imagesize + 2 + h = h * spacer + h = h + 15 + elseif mode == "v_bar" then + -- icon=32, space=2+2 + h = count * self.imagesize + spacer * 15 + h = h + 20 + 20 + 12 + w = self.imagesize + 2 + 18 + else + h = count * self.imagesize + h = h + 20 + 25 + w = self.imagesize + 2 + w = w * spacer + w = w + 16 + end + + local ui = getUI("ui:interface") + if w > ui.w then + w = ui.w + end + if h > ui.h then + h = ui.h + end + + return w, h +end + +function AppZone:setElementCount(count,spacer,m) + self.mode = m + + local root = self:getRoot() + local content = root:find("content") + local html = root:find("html") + + local button_toggle = root:find("toggle_mode") + local button_reload = root:find("browse_reload") + local button_home = root:find("browse_home") + + local w, h = self:calculateSize(count, spacer, self.mode) + root.h = h + root.w = w + content.w = w + content.h = h + + -- set position of buttons + if self.mode == "h_bar" then + -- button_toggle.posref = "BL BL" + button_toggle.x = 2 + button_toggle.y = 0 + -- button_reload.posref = "TL BL" + html.x = 15 + html.y = 0 + button_reload.x = -25 + button_reload.y = -25 + -- button_home.posref = "BR BR" + button_home.x = 0 + button_home.y = -3 + 5 + elseif self.mode == "h_box" then + -- button_toggle.posref = "TL TL" + button_toggle.x = 2 + button_toggle.y = h - 15 + -- button_reload.posref = "TL BL" + html.x = 0 + html.y = -20 + button_reload.x = -25 + button_reload.y = -4 - 20 + -- button_home.posref = "BR BR" + button_home.x = 0 + button_home.y = -3 + h - 18 + elseif self.mode == "v_bar" then + -- button_toggle.posref = "TL TL" + button_toggle.x = 2 + button_toggle.y = h - 15 + -- button_reload.posref = "TL BL" + html.x = 0 + html.y = -20 + button_reload.x = 0 + button_reload.y = -4 + -- button_home.posref = "BR BR" + button_home.x = 4 - 7 + button_home.y = -3 + else + -- button_toggle.posref = "TL TL" + button_toggle.x = 2 + button_toggle.y = h - 15 + -- button_reload.posref = "TL BL" + html.x = 0 + html.y = -20 + button_reload.x = -25 + button_reload.y = -4 - 20 + -- button_home.posref = "BR BR" + button_home.x = 0 - w + 54 + 12 + button_home.y = -3 + end +end + +function AppZone:setMode(m) + self.mode = m + + self:reload() +end + +function AppZone:setActive(s) + self:getRoot().active = s +end + +function AppZone:launchApp(appid, appwin, appurl) + if not appwin then + if string.match(appid, "^[0-9]+$") then + appwin = "app" .. tostring(appid) + else + appwin = "webig" + end + end + + if not appurl then + appurl = self.launchuri .. "&appid=" .. tostring(appid) + end + + if WebBrowser then + WebBrowser:openWindow(appwin, appurl) + else + -- fallback if WebBrowser not present + local webig = getUI("ui:interface:webig") + webig:find("html").url = appurl; + webig.active = true + end +end + +function AppZone:reload() + local url = self.homeuri + url = url .. "&mode=" .. tostring(self.mode) + + local html = self:getRoot():find("html") + html.url = url +end + +-- slash command: /appzone +function AppZone:handle(cmd) + if cmd == 'show' then + self:setActive(true) + elseif cmd == 'hide' then + self:setActive(false) + elseif cmd == 'reload' then + self:reload() + elseif cmd == 'list' then + self:onButtonHome() + else + self:launchApp(cmd) + end +end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml b/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml new file mode 100644 index 000000000..c6f08c3b2 --- /dev/null +++ b/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/reset.xml b/code/ryzom/client/data/gamedev/interfaces_v3/reset.xml index 1d7e0c66d..8c14f2567 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/reset.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/reset.xml @@ -91,7 +91,11 @@ - + + + + + @@ -470,4 +474,4 @@ - \ No newline at end of file + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml b/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml index 0c42103f3..e497f25e3 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/taskbar.xml @@ -1091,7 +1091,10 @@ - + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/webbrowser.lua b/code/ryzom/client/data/gamedev/interfaces_v3/webbrowser.lua new file mode 100644 index 000000000..f51d7a9da --- /dev/null +++ b/code/ryzom/client/data/gamedev/interfaces_v3/webbrowser.lua @@ -0,0 +1,161 @@ + +-- global +WebBrowser = { + template = "webig_browser", + apps = {} +} + +function WebBrowser:openWindow(id, url) + -- default value if url is not set + url = url or "http://app.ryzom.com/" + + local newWindow = false + local app = self:findAppById(id) + + if not app then + app = {} + app.id = id + app.title = "" + app.url = url + -- getUI() object + app.uiWindow = nil + app.winid = "ui:interface:" .. id + app.winw = 780 + app.winh = 500 + app.minimized = true + app.activeUrl = "" + + table.insert(self.apps, app) + end + + if not app.uiWindow then + -- if there is window present (eg, 'webig'), then reuse it + app.uiWindow = getUI(app.winid, false) + if not app.uiWindow then + app.uiWindow = createRootGroupInstance(self.template, app.id, { + x = 0, y = 0, w = app.winw, h = app.winh, home = app.url, + browse_redo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_redo", + browse_undo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_undo", + browse_refresh = "ui:interface:" .. app.id .. ":browser:header_opened:browse_refresh" + }) + if not app.uiWindow then + return + end + app.uiWindow:center() + end + + newWindow = true + end + + app.activeUrl = url + + -- trigger on_open event + if not app.uiWindow.opened then + app.uiWindow.opened = true + end + + -- trigger on_active event + if not app.uiWindow.active then + app.uiWindow.active = true + end + + local html = app.uiWindow:find("html") + html:browse(url) + + setTopWindow(app.uiWindow) +end + +function WebBrowser:findAppById(id) + for k,app in pairs(self.apps) do + if app.id == id then + return app + end + end + return nil +end + +function WebBrowser:findAppFromUiCaller() + -- id = app123 + local id = getUICaller().id:match("ui:interface:([^:]*):?") + local app = self:findAppById(id) + if app then + return app + end +end + +function WebBrowser:onActive() + if app then + self:restoreWindow(app) + end +end + +function WebBrowser:onClickHeaderClose() + local app = self:findAppFromUiCaller() + if app then + self:saveWindow(app) + end +end + +function WebBrowser:onClickHeaderOpen() + local app = self:findAppFromUiCaller() + if app then + self:restoreWindow(app) + end +end + +-- save current window dimension and minimize window +function WebBrowser:saveWindow(app) + app.minimized = true + app.winw = app.uiWindow.w + app.winh = app.uiWindow.h + -- minimize + app.uiWindow.w = 150 + app.uiWindow.h = 0 +end + +function WebBrowser:restoreWindow(app) + if app.minimized then + app.uiWindow.w = app.winw + app.uiWindow.h = app.winh + app.minimized = false + end +end + +function WebBrowser:onClickRedo() + -- caller is :header_opened:browse_redo + local uiWindow = getUICaller().parent.parent + local html = uiWindow:find("html") + if html ~= nil then + runAH(nil, "browse_redo", "name=" .. html.id) + end +end + +function WebBrowser:onClickUndo() + -- caller is :header_opened:browse_undo + local uiWindow = getUICaller().parent.parent + + local html = uiWindow:find("html") + if html ~= nil then + runAH(nil, "browse_undo", "name=" .. html.id) + end +end + +function WebBrowser:onClickRefresh() + -- caller is :header_opened:browse_refresh + local uiWindow = getUICaller().parent.parent + + local html = uiWindow:find("html") + if html ~= nil then + html:refresh() + end +end + +function WebBrowser:onClickHome() + -- caller is :header_opened:browse_home + local uiWindow = getUICaller().parent.parent + + local html = uiWindow:find("html") + if html ~= nil then + html:browse("home") + end +end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml index 10431b84c..b806edb8d 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml @@ -6927,7 +6927,203 @@ - + + + + + + +