Changed: Use "BuildName" from client_default.cfg to determinate last supported patch version by current client under Unix

This commit is contained in:
kervala 2014-03-22 19:36:13 +01:00
parent 98f33cfa87
commit aa9c18481d

View file

@ -1397,7 +1397,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
fclose(fp); fclose(fp);
curl_global_cleanup(); curl_global_cleanup();
CurrentFile = ""; CurrentFile.clear();
if (diskFull) if (diskFull)
{ {
@ -2346,6 +2346,7 @@ void CCheckThread::run ()
uint32 i, j, k; uint32 i, j, k;
// Check if the client version is the same as the server version // Check if the client version is the same as the server version
string sClientVersion = pPM->getClientVersion(); string sClientVersion = pPM->getClientVersion();
string sClientNewVersion = ClientCfg.BuildName;
string sServerVersion = pPM->getServerVersion(); string sServerVersion = pPM->getServerVersion();
ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") "; ucstring sTranslate = CI18N::get("uiClientVersion") + " (" + sClientVersion + ") ";
sTranslate += CI18N::get("uiServerVersion") + " (" + sServerVersion + ")"; sTranslate += CI18N::get("uiServerVersion") + " (" + sServerVersion + ")";
@ -2359,10 +2360,20 @@ void CCheckThread::run ()
return; return;
} }
sint32 nServerVersion; sint32 nServerVersion, nClientVersion, nClientNewVersion;
fromString(sServerVersion, nServerVersion); fromString(sServerVersion, nServerVersion);
fromString(sClientVersion, nClientVersion);
fromString(sClientNewVersion, nClientNewVersion);
if (sClientVersion != sServerVersion) #ifdef NL_OS_UNIX
// servers files are not compatible with current client, use last client version
if (nClientNewVersion && nServerVersion > nClientNewVersion)
{
nServerVersion = nClientNewVersion;
}
#endif
if (nClientVersion != nServerVersion)
{ {
// first, try in the version subdirectory // first, try in the version subdirectory
try try