Merge with develop

This commit is contained in:
kervala 2016-03-12 14:50:10 +01:00
commit b4487dddec
26 changed files with 334 additions and 123 deletions

View file

@ -13,7 +13,7 @@ MACRO(FIND_CORRECT_LUA_VERSION)
SET(LUA53_LIBRARIES liblua5.3 liblua-5.3 liblua.so.5.3) SET(LUA53_LIBRARIES liblua5.3 liblua-5.3 liblua.so.5.3)
FOREACH(_LIB ${LUA53_LIBRARIES}) FOREACH(_LIB ${LUA53_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA53_LIBRARY LUALIB_FOUND) CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND) IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.3") MESSAGE(STATUS "Luabind is using Lua 5.3")
FIND_PACKAGE(Lua53 REQUIRED) FIND_PACKAGE(Lua53 REQUIRED)
@ -26,7 +26,7 @@ MACRO(FIND_CORRECT_LUA_VERSION)
SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2) SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2)
FOREACH(_LIB ${LUA52_LIBRARIES}) FOREACH(_LIB ${LUA52_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND) IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2") MESSAGE(STATUS "Luabind is using Lua 5.2")
FIND_PACKAGE(Lua52 REQUIRED) FIND_PACKAGE(Lua52 REQUIRED)
@ -40,7 +40,7 @@ MACRO(FIND_CORRECT_LUA_VERSION)
SET(LUA51_LIBRARIES liblua5.1 liblua-5.1 liblua.so.5.1) SET(LUA51_LIBRARIES liblua5.1 liblua-5.1 liblua.so.5.1)
FOREACH(_LIB ${LUA51_LIBRARIES}) FOREACH(_LIB ${LUA51_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND) CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND) IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.1") MESSAGE(STATUS "Luabind is using Lua 5.1")
FIND_PACKAGE(Lua51 REQUIRED) FIND_PACKAGE(Lua51 REQUIRED)
@ -54,7 +54,7 @@ MACRO(FIND_CORRECT_LUA_VERSION)
SET(LUA50_LIBRARIES liblua5.0 liblua-5.0 liblua.so.5.0) SET(LUA50_LIBRARIES liblua5.0 liblua-5.0 liblua.so.5.0)
FOREACH(_LIB ${LUA50_LIBRARIES}) FOREACH(_LIB ${LUA50_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND) CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND) IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.0") MESSAGE(STATUS "Luabind is using Lua 5.0")
FIND_PACKAGE(Lua50 REQUIRED) FIND_PACKAGE(Lua50 REQUIRED)

View file

@ -1203,6 +1203,7 @@ sint CDriverGL::getTotalVideoMemory() const
{ {
H_AUTO_OGL(CDriverGL_getTotalVideoMemory); H_AUTO_OGL(CDriverGL_getTotalVideoMemory);
#ifndef USE_OPENGLES
if (_Extensions.NVXGPUMemoryInfo) if (_Extensions.NVXGPUMemoryInfo)
{ {
GLint memoryInKiB = 0; GLint memoryInKiB = 0;
@ -1306,6 +1307,10 @@ sint CDriverGL::getTotalVideoMemory() const
} }
#endif #endif
#else
// TODO: implement for OpenGL ES
#endif
return -1; return -1;
} }

View file

@ -316,7 +316,8 @@ namespace NLGUI
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
curl_easy_setopt(curl, CURLOPT_URL, finalUrl.c_str()); curl_easy_setopt(curl, CURLOPT_URL, finalUrl.c_str());
curl_easy_setopt(curl, CURLOPT_FILE, fp); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_multi_add_handle(MultiCurl, curl); curl_multi_add_handle(MultiCurl, curl);
Curls.push_back(CDataDownload(curl, finalUrl, dest, fp, ImgType, img, "", "", style)); Curls.push_back(CDataDownload(curl, finalUrl, dest, fp, ImgType, img, "", "", style));
@ -423,7 +424,8 @@ namespace NLGUI
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FILE, fp); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_multi_add_handle(MultiCurl, curl); curl_multi_add_handle(MultiCurl, curl);
Curls.push_back(CDataDownload(curl, url, dest, fp, BnpType, NULL, script, md5sum)); Curls.push_back(CDataDownload(curl, url, dest, fp, BnpType, NULL, script, md5sum));

View file

@ -293,7 +293,7 @@ std::string CI18N::getSystemLanguageCode ()
} }
else else
{ {
nlerror("Unable to convert CFStringRef to string"); nlwarning("Unable to convert CFStringRef to string");
} }
delete [] tmp; delete [] tmp;
@ -306,13 +306,22 @@ std::string CI18N::getSystemLanguageCode ()
CFRelease(langCF); CFRelease(langCF);
} }
if (!lang.empty())
{
// fix language code if country is specified
std::string::size_type pos = lang.find('-');
if (pos != std::string::npos)
lang = lang.substr(0, pos);
// only keep language code if supported by NeL // only keep language code if supported by NeL
if (!lang.empty() && isLanguageCodeSupported(lang)) if (isLanguageCodeSupported(lang))
{ {
s_cachedSystemLanguage = lang; s_cachedSystemLanguage = lang;
break; break;
} }
} }
}
// don't need languages array anymore // don't need languages array anymore
CFRelease(langs); CFRelease(langs);

View file

