Renamed environment variables

This commit is contained in:
mathusummut
2018-11-02 12:28:43 +01:00
parent 69ab9716da
commit c0bc0c40c2
12 changed files with 59 additions and 106 deletions

View File

@@ -585,13 +585,13 @@ namespace
// string sandboxScriptFilename = data_path + "data/core/scripts/sandbox.lua"; // string sandboxScriptFilename = data_path + "data/core/scripts/sandbox.lua";
// string sandboxLuaCode = getFileTextContents(sandboxScriptFilename); // string sandboxLuaCode = getFileTextContents(sandboxScriptFilename);
// //
// //luaScript.loadCode(sandboxLuaCode + "\n", "megaglest_lua_sandbox"); // //luaScript.loadCode(sandboxLuaCode + "\n", "zetaglest_lua_sandbox");
// luaScript.setSandboxWrapperFunctionName("runsandboxed"); // luaScript.setSandboxWrapperFunctionName("runsandboxed");
// luaScript.setSandboxCode(sandboxLuaCode); // luaScript.setSandboxCode(sandboxLuaCode);
// luaScript.runCode(sandboxLuaCode); // luaScript.runCode(sandboxLuaCode);
// // Setup the lua security sandbox here // // Setup the lua security sandbox here
// luaScript.beginCall("megaglest_lua_sandbox"); // luaScript.beginCall("zetaglest_lua_sandbox");
// luaScript.endCall(); // luaScript.endCall();
//setup message box //setup message box

View File

@@ -123,27 +123,27 @@ namespace Glest {
strToBool(lang.getString("FONT_RIGHTTOLEFT_MIXED_SUPPORT")); strToBool(lang.getString("FONT_RIGHTTOLEFT_MIXED_SUPPORT"));
} }
if (lang.hasString("MEGAGLEST_FONT")) { if (lang.hasString("ZETAGLEST_FONT")) {
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese
#if defined(WIN32) #if defined(WIN32)
string newEnvValue = string newEnvValue =
"MEGAGLEST_FONT=" + lang.getString("MEGAGLEST_FONT"); "ZETAGLEST_FONT=" + lang.getString("ZETAGLEST_FONT");
_putenv(newEnvValue.c_str()); _putenv(newEnvValue.c_str());
#else #else
setenv("MEGAGLEST_FONT", setenv("ZETAGLEST_FONT",
lang.getString("MEGAGLEST_FONT").c_str(), 0); lang.getString("ZETAGLEST_FONT").c_str(), 0);
#endif #endif
} }
if (lang.hasString("MEGAGLEST_FONT_FAMILY")) { if (lang.hasString("ZETAGLEST_FONT_FAMILY")) {
#if defined(WIN32) #if defined(WIN32)
string newEnvValue = string newEnvValue =
"MEGAGLEST_FONT_FAMILY=" + "ZETAGLEST_FONT_FAMILY=" +
lang.getString("MEGAGLEST_FONT_FAMILY"); lang.getString("ZETAGLEST_FONT_FAMILY");
_putenv(newEnvValue.c_str()); _putenv(newEnvValue.c_str());
#else #else
setenv("MEGAGLEST_FONT_FAMILY", setenv("ZETAGLEST_FONT_FAMILY",
lang.getString("MEGAGLEST_FONT_FAMILY").c_str(), 0); lang.getString("ZETAGLEST_FONT_FAMILY").c_str(), 0);
#endif #endif
} }
@@ -197,10 +197,10 @@ namespace Glest {
strToBool(lang.getString("FONT_RIGHTTOLEFT_WINDOWS")); strToBool(lang.getString("FONT_RIGHTTOLEFT_WINDOWS"));
} }
if (lang.hasString("MEGAGLEST_FONT_WINDOWS")) { if (lang.hasString("ZETAGLEST_FONT_WINDOWS")) {
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-japanese-gothic.ttf",0); // Japanese
string newEnvValue = string newEnvValue =
"MEGAGLEST_FONT=" + lang.getString("MEGAGLEST_FONT_WINDOWS"); "ZETAGLEST_FONT=" + lang.getString("ZETAGLEST_FONT_WINDOWS");
_putenv(newEnvValue.c_str()); _putenv(newEnvValue.c_str());
} }

View File

