summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-07 20:46:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-07 20:46:34 +0300
commitbaff2d8d870fd89c5705959e13f31a1c7ca1be5d (patch)
treebdc1b2aaa75852077514211d7945cf83cfa3e64f /src
parent6996022cc1ba75263f20a02ab0bedb10fc3ef5a5 (diff)
downloadmanaverse-baff2d8d870fd89c5705959e13f31a1c7ca1be5d.tar.gz
manaverse-baff2d8d870fd89c5705959e13f31a1c7ca1be5d.tar.bz2
manaverse-baff2d8d870fd89c5705959e13f31a1c7ca1be5d.tar.xz
manaverse-baff2d8d870fd89c5705959e13f31a1c7ca1be5d.zip
Add current renderer into user agent string.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/main.h3
-rw-r--r--src/net/useragent.cpp42
-rw-r--r--src/net/useragent.h31
-rw-r--r--src/progs/manaplus/client.cpp2
-rw-r--r--src/settings.cpp10
7 files changed, 87 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d0971b0c6..2894c5d0d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -595,6 +595,8 @@ SET(SRCS
net/updatetypeoperators.h
enums/net/updatetype.h
net/uploadcharinfo.h
+ net/useragent.cpp
+ net/useragent.h
net/worldinfo.h
net/packetcounters.cpp
net/packetcounters.h
diff --git a/src/Makefile.am b/src/Makefile.am
index bd920e164..23883c487 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1562,6 +1562,8 @@ SRC = ${BASE_SRC} \
net/updatetypeoperators.cpp \
net/updatetypeoperators.h \
net/uploadcharinfo.h \
+ net/useragent.cpp \
+ net/useragent.h \
net/worldinfo.h \
net/packetcounters.cpp \
net/packetcounters.h \
diff --git a/src/main.h b/src/main.h
index 3ab575aa0..ee1bbb95e 100644
--- a/src/main.h
+++ b/src/main.h
@@ -158,8 +158,7 @@
#endif // SIMD_SUPPORTED
#define PACKAGE_EXTENDED_VERSION "ManaPlus (" PACKAGE_OS \
-"; %s; " SDL_NAME ", " XML_NAME SIMD_NAME "; 4144 v" SMALL_VERSION ")"
-#define PACKAGE_VERSION_4144 "ManaPlus 4144-" SMALL_VERSION ""
+"; %s; " SDL_NAME ", " XML_NAME SIMD_NAME ", %s; 4144 v" SMALL_VERSION ")"
#define FULL_VERSION "ManaPlus " SMALL_VERSION " " PACKAGE_OS ", " \
SDL_NAME ", " XML_NAME SIMD_NAME
diff --git a/src/net/useragent.cpp b/src/net/useragent.cpp
new file mode 100644
index 000000000..c08c68cda
--- /dev/null
+++ b/src/net/useragent.cpp
@@ -0,0 +1,42 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "net/useragent.h"
+
+#include "configuration.h"
+#include "settings.h"
+#include "main.h"
+
+#include "render/graphics.h"
+
+#include "debug.h"
+
+void UserAgent::update()
+{
+ std::string renderName;
+ if (mainGraphics != nullptr)
+ renderName = mainGraphics->getName();
+ else
+ renderName = "unknown";
+
+ settings.userAgent = strprintf(PACKAGE_EXTENDED_VERSION,
+ branding.getStringValue("appName").c_str(),
+ renderName.c_str());
+}
diff --git a/src/net/useragent.h b/src/net/useragent.h
new file mode 100644
index 000000000..f6c5aea32
--- /dev/null
+++ b/src/net/useragent.h
@@ -0,0 +1,31 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_USERAGENT_H
+#define NET_USERAGENT_H
+
+#include "localconsts.h"
+
+namespace UserAgent
+{
+ void update();
+} // namespace UserAgent
+
+#endif // NET_USERAGENT_H
diff --git a/src/progs/manaplus/client.cpp b/src/progs/manaplus/client.cpp
index a3e30b86a..aaacdc7a6 100644
--- a/src/progs/manaplus/client.cpp
+++ b/src/progs/manaplus/client.cpp
@@ -93,6 +93,7 @@
#include "net/loginhandler.h"
#include "net/net.h"
#include "net/updatetypeoperators.h"
+#include "net/useragent.h"
#include "net/packetlimiter.h"
#include "net/partyhandler.h"
@@ -406,6 +407,7 @@ void Client::gameInit()
#endif // defined(USE_OPENGL)
initGraphics();
+ UserAgent::update();
touchManager.init();
diff --git a/src/settings.cpp b/src/settings.cpp
index 4aa8f655e..f620237d3 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -21,7 +21,10 @@
#include "settings.h"
#include "configuration.h"
-#include "main.h"
+
+#ifndef DYECMD
+#include "net/useragent.h"
+#endif // DYECMD
#include "debug.h"
@@ -30,6 +33,7 @@ Settings settings;
void Settings::init()
{
uselonglivesprites = config.getBoolValue("uselonglivesprites");
- userAgent = strprintf(PACKAGE_EXTENDED_VERSION,
- branding.getStringValue("appName").c_str());
+#ifndef DYECMD
+ UserAgent::update();
+#endif // DYECMD
}