@ -1,4 +1,4 @@
fyrosLastNames = {"Abyan", "Abybus", "Abycaan", "Abycabus", "Abycacaon", "Abycacus", "Abycadix", "Abycadon", "Abycados", "Abycaion" fyrosFirstNames = {"Abyan", "Abybus", "Abycaan", "Abycabus", "Abycacaon", "Abycacus", "Abycadix", "Abycadon", "Abycados", "Abycaion"
, "Abycakos", "Abycala", "Abycalaus", "Abycalion", "Abycallo", "Abycalus", "Abycamus", "Abycan", "Abycanix", "Abycaon", "Abycaps" , "Abycakos", "Abycala", "Abycalaus", "Abycalion", "Abycallo", "Abycalus", "Abycamus", "Abycan", "Abycanix", "Abycaon", "Abycaps"
, "Abycarius", "Abycaron", "Abycaros", "Abycarus", "Abycaseus", "Abycasse", "Abycatheus", "Abycathus", "Abycatis", "Abycaton", "Abycaxius" , "Abycarius", "Abycaron", "Abycaros", "Abycarus", "Abycaseus", "Abycasse", "Abycatheus", "Abycathus", "Abycatis", "Abycaton", "Abycaxius"
, "Abycus", "Abydix", "Abydon", "Abydos", "Abygrian", "Abygribus", "Abygricaon", "Abygricus", "Abygridix", "Abygridon", "Abygridos" , "Abycus", "Abydix", "Abydon", "Abydos", "Abygrian", "Abygribus", "Abygricaon", "Abygricus", "Abygridix", "Abygridon", "Abygridos"
@ -286,7 +286,7 @@ fyrosLastNames = {"Abyan", "Abybus", "Abycaan", "Abycabus", "Abycacaon", "Abycac
, "Zenathus", "Zenatis", "Zenaton", "Zenaxius", "Zenbus", "Zencaon", "Zencus", "Zendix", "Zendon", "Zendos", "Zenion", "Zenix", "Zenkos", "Zenla", "Zenlaus", "Zenlion", "Zenllo", "Zenlus", "Zenmus", "Zenn", "Zennix", "Zenps", "Zenrius", "Zenron", "Zenros", "Zenrus", "Zenseus", "Zensse", "Zentheus" , "Zenathus", "Zenatis", "Zenaton", "Zenaxius", "Zenbus", "Zencaon", "Zencus", "Zendix", "Zendon", "Zendos", "Zenion", "Zenix", "Zenkos", "Zenla", "Zenlaus", "Zenlion", "Zenllo", "Zenlus", "Zenmus", "Zenn", "Zennix", "Zenps", "Zenrius", "Zenron", "Zenros", "Zenrus", "Zenseus", "Zensse", "Zentheus"
, "Zenthus", "Zentis", "Zenton", "Zenxius", "Zeperian", "Zeperibus", "Zepericaon", "Zepericus", "Zeperidix", "Zeperidon", "Zeperidos", "Zeperiion", "Zeperikos", "Zeperila", "Zeperilaus", "Zeperilion", "Zeperillo", "Zeperilus", "Zeperimus", "Zeperin", "Zeperinix", "Zeperips", "Zeperirius", "Zeperiron", "Zeperiros", "Zeperirus", "Zeperiseus", "Zeperisse", "Zeperitheus", "Zeperithus", "Zeperitis", "Zeperiton", "Zeperixius", "Zephaan", "Zephabus", "Zephacaon", "Zephacus", "Zephadix", "Zephadon", "Zephados", "Zephaion", "Zephakos", "Zephala", "Zephalaus", "Zephalion", "Zephallo", "Zephalus", "Zephamus", "Zephan", "Zephanix", "Zephaps", "Zepharius", "Zepharon", "Zepharos", "Zepharus", "Zephaseus", "Zephasse", "Zephatheus", "Zephathus", "Zephatis", "Zephaton", "Zephaxius", "Zephoan", "Zephobus", "Zephocaon", "Zephocus", "Zephodix", "Zephodon", "Zephodos", "Zephoion", "Zephokos", "Zephola", "Zepholaus", "Zepholion", "Zephollo", "Zepholus", "Zephomus", "Zephon", "Zephonix", "Zephops", "Zephorius", "Zephoron", "Zephoros", "Zephorus", "Zephoseus", "Zephosse", "Zephotheus", "Zephothus", "Zephotis", "Zephoton", "Zephoxius", "Zephyan", "Zephybus", "Zephycaon", "Zephycus", "Zephydix", "Zephydon", "Zephydos", "Zephyion", "Zephykos", "Zephyla", "Zephylaus", "Zephylion", "Zephyllo", "Zephylus", "Zephymus", "Zephyn", "Zephynix", "Zephyps", "Zephyrius", "Zephyron", "Zephyros", "Zephyrus", "Zephyseus", "Zephysse", "Zephytheus", "Zephythus", "Zephytis", "Zephyton", "Zephyxius", "Zeps", "Zeraan", "Zerabus", "Zeracaon", "Zeracus", "Zeradix", "Zeradon", "Zerados", "Zeraion", "Zerakos", "Zerala", "Zeralaus", "Zeralion", "Zerallo", "Zeralus", "Zeramus", "Zeran", "Zeranix", "Zeraps", "Zerarius", "Zeraron", "Zeraros", "Zerarus", "Zeraseus", "Zerasse", "Zeratheus", "Zerathus", "Zeratis", "Zeraton", "Zeraxius", "Zerian", "Zeribus", "Zericaon", "Zericus", "Zeridix", "Zeridon", "Zeridos", "Zeriion", "Zerikos", "Zerila", "Zerilaus", "Zerilion", "Zerillo", "Zerilus", "Zerimus", "Zerin", "Zerinix", "Zerips", "Zeririus", "Zeriron", "Zeriros", "Zerirus", "Zeriseus", "Zerisse", "Zeritheus", "Zerithus", "Zeritis", "Zeriton", "Zerius", "Zerixius", "Zeron", "Zeros", "Zerus", "Zeryaan", "Zeryabus", "Zeryacaon", "Zeryacus", "Zeryadix", "Zeryadon", "Zeryados", "Zeryaion", "Zeryakos", "Zeryala", "Zeryalaus", "Zeryalion", "Zeryallo", "Zeryalus", "Zeryamus", "Zeryan", "Zeryanix", "Zeryaps", "Zeryarius", "Zeryaron", "Zeryaros", "Zeryarus", "Zeryaseus", "Zeryasse", "Zeryatheus", "Zeryathus", "Zeryatis", "Zeryaton", "Zeryaxius", "Zeseus", "Zesse", "Zessean", "Zessebus", "Zessecaon", "Zessecus", "Zessedix", "Zessedon", "Zessedos", "Zesseion", "Zessekos", "Zessela", "Zesselaus", "Zesselion", "Zessello", "Zesselus", "Zessemus", "Zessen", "Zessenix", "Zesseps", "Zesserius", "Zesseron", "Zesseros", "Zesserus", "Zesseseus", "Zessesse", "Zessetheus", "Zessethus", "Zessetis", "Zesseton", "Zessexius", "Zetheus", "Zethus", "Zetis", "Zeton", "Zexius"} , "Zenthus", "Zentis", "Zenton", "Zenxius", "Zeperian", "Zeperibus", "Zepericaon", "Zepericus", "Zeperidix", "Zeperidon", "Zeperidos", "Zeperiion", "Zeperikos", "Zeperila", "Zeperilaus", "Zeperilion", "Zeperillo", "Zeperilus", "Zeperimus", "Zeperin", "Zeperinix", "Zeperips", "Zeperirius", "Zeperiron", "Zeperiros", "Zeperirus", "Zeperiseus", "Zeperisse", "Zeperitheus", "Zeperithus", "Zeperitis", "Zeperiton", "Zeperixius", "Zephaan", "Zephabus", "Zephacaon", "Zephacus", "Zephadix", "Zephadon", "Zephados", "Zephaion", "Zephakos", "Zephala", "Zephalaus", "Zephalion", "Zephallo", "Zephalus", "Zephamus", "Zephan", "Zephanix", "Zephaps", "Zepharius", "Zepharon", "Zepharos", "Zepharus", "Zephaseus", "Zephasse", "Zephatheus", "Zephathus", "Zephatis", "Zephaton", "Zephaxius", "Zephoan", "Zephobus", "Zephocaon", "Zephocus", "Zephodix", "Zephodon", "Zephodos", "Zephoion", "Zephokos", "Zephola", "Zepholaus", "Zepholion", "Zephollo", "Zepholus", "Zephomus", "Zephon", "Zephonix", "Zephops", "Zephorius", "Zephoron", "Zephoros", "Zephorus", "Zephoseus", "Zephosse", "Zephotheus", "Zephothus", "Zephotis", "Zephoton", "Zephoxius", "Zephyan", "Zephybus", "Zephycaon", "Zephycus", "Zephydix", "Zephydon", "Zephydos", "Zephyion", "Zephykos", "Zephyla", "Zephylaus", "Zephylion", "Zephyllo", "Zephylus", "Zephymus", "Zephyn", "Zephynix", "Zephyps", "Zephyrius", "Zephyron", "Zephyros", "Zephyrus", "Zephyseus", "Zephysse", "Zephytheus", "Zephythus", "Zephytis", "Zephyton", "Zephyxius", "Zeps", "Zeraan", "Zerabus", "Zeracaon", "Zeracus", "Zeradix", "Zeradon", "Zerados", "Zeraion", "Zerakos", "Zerala", "Zeralaus", "Zeralion", "Zerallo", "Zeralus", "Zeramus", "Zeran", "Zeranix", "Zeraps", "Zerarius", "Zeraron", "Zeraros", "Zerarus", "Zeraseus", "Zerasse", "Zeratheus", "Zerathus", "Zeratis", "Zeraton", "Zeraxius", "Zerian", "Zeribus", "Zericaon", "Zericus", "Zeridix", "Zeridon", "Zeridos", "Zeriion", "Zerikos", "Zerila", "Zerilaus", "Zerilion", "Zerillo", "Zerilus", "Zerimus", "Zerin", "Zerinix", "Zerips", "Zeririus", "Zeriron", "Zeriros", "Zerirus", "Zeriseus", "Zerisse", "Zeritheus", "Zerithus", "Zeritis", "Zeriton", "Zerius", "Zerixius", "Zeron", "Zeros", "Zerus", "Zeryaan", "Zeryabus", "Zeryacaon", "Zeryacus", "Zeryadix", "Zeryadon", "Zeryados", "Zeryaion", "Zeryakos", "Zeryala", "Zeryalaus", "Zeryalion", "Zeryallo", "Zeryalus", "Zeryamus", "Zeryan", "Zeryanix", "Zeryaps", "Zeryarius", "Zeryaron", "Zeryaros", "Zeryarus", "Zeryaseus", "Zeryasse", "Zeryatheus", "Zeryathus", "Zeryatis", "Zeryaton", "Zeryaxius", "Zeseus", "Zesse", "Zessean", "Zessebus", "Zessecaon", "Zessecus", "Zessedix", "Zessedon", "Zessedos", "Zesseion", "Zessekos", "Zessela", "Zesselaus", "Zesselion", "Zessello", "Zesselus", "Zessemus", "Zessen", "Zessenix", "Zesseps", "Zesserius", "Zesseron", "Zesseros", "Zesserus", "Zesseseus", "Zessesse", "Zessetheus", "Zessethus", "Zessetis", "Zesseton", "Zessexius", "Zetheus", "Zethus", "Zetis", "Zeton", "Zexius"}
fyrosFirstNames = {"Abyan", "Abybus", "Abycaon", "Abycus", "Abydix", "Abydon", "Abydos", "Abyion", "Abykos", "Abyla", "Abylaus", "Abylion" fyrosLastNames = {"Abyan", "Abybus", "Abycaon", "Abycus", "Abydix", "Abydon", "Abydos", "Abyion", "Abykos", "Abyla", "Abylaus", "Abylion"
, "Abyllo", "Abylus", "Abymus", "Abyn", "Abynix", "Abyps", "Abyrius", "Abyron", "Abyros", "Abyrus", "Abyseus", "Abysse", "Abytheus", "Abythus" , "Abyllo", "Abylus", "Abymus", "Abyn", "Abynix", "Abyps", "Abyrius", "Abyron", "Abyros", "Abyrus", "Abyseus", "Abysse", "Abytheus", "Abythus"
, "Abytis", "Abyton", "Abyxius", "Aean", "Aebus", "Aecaon", "Aecus", "Aedix", "Aedon", "Aedos", "Aeion", "Aekos", "Aela", "Aelaus", "Aelion" , "Abytis", "Abyton", "Abyxius", "Aean", "Aebus", "Aecaon", "Aecus", "Aedix", "Aedon", "Aedos", "Aeion", "Aekos", "Aela", "Aelaus", "Aelion"
, "Aello", "Aelus", "Aemus", "Aen", "Aenix", "Aeps", "Aerius", "Aeron", "Aeros", "Aerus", "Aeseus", "Aesse", "Aetheus", "Aethus", "Aetis" , "Aello", "Aelus", "Aemus", "Aen", "Aenix", "Aeps", "Aerius", "Aeron", "Aeros", "Aerus", "Aeseus", "Aesse", "Aetheus", "Aethus", "Aetis"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -19,80 +19,80 @@ end
-- tryker: given name 4500, FirstName 4335 -- tryker: given name 4500, FirstName 4335
-- Fyros -- Fyros
function outgame:getFyrosLastName()
local nbFyrosLastNames = 0;
for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end
return fyrosLastNames[math.random(nbFyrosLastNames)]
end
function outgame:getFyrosFirstName() function outgame:getFyrosFirstName()
local nbFyrosFirstNames = 0; local nbFyrosFirstNames = 0;
for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end
return fyrosFirstNames[math.random(nbFyrosFirstNames)] return fyrosFirstNames[math.random(nbFyrosFirstNames)]
end end
function outgame:getFyrosLastName()
local nbFyrosLastNames = 0;
for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end
return fyrosLastNames[math.random(nbFyrosLastNames)]
end
-- Matis -- Matis
function outgame:getMatisLastName(sex) function outgame:getMatisFirstName(sex)
local dbNameSex = getDbProp("UI:TEMP:NAME_SEX"); local dbNameSex = getDbProp("UI:TEMP:NAME_SEX");
if sex ~= nil then if sex ~= nil then
dbNameSex = sex; dbNameSex = sex;
end end
local LastName = "" local FirstName = ""
if tonumber( dbNameSex )== 1 then if tonumber( dbNameSex )== 1 then
local nbMatisMaleLastNames = 0; local nbMatisMaleFirstNames = 0;
for _ in pairs(matisMaleLastNames) do nbMatisMaleLastNames = nbMatisMaleLastNames + 1 end for _ in pairs(matisMaleFirstNames) do nbMatisMaleFirstNames = nbMatisMaleFirstNames + 1 end
LastName = matisMaleLastNames[math.random(nbMatisMaleLastNames)]; FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)];
else else
local nbMatisFemaleLastNames = 0; local nbMatisFemaleFirstNames = 0;
for _ in pairs(matisFemaleLastNames) do nbMatisFemaleLastNames = nbMatisFemaleLastNames + 1 end for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end
LastName = matisFemaleLastNames[math.random(nbMatisFemaleLastNames)]; FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)];
end end
return LastName; return FirstName;
end end
function outgame:getMatisFirstName() function outgame:getMatisLastName()
local nbMatisFirstNames = 0; local nbMatisLastNames = 0;
for _ in pairs(matisFirstNames) do nbMatisFirstNames = nbMatisFirstNames + 1 end for _ in pairs(matisLastNames) do nbMatisLastNames = nbMatisLastNames + 1 end
return matisFirstNames[math.random(nbMatisFirstNames)] return matisLastNames[math.random(nbMatisLastNames)]
end end
-- Tryker -- Tryker
function outgame:getTrykerLastName()
local nbTrykerLastNames = 0;
for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end
return trykerLastNames[math.random(nbTrykerLastNames)]
end
function outgame:getTrykerFirstName() function outgame:getTrykerFirstName()
local nbTrykerFirstNames = 0; local nbTrykerFirstNames = 0;
for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end
return trykerFirstNames[math.random(nbTrykerFirstNames)] return trykerFirstNames[math.random(nbTrykerFirstNames)]
end end
function outgame:getTrykerLastName()
local nbTrykerLastNames = 0;
for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end
return trykerLastNames[math.random(nbTrykerLastNames)]
end
-- Zoraï -- Zoraï
function outgame:getZoraiLastName()
local nbLastNamesOne = 0;
for _ in pairs(zoraiLastNamesOne) do nbLastNamesOne = nbLastNamesOne + 1 end
local lastNameOne = zoraiLastNamesOne[math.random(nbLastNamesOne)];
local nbLastNamesTwo = 0;
for _ in pairs(zoraiLastNamesTwo) do nbLastNamesTwo = nbLastNamesTwo + 1 end
local lastNameTwo = zoraiLastNamesTwo[math.random(nbLastNamesTwo)];
return lastNameOne .. "-" .. lastNameTwo
end
function outgame:getZoraiFirstName() function outgame:getZoraiFirstName()
local nbFirstNames = 0; local nbFirstNamesOne = 0;
for _ in pairs(zoraiFirstNames) do nbFirstNames = nbFirstNames + 1 end for _ in pairs(zoraiFirstNamesOne) do nbFirstNamesOne = nbFirstNamesOne + 1 end
local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)];
return zoraiFirstNames[math.random(nbFirstNames)] local nbFirstNamesTwo = 0;
for _ in pairs(zoraiFirstNamesTwo) do nbFirstNamesTwo = nbFirstNamesTwo + 1 end
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
return zoraiLastNames[math.random(nbLastNames)]
end end
function outgame:procGenerateName() function outgame:procGenerateName()
@ -114,25 +114,25 @@ function outgame:procGenerateName()
lastName = self:getFyrosLastName() lastName = self:getFyrosLastName()
firstName = self:getFyrosFirstName() firstName = self:getFyrosFirstName()
fullnameResult = lastName .. " " .. firstName fullnameResult = lastName .. " " .. firstName
nameResult = lastName nameResult = firstName
elseif tonumber( dbNameRace ) == 2 then elseif tonumber( dbNameRace ) == 2 then
-- Matis -- Matis
lastName = self:getMatisLastName() lastName = self:getMatisLastName()
firstName = self:getMatisFirstName() firstName = self:getMatisFirstName()
fullnameResult = lastName .. " " .. firstName fullnameResult = lastName .. " " .. firstName
nameResult = lastName nameResult = firstName
elseif tonumber( dbNameRace ) == 3 then elseif tonumber( dbNameRace ) == 3 then
-- Tryker -- Tryker
lastName = self:getTrykerLastName() lastName = self:getTrykerLastName()
firstName = self:getTrykerFirstName() firstName = self:getTrykerFirstName()
fullnameResult = firstName .. " " .. lastName fullnameResult = firstName .. " " .. lastName
nameResult = lastName nameResult = firstName
elseif tonumber( dbNameRace ) == 4 then elseif tonumber( dbNameRace ) == 4 then
-- Zorai -- Zorai
lastName = self:getZoraiLastName() lastName = self:getZoraiLastName()
firstName = self:getZoraiFirstName() firstName = self:getZoraiFirstName()
fullnameResult = firstName .. " " .. lastName fullnameResult = firstName .. " " .. lastName
nameResult = lastName nameResult = firstName
elseif tonumber( dbNameRace ) == 5 then elseif tonumber( dbNameRace ) == 5 then
-- Maraudeurs -- Maraudeurs
-- lastName -- lastName
@ -170,7 +170,7 @@ function outgame:procGenerateName()
end end
fullnameResult = lastName .. " " .. firstName fullnameResult = lastName .. " " .. firstName
nameResult = lastName nameResult = firstName
end end
uiNameFull.hardtext = fullnameResult; uiNameFull.hardtext = fullnameResult;