@@ -495,23 +495,6 @@ namespace Glest {
modelShowTime = disappear * (displayItemNumber); modelShowTime = disappear * (displayItemNumber);
} }
/*
string lineText = "Based on award-winning classic Glest";
texts.push_back(new Text(lineText, Vec2i(-1, -1), appear, coreData.getMenuFontVeryBig(),coreData.getMenuFontVeryBig3D()));
lineText = "the MegaGlest Team presents";
texts.push_back(new Text(lineText, Vec2i(-1, -1), disappear, coreData.getMenuFontVeryBig(),coreData.getMenuFontVeryBig3D()));
lineText = "a libre software real-time strategy game";
texts.push_back(new Text(lineText, Vec2i(-1, -1), disappear *(++displayItemNumber), coreData.getMenuFontVeryBig(),coreData.getMenuFontVeryBig3D()));
texts.push_back(new Text(coreData.getLogoTexture(), Vec2i(w/2-128, h/2-64), Vec2i(256, 128), disappear *(++displayItemNumber)));
texts.push_back(new Text(GameVersionString, Vec2i(w/2+45, h/2-45), disappear *(displayItemNumber++), coreData.getMenuFontNormal(),coreData.getMenuFontNormal3D()));
lineText = "www.megaglest.org";
//texts.push_back(new Text(lineText, Vec2i(-1, -1), disappear *(displayItemNumber++), coreData.getMenuFontVeryBig(),coreData.getMenuFontVeryBig3D()));
texts.push_back(new Text(lineText, Vec2i(-1, h/2-45-18), disappear *(displayItemNumber-1), coreData.getMenuFontVeryBig(),coreData.getMenuFontVeryBig3D()));
*/
if (showIntroPics > 0 && coreData.getMiscTextureList().size() > 0) { if (showIntroPics > 0 && coreData.getMiscTextureList().size() > 0) {
const int const int
showMiscTime = showIntroPicsTime; showMiscTime = showIntroPicsTime;

View File

@@ -7149,10 +7149,10 @@ namespace
#if defined(WIN32) #if defined(WIN32)
string string
newEnvValue = "MEGAGLEST_FONT=" + newfont; newEnvValue = "ZETAGLEST_FONT=" + newfont;
_putenv(newEnvValue.c_str()); _putenv(newEnvValue.c_str());
#else #else
setenv("MEGAGLEST_FONT", newfont.c_str(), 1); setenv("ZETAGLEST_FONT", newfont.c_str(), 1);
#endif #endif
} else { } else {
printf printf

View File

@@ -75,9 +75,9 @@ namespace Glest {
string strInternalInfo = ""; string strInternalInfo = "";
strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported()); strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported());
if (getenv("MEGAGLEST_FONT") != NULL) { if (getenv("ZETAGLEST_FONT") != NULL) {
char *tryFont = getenv("MEGAGLEST_FONT"); char *tryFont = getenv("ZETAGLEST_FONT");
strInternalInfo += "\nMEGAGLEST_FONT: " + string(tryFont); strInternalInfo += "\nZETAGLEST_FONT: " + string(tryFont);
} }
strInternalInfo += strInternalInfo +=
"\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts); "\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts);
@@ -129,9 +129,9 @@ namespace Glest {
string strInternalInfo = ""; string strInternalInfo = "";
strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported()); strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported());
if (getenv("MEGAGLEST_FONT") != NULL) { if (getenv("ZETAGLEST_FONT") != NULL) {
char *tryFont = getenv("MEGAGLEST_FONT"); char *tryFont = getenv("ZETAGLEST_FONT");
strInternalInfo += "\nMEGAGLEST_FONT: " + string(tryFont); strInternalInfo += "\nZETAGLEST_FONT: " + string(tryFont);
} }
strInternalInfo += strInternalInfo +=
"\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts); "\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts);

View File

@@ -987,19 +987,6 @@ namespace
std::string fileDataDetails = std::string fileDataDetails =
SystemFlags::getHTTP(fileURLDetails, handle); SystemFlags::getHTTP(fileURLDetails, handle);
// "available_languages": [
// {
// "code_aliases": " ",
// "code": "ca",
// "name": "Catalan"
// },
// {
// "code_aliases": " ",
// "code": "zh",
// "name": "Chinese"
// },
// curl -i -L --user softcoder -X GET https://www.transifex.com/api/2/project/megaglest/resource/main-language-file/?details
string string
search_detail_key = "\"code\": \"" + txnURLLang + "\""; search_detail_key = "\"code\": \"" + txnURLLang + "\"";
size_t size_t

View File

