Added default strings

This commit is contained in:
mathusummut
2019-03-21 16:39:21 +01:00
parent 7ea2bbf60d
commit b0ff32b509

View File

@@ -789,21 +789,16 @@ namespace Game {
if (SystemFlags::VERBOSE_MODE_ENABLED) if (SystemFlags::VERBOSE_MODE_ENABLED)
printf("In [%s::%s Line %d]\n", __FILE__, __FUNCTION__, __LINE__); printf("In [%s::%s Line %d]\n", __FILE__, __FUNCTION__, __LINE__);
Config& config = Config::getInstance();
string updateCheckURL = string updateCheckURL = config.getString("UpdateCheckURL", "");
Config::getInstance().getString("UpdateCheckURL", ""); if (updateCheckURL != "" && config.getBool("UpdateNotifier", "true")) {
if (updateCheckURL != "" && Config::getInstance().getBool("UpdateNotifier", "true")) {
string baseURL = updateCheckURL;
if (SystemFlags::VERBOSE_MODE_ENABLED) if (SystemFlags::VERBOSE_MODE_ENABLED)
printf printf("In [%s::%s Line %d] About to call first http url, base [%s]..\n",
("In [%s::%s Line %d] About to call first http url, base [%s]..\n", __FILE__, __FUNCTION__, __LINE__, updateCheckURL.c_str());
__FILE__, __FUNCTION__, __LINE__, baseURL.c_str());
CURL *handle = SystemFlags::initHTTP(); CURL *handle = SystemFlags::initHTTP();
CURLcode curlResult = CURLE_OK; CURLcode curlResult = CURLE_OK;
string serverVersion = SystemFlags::getHTTP(baseURL, handle, -1, &curlResult); string serverVersion = SystemFlags::getHTTP(updateCheckURL, handle, -1, &curlResult);
if (SystemFlags::VERBOSE_MODE_ENABLED) if (SystemFlags::VERBOSE_MODE_ENABLED)
printf("techsMetaData [%s] curlResult = %d\n", printf("techsMetaData [%s] curlResult = %d\n",
@@ -830,19 +825,16 @@ namespace Game {
curlError.c_str()); curlError.c_str());
showErrorMessageBox(szMsg, "ERROR", false);*/ showErrorMessageBox(szMsg, "ERROR", false);*/
} else if (curlResult == CURLE_OK || } else if (curlResult == CURLE_OK ||
(curlResult != CURLE_COULDNT_RESOLVE_HOST && (curlResult != CURLE_COULDNT_RESOLVE_HOST && curlResult != CURLE_COULDNT_CONNECT)) {
curlResult != CURLE_COULDNT_CONNECT)) {
//Properties props; //Properties props;
//props.loadFromText(serverVersion); //props.loadFromText(serverVersion);
string currentVersion = GameVersionString + GameBuildDateString; string currentVersion = GameVersionString + GameBuildDateString;
int compareResult = int compareResult = compareMajorMinorVersion(currentVersion, serverVersion);
compareMajorMinorVersion(currentVersion, serverVersion);
//props.getString("LatestGameVersion", "")); //props.getString("LatestGameVersion", ""));
if (compareResult == 0) { if (compareResult == 0) {
if (currentVersion != serverVersion) { if (currentVersion != serverVersion)
compareResult = -1; compareResult = -1;
}
} }
if (SystemFlags::VERBOSE_MODE_ENABLED) if (SystemFlags::VERBOSE_MODE_ENABLED)
printf("compareResult = %d local [%s] remote [%s]\n", printf("compareResult = %d local [%s] remote [%s]\n",
@@ -863,16 +855,23 @@ namespace Game {
printf printf
("Checking update key downloadBinaryKey [%s] ftpFileURL [%s]\n", ("Checking update key downloadBinaryKey [%s] ftpFileURL [%s]\n",
downloadBinaryKey.c_str(), ftpFileURL.c_str());*/ downloadBinaryKey.c_str(), ftpFileURL.c_str());*/
ftpFileURL = Config::getInstance().getString("UpdateDownloadURL", ""); ftpFileURL = config.getString("UpdateDownloadURL", "");
Lang& lang = Lang::getInstance();
char szMsg[8096] = "";
string msg;
if (ftpFileURL == "") { if (ftpFileURL == "") {
char szMsg[8096] = ""; if (lang.hasString("UpdateNotice"))
snprintf(szMsg, 8096, Lang::getInstance().getString("UpdateNotice", "").c_str(), msg = lang.getString("UpdateNotice");
currentVersion.c_str(), serverVersion.c_str()); else
msg = "A new update was detected, please visit glest.io for details.\n\nCurrent: %s\nNew: %s";
snprintf(szMsg, 8096, msg.c_str(), currentVersion.c_str(), serverVersion.c_str());
showFTPMessageBox(szMsg, "Update", false, true); showFTPMessageBox(szMsg, "Update", false, true);
} else { } else {
char szMsg[8096] = ""; if (lang.hasString("UpdateNoticeDownloadOffer"))
snprintf(szMsg, 8096, Lang::getInstance().getString("UpdateNoticeDownloadOffer", "").c_str(), msg = lang.getString("UpdateNoticeDownloadOffer");
currentVersion.c_str(), serverVersion.c_str()); else
msg = "A new update was detected, do you want to download it now?\n\nCurrent: %s\nNew: %s";
snprintf(szMsg, 8096, msg.c_str(), currentVersion.c_str(), serverVersion.c_str());
showFTPMessageBox(szMsg, "Update", false, false); showFTPMessageBox(szMsg, "Update", false, false);
} }
} }