View file

@ -1212,10 +1212,10 @@ void CFarTP::sendReady()
else else
{ {
// Set season // Set season
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
DayNightCycleHour = (float)RT.getRyzomTime(); DayNightCycleHour = (float)RT.getRyzomTime();
CurrSeason = RT.getRyzomSeason(); CurrSeason = RT.getRyzomSeason();
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
DayNightCycleHour = (float)RT.getRyzomTime(); DayNightCycleHour = (float)RT.getRyzomTime();
ManualSeasonValue = RT.getRyzomSeason(); ManualSeasonValue = RT.getRyzomSeason();

View file

@ -797,10 +797,10 @@ void initMainLoop()
{ {
// setup good day / season before ig are added. // setup good day / season before ig are added.
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
updateDayNightCycleHour(); updateDayNightCycleHour();
StartupSeason = CurrSeason = RT.getRyzomSeason(); StartupSeason = CurrSeason = RT.getRyzomSeason();
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
updateDayNightCycleHour(); updateDayNightCycleHour();
ManualSeasonValue = RT.getRyzomSeason(); ManualSeasonValue = RT.getRyzomSeason();

View file

@ -1414,7 +1414,8 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL);
throw Exception ("Can't open file '%s' for writing: code=%d %s (error code 37)", dest.c_str (), errno, strerror(errno)); throw Exception ("Can't open file '%s' for writing: code=%d %s (error code 37)", dest.c_str (), errno, strerror(errno));
} }
curl_easy_setopt(curl, CURLOPT_FILE, fp); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
//CurrentFilesToGet++; //CurrentFilesToGet++;

View file

@ -1340,7 +1340,7 @@ bool mainLoop()
if (!ClientCfg.Local) if (!ClientCfg.Local)
{ {
if(NetMngr.getCurrentServerTick() > LastGameCycle) if(NetMngr.getCurrentServerTick() > LastGameCycle)
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
} }
else if (ClientCfg.SimulateServerTick) else if (ClientCfg.SimulateServerTick)
{ {
@ -1348,7 +1348,7 @@ bool mainLoop()
uint numTicks = (uint) floor(SimulatedServerDate * 10); uint numTicks = (uint) floor(SimulatedServerDate * 10);
SimulatedServerTick += numTicks; SimulatedServerTick += numTicks;
SimulatedServerDate = (float)((double)SimulatedServerDate - (double) numTicks * 0.1); SimulatedServerDate = (float)((double)SimulatedServerDate - (double) numTicks * 0.1);
RT.updateRyzomClock((uint32)SimulatedServerTick, ryzomGetLocalTime() * 0.001); RT.updateRyzomClock((uint32)SimulatedServerTick);
} }
@ -2092,14 +2092,14 @@ bool mainLoop()
if (Actions.valide ("inc_hour")) if (Actions.valide ("inc_hour"))
{ {
RT.increaseTickOffset( (uint32)(2000 * displayHourDelta) ); RT.increaseTickOffset( (uint32)(2000 * displayHourDelta) );
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
} }
// Ctrl-L decrease hour // Ctrl-L decrease hour
if (Actions.valide ("dec_hour")) if (Actions.valide ("dec_hour"))
{ {
RT.decreaseTickOffset( (uint32)(2000 * displayHourDelta) ); RT.decreaseTickOffset( (uint32)(2000 * displayHourDelta) );
RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); RT.updateRyzomClock(NetMngr.getCurrentServerTick());
CTimedFXManager::getInstance().setDate(CClientDate(RT.getRyzomDay(), (float) RT.getRyzomTime())); CTimedFXManager::getInstance().setDate(CClientDate(RT.getRyzomDay(), (float) RT.getRyzomTime()));
if (IGCallbacks) if (IGCallbacks)
{ {

View file

@ -430,6 +430,9 @@ void displayDebug()
TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION"); TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION");
line += lineStep; line += lineStep;
} }
// thunder
TextContext->printfAt(1.f, line, "Thunder level : %.02f", WeatherManager.getThunderLevel());
line += lineStep;
// season // season
TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str()); TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str());
line += lineStep; line += lineStep;