@@ -92,13 +92,13 @@ namespace Shared {
Font::langHeightText = "yW"; Font::langHeightText = "yW";
#if defined(WIN32) #if defined(WIN32)
string newEnvValue = "MEGAGLEST_FONT="; string newEnvValue = "ZETAGLEST_FONT=";
_putenv(newEnvValue.c_str()); _putenv(newEnvValue.c_str());
newEnvValue = "MEGAGLEST_FONT_FAMILY="; newEnvValue = "ZETAGLEST_FONT_FAMILY=";
_putenv(newEnvValue.c_str()); _putenv(newEnvValue.c_str());
#else #else
unsetenv("MEGAGLEST_FONT"); unsetenv("ZETAGLEST_FONT");
unsetenv("MEGAGLEST_FONT_FAMILY"); unsetenv("ZETAGLEST_FONT_FAMILY");
#endif #endif
} }
@@ -609,11 +609,11 @@ namespace Shared {
} }
// Get user-specified font path // Get user-specified font path
string megaglest_font = safeCharPtrCopy(getenv("MEGAGLEST_FONT"), 8095); string zetaglest_font = safeCharPtrCopy(getenv("ZETAGLEST_FONT"), 8095);
string megaglest_font_family = safeCharPtrCopy(getenv("MEGAGLEST_FONT_FAMILY"), 8095); string zetaglest_font_family = safeCharPtrCopy(getenv("ZETAGLEST_FONT_FAMILY"), 8095);
if (megaglest_font != "" || megaglest_font_family != "") { if (zetaglest_font != "" || zetaglest_font_family != "") {
if (megaglest_font != "") { if (zetaglest_font != "") {
tryFont = megaglest_font; tryFont = zetaglest_font;
if (Text::DEFAULT_FONT_PATH_ABSOLUTE != "") { if (Text::DEFAULT_FONT_PATH_ABSOLUTE != "") {
tryFont = Text::DEFAULT_FONT_PATH_ABSOLUTE + "/" + extractFileFromDirectoryPath(tryFont); tryFont = Text::DEFAULT_FONT_PATH_ABSOLUTE + "/" + extractFileFromDirectoryPath(tryFont);
@@ -622,9 +622,9 @@ namespace Shared {
replaceAll(tryFont, "/", "\\"); replaceAll(tryFont, "/", "\\");
#endif #endif
CHECK_FONT_PATH(tryFont.c_str(), megaglest_font_family.c_str(), &font, &path); CHECK_FONT_PATH(tryFont.c_str(), zetaglest_font_family.c_str(), &font, &path);
} else { } else {
CHECK_FONT_PATH(NULL, megaglest_font_family.c_str(), &font, &path); CHECK_FONT_PATH(NULL, zetaglest_font_family.c_str(), &font, &path);
} }
} }

View File

@@ -47,17 +47,17 @@ namespace Shared {
TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) { TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) {
//throw game_runtime_error("FTGL!"); //throw game_runtime_error("FTGL!");
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",0); //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",0);
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/arphic/uming.ttc",0); // Chinese //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/arphic/uming.ttc",0); // Chinese
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/arphic/ukai.ttc",0); // Chinese //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/arphic/ukai.ttc",0); // Chinese
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf",0); // Russian / Cyrillic //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf",0); // Russian / Cyrillic
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-charis/CharisSILR.ttf",0); // Russian / Cyrillic //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-charis/CharisSILR.ttf",0); // Russian / Cyrillic
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf",0); // Russian / Cyrillic //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf",0); // Russian / Cyrillic
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/takao/TakaoPGothic.ttf",0); // Japanese //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/takao/TakaoPGothic.ttf",0); // Japanese
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-scheherazade/ScheherazadeRegOT.ttf",0); // Arabic //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-sil-scheherazade/ScheherazadeRegOT.ttf",0); // Arabic
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf",0); // Hebrew //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf",0); // Hebrew
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/unifont/unifont.ttf",0); // Czech? //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/unifont/unifont.ttf",0); // Czech?
//setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf",0); // Czech? //setenv("ZETAGLEST_FONT","/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf",0); // Czech?
fontFile = findFont(); fontFile = findFont();

View File

