From dbe1294f640a7ab1328381a43f711043210842f5 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Thu, 7 Apr 2011 00:30:12 +0300
Subject: Add client version as special constant to help window.

---
 data/help/header.txt           | 2 +-
 src/gui/helpwindow.cpp         | 1 +
 src/gui/widgets/battletab.cpp  | 1 +
 src/gui/widgets/browserbox.cpp | 6 +++++-
 src/gui/widgets/browserbox.h   | 4 ++++
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/data/help/header.txt b/data/help/header.txt
index d322b791d..80b10e456 100644
--- a/data/help/header.txt
+++ b/data/help/header.txt
@@ -2,7 +2,7 @@
 ##1               M   A   N   A      P   L   U   S
 ##1               ================================
  
-           ##2Version:##6 1.1.4.3          ##2Date:##3 03 # April 2011
+                       ##2Version:##6%VER%
  
 ##2                    Website: http://manaplus.evolonline.org/
 ##2                             http://tmw.cetki.com/
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index a4370d516..e366712e7 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -61,6 +61,7 @@ HelpWindow::HelpWindow():
 
     mBrowserBox->setLinkHandler(this);
     mBrowserBox->setFont(gui->getHelpFont());
+    mBrowserBox->setProcessVersion(true);
 
     place(0, 0, mScrollArea, 5, 3).setPadding(3);
     place(4, 3, okButton);
diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp
index 1ab5cb497..e5f8c0f77 100644
--- a/src/gui/widgets/battletab.cpp
+++ b/src/gui/widgets/battletab.cpp
@@ -26,6 +26,7 @@
 #include "commandhandler.h"
 #include "localplayer.h"
 #include "log.h"
+#include "main.h"
 
 #include "gui/theme.h"
 
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 20d1803f8..a925c0712 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -51,7 +51,8 @@ BrowserBox::BrowserBox(unsigned int mode, bool opaque):
     mWidth(0),
     mYStart(0),
     mUpdateTime(-1),
-    mAlwaysUpdate(true)
+    mAlwaysUpdate(true),
+    mProcessVersion(false)
 {
     setFocusable(true);
     addMouseListener(this);
@@ -136,6 +137,9 @@ void BrowserBox::addRow(const std::string &row, bool atTop)
         newRow = row;
     }
 
+    if (mProcessVersion)
+        newRow = replaceAll(newRow, "%VER%", SMALL_VERSION);
+
     if (atTop)
         mTextRows.push_front(newRow);
     else
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index a21f6b926..a1939bc6d 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -175,6 +175,9 @@ class BrowserBox : public gcn::Widget,
         void setAlwaysUpdate(bool n)
         { mAlwaysUpdate = n; }
 
+        void setProcessVersion(bool n)
+        { mProcessVersion = n; }
+
     private:
         int calcHeight();
 
@@ -201,6 +204,7 @@ class BrowserBox : public gcn::Widget,
         int mYStart;
         int mUpdateTime;
         bool mAlwaysUpdate;
+        bool mProcessVersion;
 };
 
 #endif
-- 
cgit v1.2.3-70-g09d2