View file

@ -132,7 +132,7 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext
// build current weather state // build current weather state
EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day); EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day);
// //
manualUpdate(day, hour, wc, weatherValue, season); manualUpdateImpl(day, hour, wc, weatherValue, season);
_LastEvalHour = hour; _LastEvalHour = hour;
_LastEvalDay = day; _LastEvalDay = day;
} }
@ -147,25 +147,29 @@ void CWeatherManagerClient::update(uint64 day, float hour, const CWeatherContext
// build current weather state // build current weather state
EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day); EGSPD::CSeason::TSeason season = CRyzomTime::getSeasonByDay((uint32)day);
// //
manualUpdate(day, hour, wc, weatherValue, season, camMat, continent); manualUpdateImpl(day, hour, wc, weatherValue, season, camMat, continent);
_LastEvalHour = hour; _LastEvalHour = hour;
_LastEvalDay = day; _LastEvalDay = day;
} }
//================================================================================================ //================================================================================================
void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const CContinent &continent) void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const CContinent &continent)
{
manualUpdateImpl(day, hour, wc, weatherValue, season, camMat, continent);
_LastEvalHour = hour;
_LastEvalDay = day;
}
//================================================================================================
void CWeatherManagerClient::manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const CContinent &continent)
{ {
H_AUTO_USE(RZ_WeatherManagerClient) H_AUTO_USE(RZ_WeatherManagerClient)
if (!wc.WF) return; if (!wc.WF) return;
manualUpdate(day, hour, wc, weatherValue, season); manualUpdateImpl(day, hour, wc, weatherValue, season);
setupFXs(camMat, wc.GR, continent); setupFXs(camMat, wc.GR, continent);
setupWind(&(wc.WF[season])); setupWind(&(wc.WF[season]));
float scaledWeatherValue = weatherValue * (wc.WF[season].getNumWeatherSetups() - 1); float scaledWeatherValue = weatherValue * (wc.WF[season].getNumWeatherSetups() - 1);
updateThunder(day, hour, wc, true, scaledWeatherValue, season); updateThunder(day, hour, wc, true, scaledWeatherValue, season);
_LastEvalHour = hour;
_LastEvalDay = day;
// Sound stuff // Sound stuff
if (SoundMngr != 0) if (SoundMngr != 0)
@ -250,9 +254,16 @@ void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherC
} }
} }
//================================================================================================ //================================================================================================
void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season) void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season)
{
manualUpdateImpl(day, hour, wc, weatherValue, season);
_LastEvalHour = hour;
_LastEvalDay = day;
}
//================================================================================================
void CWeatherManagerClient::manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season)
{ {
H_AUTO_USE(RZ_WeatherManagerClient) H_AUTO_USE(RZ_WeatherManagerClient)
if (!wc.WF) return; if (!wc.WF) return;
@ -269,11 +280,8 @@ void CWeatherManagerClient::manualUpdate(uint64 day, float hour, const CWeatherC
// blend client specific part // blend client specific part
CWeatherStateClient::blend(_CurrWeatherStateClient, safe_cast<const CWeatherSetupClient *>(floorSetup)->WeatherStateClient, safe_cast<const CWeatherSetupClient *>(ceilSetup)->WeatherStateClient, blendFactor); CWeatherStateClient::blend(_CurrWeatherStateClient, safe_cast<const CWeatherSetupClient *>(floorSetup)->WeatherStateClient, safe_cast<const CWeatherSetupClient *>(ceilSetup)->WeatherStateClient, blendFactor);
} }
_LastEvalHour = hour;
_LastEvalDay = day;
} }
//================================================================================================ //================================================================================================
void CWeatherManagerClient::setupWind(const CWeatherFunction *wf) void CWeatherManagerClient::setupWind(const CWeatherFunction *wf)
{ {

View file

@ -105,6 +105,8 @@ protected:
// from CWeatherManager // from CWeatherManager
virtual void setupLoaded(CWeatherSetup *setup); virtual void setupLoaded(CWeatherSetup *setup);
private: private:
void manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season);
void manualUpdateImpl(uint64 day, float hour, const CWeatherContext &wc, float weatherValue, EGSPD::CSeason::TSeason season, const NLMISC::CMatrix &camMat, const class CContinent &continent);
typedef std::map<std::string, CPrecipitation> TPrecipitationMap; typedef std::map<std::string, CPrecipitation> TPrecipitationMap;
// A vector of precipitation pointers // A vector of precipitation pointers
typedef std::vector<CPrecipitation *> TPrecipitationVect; typedef std::vector<CPrecipitation *> TPrecipitationVect;

View file

@ -83,4 +83,19 @@ namespace WEEKDAY
}; // WEEKDAY }; // WEEKDAY
void CRyzomTime::updateRyzomClock(uint32 gameCyle)
{
static const uint32 ticksPerDay = (RYZOM_DAY_IN_HOUR * RYZOM_HOURS_IN_TICKS);
static const float ticksPerHour = (float)RYZOM_HOURS_IN_TICKS;
uint32 totalTicks = gameCyle + _TickOffset;
uint32 days = totalTicks / ticksPerDay;
uint32 dayCycle = totalTicks - (days * ticksPerDay);
days -= RYZOM_START_SPRING;
float hours = (float)dayCycle / ticksPerHour;
_RyzomDay = days;
_RyzomTime = hours;
}
/* end of file */