@@ -796,9 +796,6 @@ namespace Shared {
} }
void MapPreview::loadFromFile(const string &path) { void MapPreview::loadFromFile(const string &path) {
// "Could not open file, result: 3 - 2 No such file or directory [C:\Documents and Settings\人間五\Application Data\megaglest\maps\clearings_in_the_woods.gbm]
#ifdef WIN32 #ifdef WIN32
wstring wstr = utf8_decode(path); wstring wstr = utf8_decode(path);
FILE* f1 = _wfopen(wstr.c_str(), L"rb"); FILE* f1 = _wfopen(wstr.c_str(), L"rb");

View File

@@ -3144,20 +3144,6 @@ namespace Shared {
if(debugPingOutput) printf("Running cmd [%s] got [%s]\n",szCmd,buf); if(debugPingOutput) printf("Running cmd [%s] got [%s]\n",szCmd,buf);
// Linux
//softcoder@softhauslinux:~/Code/megaglest/trunk/mk/linux$ ping -c 5 soft-haus.com
//PING soft-haus.com (65.254.250.110) 56(84) bytes of data.
//64 bytes from 65-254-250-110.yourhostingaccount.com (65.254.250.110): icmp_seq=1 ttl=242 time=133 ms
//64 bytes from 65-254-250-110.yourhostingaccount.com (65.254.250.110): icmp_seq=2 ttl=242 time=137 ms
//
// Windows XP
//C:\Code\megaglest\trunk\data\glest_game>ping -n 5 soft-haus.com
//
//Pinging soft-haus.com [65.254.250.110] with 32 bytes of data:
//
//Reply from 65.254.250.110: bytes=32 time=125ms TTL=242
//Reply from 65.254.250.110: bytes=32 time=129ms TTL=242
std::string str = buf; std::string str = buf;
std::string::size_type ms_pos = 0; std::string::size_type ms_pos = 0;
int count = 0; int count = 0;

View File

@@ -229,22 +229,22 @@ namespace Shared {
#ifndef WIN32 #ifndef WIN32
string mg_icon_file = ""; string mg_icon_file = "";
#if defined(DATADIR) #if defined(DATADIR)
if (fileExists(formatPath(TOSTRING(DATADIR)) + "megaglest.png")) { if (fileExists(formatPath(TOSTRING(DATADIR)) + "zetaglest.png")) {
mg_icon_file = formatPath(TOSTRING(DATADIR)) + "megaglest.png"; mg_icon_file = formatPath(TOSTRING(DATADIR)) + "zetaglest.png";
} else if (fileExists(formatPath(TOSTRING(DATADIR)) + "megaglest.bmp")) { } else if (fileExists(formatPath(TOSTRING(DATADIR)) + "zetaglest.bmp")) {
mg_icon_file = formatPath(TOSTRING(DATADIR)) + "megaglest.bmp"; mg_icon_file = formatPath(TOSTRING(DATADIR)) + "zetaglest.bmp";
} }
#endif #endif
if (mg_icon_file == "" && fileExists("megaglest.png")) { if (mg_icon_file == "" && fileExists("zetaglest.png")) {
mg_icon_file = "megaglest.png"; mg_icon_file = "zetaglest.png";
} else if (mg_icon_file == "" && fileExists("megaglest.bmp")) { } else if (mg_icon_file == "" && fileExists("zetaglest.bmp")) {
mg_icon_file = "megaglest.bmp"; mg_icon_file = "zetaglest.bmp";
} else if (mg_icon_file == "" && fileExists("/usr/share/pixmaps/megaglest.png")) { } else if (mg_icon_file == "" && fileExists("/usr/share/pixmaps/zetaglest.png")) {
mg_icon_file = "/usr/share/pixmaps/megaglest.png"; mg_icon_file = "/usr/share/pixmaps/zetaglest.png";
} else if (mg_icon_file == "" && fileExists("/usr/share/pixmaps/megaglest.bmp")) { } else if (mg_icon_file == "" && fileExists("/usr/share/pixmaps/zetaglest.bmp")) {
mg_icon_file = "/usr/share/pixmaps/megaglest.bmp"; mg_icon_file = "/usr/share/pixmaps/zetaglest.bmp";
} }
if (mg_icon_file != "") { if (mg_icon_file != "") {

View File

@@ -387,8 +387,8 @@ namespace Shared {
} }
// Allows platforms to specify which sound device to use // Allows platforms to specify which sound device to use
// using the environment variable: MEGAGLEST_SOUND_DEVICE // using the environment variable: ZETAGLEST_SOUND_DEVICE
char *deviceName = getenv("MEGAGLEST_SOUND_DEVICE"); char *deviceName = getenv("ZETAGLEST_SOUND_DEVICE");
device = alcOpenDevice(deviceName); device = alcOpenDevice(deviceName);
if (SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) { if (SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) {