diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-06-28 23:49:15 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-06-28 23:57:53 +0200 |
commit | e49f3eee7a1324f12d40acd5731075e892726cd6 (patch) | |
tree | bae53e6e3f99d78484254a1fb433963cff1e3250 /src/gui/windows/updaterwindow.cpp | |
parent | 427c4ba42ff64cdf4f9c370cfd9c29785a85d27c (diff) | |
download | manaplus-client_version_check_docs.tar.gz manaplus-client_version_check_docs.tar.bz2 manaplus-client_version_check_docs.tar.xz manaplus-client_version_check_docs.zip |
clarify that loadPatch() is checkClientVersion() and add commentsclient_version_check_docs
Diffstat (limited to 'src/gui/windows/updaterwindow.cpp')
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 87a2b1894..d76f595c4 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -431,11 +431,11 @@ void UpdaterWindow::loadNews() mScrollArea->setVerticalScrollAmount(0); } -void UpdaterWindow::loadPatch() +void UpdaterWindow::checkClientVersion() { if (mMemoryBuffer == nullptr) { - logger->log1("Couldn't load patch"); + logger->log1("Couldn't check client version: null buffer"); return; } @@ -444,13 +444,17 @@ void UpdaterWindow::loadPatch() realloc(mMemoryBuffer, mDownloadedBytes + 1)); if (mMemoryBuffer == nullptr) { - logger->log1("Couldn't load patch"); + logger->log1("Couldn't check client version: null buffer"); return; } mMemoryBuffer[mDownloadedBytes] = '\0'; std::string version; + // The version check file (latest.txt) is composed of two lines: + // first, the "machine readable" version (for alphanumeric comparison) + // and second, the human readable version, to be displayed. + // Tokenize and add each line separately char *line = strtok(mMemoryBuffer, "\n"); if (line != nullptr) @@ -461,6 +465,8 @@ void UpdaterWindow::loadPatch() line = strtok(nullptr, "\n"); if (line != nullptr) { + // if you wonder why this line is above the one below, it's + // because add to top is true. mBrowserBox->addRow(strprintf("##9 Latest client version: " "##6ManaVerse %s##0", line), true); } @@ -825,8 +831,7 @@ void UpdaterWindow::logic() case UpdateDownloadStatus::UPDATE_PATCH: if (mDownloadComplete) { - // Parse current memory buffer as news and dispose of the data - loadPatch(); + checkClientVersion(); mUpdateHost = updateServer2 + mUpdateServerPath; mUpdatesDir = pathJoin(mUpdatesDir, "fix"); |