View file

@ -135,18 +135,11 @@ public:
{ {
_RyzomDay = 0; _RyzomDay = 0;
_RyzomTime = 0.f; _RyzomTime = 0.f;
_LocalTime = 0.0;
_TickOffset = 0; _TickOffset = 0;
} }
// Update ryzom clock when tick occurs, local time must be given if localUpdateRyzomClock() and getLocalRyzomTime() is used // Update ryzom clock when tick occurs, local time must be given if localUpdateRyzomClock() and getLocalRyzomTime() is used
void updateRyzomClock( uint32 gameCyle, double localTime = 0 ) void updateRyzomClock(uint32 gameCyle);
{
float hours = ( gameCyle + _TickOffset ) / float(RYZOM_HOURS_IN_TICKS);
_RyzomDay = ( (uint)hours / RYZOM_DAY_IN_HOUR ) - RYZOM_START_SPRING;
_RyzomTime = (float) fmod( hours, (float)RYZOM_DAY_IN_HOUR );
_LocalTime = localTime;
}
// get ryzom time (synchronized with server) // get ryzom time (synchronized with server)
inline float getRyzomTime() const { return _RyzomTime; } inline float getRyzomTime() const { return _RyzomTime; }
@ -202,7 +195,6 @@ private:
uint32 _RyzomDay; uint32 _RyzomDay;
float _RyzomTime; float _RyzomTime;
double _LocalTime;
uint32 _TickOffset; uint32 _TickOffset;
}; };

