summaryrefslogtreecommitdiff
path: root/src/gui/windows/updaterwindow.cpp
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-06-28 23:49:15 +0200
committerFedja Beader <fedja@protonmail.ch>2025-06-28 23:57:53 +0200
commite49f3eee7a1324f12d40acd5731075e892726cd6 (patch)
treebae53e6e3f99d78484254a1fb433963cff1e3250 /src/gui/windows/updaterwindow.cpp
parent427c4ba42ff64cdf4f9c370cfd9c29785a85d27c (diff)
downloadmanaplus-e49f3eee7a1324f12d40acd5731075e892726cd6.tar.gz
manaplus-e49f3eee7a1324f12d40acd5731075e892726cd6.tar.bz2
manaplus-e49f3eee7a1324f12d40acd5731075e892726cd6.tar.xz
manaplus-e49f3eee7a1324f12d40acd5731075e892726cd6.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.cpp15
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");