summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/updaterwindow.cpp15
-rw-r--r--src/gui/windows/updaterwindow.h2
2 files changed, 11 insertions, 6 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");
diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h
index d08870e0e..7c5cc114c 100644
--- a/src/gui/windows/updaterwindow.h
+++ b/src/gui/windows/updaterwindow.h
@@ -106,7 +106,7 @@ class UpdaterWindow final : public Window,
*/
void loadNews();
- void loadPatch();
+ void checkClientVersion();
void action(const ActionEvent &event) override final;