View file

@ -31,6 +31,10 @@
#include <QtGui> #include <QtGui>
#include <QMessageBox> #include <QMessageBox>
#include "nel/misc/cmd_args.h"
extern NLMISC::CCmdArgs Args;
CClientConfigDialog::CClientConfigDialog( QWidget *parent ) : CClientConfigDialog::CClientConfigDialog( QWidget *parent ) :
QDialog( parent ) QDialog( parent )
{ {
@ -145,15 +149,28 @@ void CClientConfigDialog::onClickPlay()
{ {
bool started = false; bool started = false;
QStringList arguments;
if (Args.haveArg("p"))
{
arguments << "-p" << QString::fromUtf8(Args.getArg("p").front().c_str());
}
QString clientFullPath = QString::fromUtf8(Args.getProgramPath().c_str());
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
started = QProcess::startDetached( "ryzom_client_r.exe" ); #ifdef _DEBUG
if( !started ) clientFullPath += "ryzom_client_d.exe";
QProcess::startDetached( "ryzom_client_d.exe" );
#elif defined(Q_OS_MAC)
started = QProcess::startDetached( "./Ryzom.app" );
#else #else
started = QProcess::startDetached( "./ryzom_client" ); clientFullPath += "ryzom_client_r.exe";
#endif #endif
#elif defined(Q_OS_MAC)
clientFullPath += "Ryzom";
#else
clientFullPath += "ryzom_client";
#endif
started = QProcess::startDetached(clientFullPath, arguments);
onClickOK(); onClickOK();
} }

View file

@ -17,6 +17,10 @@
#include "stdpch.h" #include "stdpch.h"
#include "config.h" #include "config.h"
#include "nel/misc/common.h"
#include "nel/misc/i18n.h"
#include "nel/misc/path.h"
CConfig::CConfig() CConfig::CConfig()
{ {
} }
@ -25,17 +29,50 @@ CConfig::~CConfig()
{ {
} }
bool CConfig::load( const char *fileName ) bool CConfig::create(const std::string &configFileName, const std::string &defaultFileName)
{
NLMISC::CFile::createDirectoryTree(NLMISC::CFile::getPath(configFileName));
// create the basic .cfg
FILE *fp = NLMISC::nlfopen(configFileName, "w");
if (fp == NULL) return false;
// store full path to default config file
fprintf(fp, "RootConfigFilename = \"%s\";\n", defaultFileName.c_str());
// get current locale
std::string lang = NLMISC::CI18N::getSystemLanguageCode();
const std::vector<std::string> &languages = NLMISC::CI18N::getLanguageCodes();
// search if current locale is defined in language codes
for(uint i = 0; i < languages.size(); ++i)
{
if (lang == languages[i])
{
// store the language code in the config file
fprintf(fp, "LanguageCode = \"%s\";\n", lang.c_str());
break;
}
}
fclose(fp);
return true;
}
bool CConfig::load(const std::string &fileName)
{ {
try try
{ {
cf.load(fileName); cf.load(fileName);
std::string def = getString("RootConfigFilename"); std::string def = getString("RootConfigFilename");
if( def.compare( "" ) != 0 ) if (!def.empty())
dcf.load(def); dcf.load(def);
} }
catch( NLMISC::Exception &e ) catch (const NLMISC::Exception &e)
{ {
nlwarning( "%s", e.what() ); nlwarning( "%s", e.what() );
return false; return false;
@ -51,7 +88,7 @@ bool CConfig::reload()
cf.clear(); cf.clear();
cf.reparse(); cf.reparse();
} }
catch( NLMISC::Exception &e ) catch (const NLMISC::Exception &e)
{ {
nlwarning( "%s", e.what() ); nlwarning( "%s", e.what() );
return false; return false;
@ -112,7 +149,7 @@ bool CConfig::save()
{ {
cf.save(); cf.save();
} }
catch( NLMISC::Exception &e ) catch (const NLMISC::Exception &e)
{ {
nlwarning( "%s", e.what() ); nlwarning( "%s", e.what() );
return false; return false;

View file

@ -28,12 +28,20 @@ public:
CConfig(); CConfig();
~CConfig(); ~CConfig();
/**
@brief Create a config file.
@param fileName - The config file to create
@param defaultFileName - The default config file to use
@return Returns true on success, returns false on failure.
*/
bool create(const std::string &fileName, const std::string &defaultFileName);
/** /**
@brief Loads a config file. @brief Loads a config file.
@param fileName - The file to load @param fileName - The file to load
@return Returns true on success, returns false on failure. @return Returns true on success, returns false on failure.
*/ */
bool load( const char *fileName ); bool load(const std::string &fileName);
/** /**
@brief Reloads the contents of the config file @brief Reloads the contents of the config file

View file

@ -28,7 +28,7 @@
<item> <item>
<widget class="QCheckBox" name="texcompressionCheckBox"> <widget class="QCheckBox" name="texcompressionCheckBox">
<property name="text"> <property name="text">
<string>Disable texture compression</string> <string>Force texture compression</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -90,10 +90,10 @@ void CDisplaySettingsWidget::load()
windowedRadioButton->setChecked( true ); windowedRadioButton->setChecked( true );
} }
widthLineEdit->setText( QString( "%1" ).arg( mode.width ) ); widthLineEdit->setText(QString::number(mode.width));
heightLineEdit->setText( QString( "%1" ).arg( mode.height ) ); heightLineEdit->setText(QString::number(mode.height));
xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) ); xpositionLineEdit->setText(QString::number(s.config.getInt("PositionX")));
ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) ); ypositionLineEdit->setText(QString::number(s.config.getInt("PositionY")));
} }
@ -165,8 +165,19 @@ void CDisplaySettingsWidget::updateVideoModes()
} }
while(itr != iend) while(itr != iend)
{
if (itr->frequency)
{ {
videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency)); videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency));
}
else if (itr->width)
{
videomodeComboBox->addItem(QString("%1x%2 %3 bit").arg(itr->width).arg(itr->height).arg(itr->depth));
}
else
{
videomodeComboBox->addItem(tr("Auto"));
}
++itr; ++itr;
} }
@ -183,7 +194,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode )
//| --------------------------------------| //| --------------------------------------|
//| Auto | OpenGL modes | //| Auto | OpenGL modes |
//| OpenGL | OpenGL modes | //| OpenGL | OpenGL modes |
//| Direct3D | Direct3d modes | //| Direct3D | Direct3D modes |
//| --------------------------------------| //| --------------------------------------|
// //
// //

View file

@ -18,6 +18,7 @@
#include "client_config_dialog.h" #include "client_config_dialog.h"
#include "system.h" #include "system.h"
#include "nel/misc/cmd_args.h"
#include <QSplashScreen> #include <QSplashScreen>
@ -36,27 +37,117 @@
#endif #endif
NLMISC::CCmdArgs Args;
int main(sint32 argc, char **argv) int main(sint32 argc, char **argv)
{ {
NLMISC::CApplicationContext applicationContext; NLMISC::CApplicationContext applicationContext;
QApplication app(argc, argv); QApplication app(argc, argv);
// parse command-line arguments
Args.setDescription("Ryzom Configuration");
Args.addArg("p", "profile", "id", "Use this profile to determine what directory to use by default");
if (!Args.parse(argc, argv)) return 1;
QApplication::setWindowIcon(QIcon(":/resources/welcome_icon.png")); QApplication::setWindowIcon(QIcon(":/resources/welcome_icon.png"));
QPixmap pixmap(":/resources/splash_screen.png" ); QPixmap pixmap(":/resources/splash_screen.png" );
QSplashScreen splash( pixmap ); QSplashScreen splash( pixmap );
splash.show(); splash.show();
QString locale = QLocale::system().name().left(2); QLocale locale = QLocale::system();
// load application translations
QTranslator localTranslator; QTranslator localTranslator;
if (localTranslator.load(QString(":/translations/ryzom_configuration_%1.qm").arg(locale))) if (localTranslator.load(locale, "ryzom_configuration", "_", ":/translations"))
{ {
app.installTranslator(&localTranslator); QApplication::installTranslator(&localTranslator);
} }
CSystem::GetInstance().config.load( "client.cfg" ); // load Qt default translations
QTranslator qtTranslator;
if (qtTranslator.load(locale, "qt", "_", ":/translations"))
{
QApplication::installTranslator(&qtTranslator);
}
// Known cases:
// 1. Steam
// - Linux and Windows: all files in Steam folder
// - OS X: client.cfg in ~/Library/Application Support/Ryzom, client_default.cfg in Steam folder
// 2. Installer
// - Linux: client.cfg in ~/.ryzom/<config>/ client_default.cfg in ~/.ryzom/ryzom_live/
// - Windows: client.cfg in Roaming/Ryzom/<config>/ client_default.cfg in Local/Ryzom/ryzom_live/
// - OS X: client.cfg in ~/Library/Application Support/Ryzom/<config>/ client_default.cfg in ~/Library/Application Support/Ryzom/ryzom_live/
// default paths
std::string ryzomDir = NLMISC::CPath::standardizePath(NLMISC::CPath::getApplicationDirectory("Ryzom"));
std::string currentDir = Args.getStartupPath();
std::string executableDir = Args.getProgramPath();
std::string configFilename = "client.cfg";
std::string configPath;
// search client.cfg file in config directory (Ryzom Installer)
if (Args.haveArg("p"))
{
ryzomDir = NLMISC::CPath::standardizePath(ryzomDir + Args.getArg("p").front());
// client.cfg is always in profile directory if using -p argument
configPath = ryzomDir + configFilename;
}
else
{
#ifdef NL_OS_MAC
// client.cfg is in ~/Library/Application Support/Ryzom under OS X
configPath = ryzomDir + configFilename;
#else
// client.cfg is in current directory under other platforms
configPath = currentDir + configFilename;
#endif
}
// if file doesn't exist, create it
if (!NLMISC::CFile::fileExists(configPath))
{
// we need the full path to client_default.cfg
std::string defaultConfigFilename = "client_default.cfg";
std::string defaultConfigPath;
#ifdef NL_OS_MAC
// fix path inside bundle
defaultConfigPath = NLMISC::CPath::makePathAbsolute("../Resources", executableDir, true) + defaultConfigFilename;
#else
// same path as executables
defaultConfigPath = executableDir + defaultConfigFilename;
#endif
// test if default config exists in determined path
if (!NLMISC::CFile::fileExists(defaultConfigPath))
{
defaultConfigPath = currentDir + defaultConfigFilename;
// test if default config exists in current path
if (!NLMISC::CFile::fileExists(defaultConfigPath))
{
nlwarning("Unable to find %s", defaultConfigFilename.c_str());
return 1;
}
}
if (!CSystem::GetInstance().config.create(configPath, defaultConfigPath))
{
nlwarning("Unable to create %s", configPath.c_str());
return 1;
}
}
if (!CSystem::GetInstance().config.load(configPath))
{
nlwarning("Unable to load %s", configPath.c_str());
return 1;
}
CClientConfigDialog d; CClientConfigDialog d;
d.show(); d.show();

View file

@ -27,7 +27,7 @@ CSysInfoWidget::CSysInfoWidget( QWidget *parent ) :
osLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.osName.c_str())); osLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.osName.c_str()));
cpuLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.cpuName.c_str())); cpuLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.cpuName.c_str()));
ramLabel->setText(QString(tr("%1 MB").arg(CSystem::GetInstance().sysInfo.totalRAM))); ramLabel->setText(QString(tr("%1 MiB").arg(CSystem::GetInstance().sysInfo.totalRAM)));
gfxcardLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.videoDevice.c_str())); gfxcardLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.videoDevice.c_str()));
gfxdriverLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.videoDriverVersion.c_str())); gfxdriverLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.videoDriverVersion.c_str()));

View file

@ -160,6 +160,16 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv
std::vector< NL3D::GfxMode > modes; std::vector< NL3D::GfxMode > modes;
driver->getModes( modes ); driver->getModes( modes );
{
// auto mode
CVideoMode mode;
mode.depth = 0;
mode.width = 0;
mode.height = 0;
mode.frequency = 0;
dst.push_back( mode );
}
for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr ) for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr )
{ {
if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth >= 16 ) ) if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth >= 16 ) )