summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/help/header.txt2
-rw-r--r--data/help/index.txt13
-rw-r--r--src/gui/updaterwindow.cpp14
3 files changed, 20 insertions, 9 deletions
diff --git a/data/help/header.txt b/data/help/header.txt
index 50f88e0ce..5d5604b77 100644
--- a/data/help/header.txt
+++ b/data/help/header.txt
@@ -4,6 +4,6 @@
<<##2Version:##6%VER%>>
-##2 <<Website: http://manaplus.evolonline.org/>>
+##2 <<Website: http://manaplus.evolonline.org/>>
diff --git a/data/help/index.txt b/data/help/index.txt
index 99347809c..c4eeb8f02 100644
--- a/data/help/index.txt
+++ b/data/help/index.txt
@@ -1,18 +1,19 @@
##3 === <<INDEX>> ===
-
+
##1-> @@about|<<About>>@@
-> @@team|<<Manaplus Developers>>@@
-
+
-> @@commands|<<Commands>>@@
-> @@chatcommands|<<Chat commands>>@@
-> @@windows|<<Windows>>@@
-> @@skills|<<Skills>>@@
-
+
+ -> @@news|<<Server news>>@@
-> @@support|<<Support>>@@
-
-
+.
+.
##3 === <<Powered By>> ===
-
+.
<<##2 SDL, SDL_image, SDL_mixer (Media framework)
##2 SDL_net (Networking framework)
##2 Guichan (GUI framework)
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index eb2fe2f82..43185b418 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -44,6 +44,7 @@
#include "resources/resourcemanager.h"
#include "utils/gettext.h"
+#include "utils/mkdir.h"
#include "utils/paths.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
@@ -296,11 +297,15 @@ void UpdaterWindow::loadNews()
mMemoryBuffer, mDownloadedBytes + 1));
mMemoryBuffer[mDownloadedBytes] = '\0';
-
mBrowserBox->clearRows();
-
// Tokenize and add each line separately
char *line = strtok(mMemoryBuffer, "\n");
+
+ std::string newsName = mUpdatesDir + "/local/help/news.txt";
+ mkdir_r((mUpdatesDir + "/local/help/").c_str());
+ std::ofstream file;
+ file.open(newsName.c_str(), std::ios::out);
+
bool firstLine(true);
while (line)
{
@@ -315,15 +320,20 @@ void UpdaterWindow::loadNews()
continue;
}
+ if (file.is_open())
+ file << str << std::endl;
mBrowserBox->addRow(str);
}
else
{
+ if (file.is_open())
+ file << line << std::endl;
mBrowserBox->addRow(line);
}
line = strtok(nullptr, "\n");
}
+ file.close();
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
mMemoryBuffer = nullptr;