Feature: opt-in survey when exiting a game
On first start-up, the game will ask if you want to participate in our automated survey. You have to opt-in, and can easily opt-out (via the Options) at any time. When opt-in, whenever you exit a game, a JSON blob will be send to the survey server hosted by OpenTTD. This JSON blob contains information that gives a global picture of the game just played: - What settings were used - How many humans vs AIs - How long the game has been played - Basic information about the OS / CPU All this information is kept very generic, so there is no chance we send private information to our survey server. Nothing in the JSON blob could identify you as a person; it mostly tells about the game played. At any time you can see what the JSON blob includes, by pressing the "Preview Survey Results" button in-game.
This commit is contained in:

committed by
Patric Stout

parent
021c45c4f6
commit
7634553d22
@@ -7,6 +7,7 @@ add_files(
|
||||
osx_stdafx.h
|
||||
string_osx.cpp
|
||||
string_osx.h
|
||||
survey_osx.cpp
|
||||
CONDITION APPLE
|
||||
)
|
||||
|
||||
|
@@ -38,6 +38,8 @@ bool IsMonospaceFont(CFStringRef name);
|
||||
|
||||
void MacOSSetThreadName(const char *name);
|
||||
|
||||
uint64 MacOSGetPhysicalMemory();
|
||||
|
||||
|
||||
/** Deleter that calls CFRelease rather than deleting the pointer. */
|
||||
template <typename T> struct CFDeleter {
|
||||
|
@@ -272,3 +272,8 @@ void MacOSSetThreadName(const char *name)
|
||||
[ cur performSelector:@selector(setName:) withObject:[ NSString stringWithUTF8String:name ] ];
|
||||
}
|
||||
}
|
||||
|
||||
uint64 MacOSGetPhysicalMemory()
|
||||
{
|
||||
return [ [ NSProcessInfo processInfo ] physicalMemory ];
|
||||
}
|
||||
|
38
src/os/macosx/survey_osx.cpp
Normal file
38
src/os/macosx/survey_osx.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD 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, version 2.
|
||||
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file survey_osx.cpp OSX implementation of OS-specific survey information. */
|
||||
|
||||
#ifdef WITH_NLOHMANN_JSON
|
||||
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#include "../../3rdparty/fmt/format.h"
|
||||
#include "macos.h"
|
||||
|
||||
#include <mach-o/arch.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
void SurveyOS(nlohmann::json &json)
|
||||
{
|
||||
int ver_maj, ver_min, ver_bug;
|
||||
GetMacOSVersion(&ver_maj, &ver_min, &ver_bug);
|
||||
|
||||
const NXArchInfo *arch = NXGetLocalArchInfo();
|
||||
|
||||
json["os"] = "MacOS";
|
||||
json["release"] = fmt::format("{}.{}.{}", ver_maj, ver_min, ver_bug);
|
||||
json["machine"] = arch != nullptr ? arch->description : "unknown";
|
||||
json["min_ver"] = MAC_OS_X_VERSION_MIN_REQUIRED;
|
||||
json["max_ver"] = MAC_OS_X_VERSION_MAX_ALLOWED;
|
||||
|
||||
json["memory"] = MacOSGetPhysicalMemory();
|
||||
}
|
||||
|
||||
#endif /* WITH_NLOHMANN_JSON */
|
@@ -1,5 +1,6 @@
|
||||
add_files(
|
||||
crashlog_unix.cpp
|
||||
survey_unix.cpp
|
||||
CONDITION UNIX AND NOT APPLE AND NOT OPTION_OS2
|
||||
)
|
||||
|
||||
|
38
src/os/unix/survey_unix.cpp
Normal file
38
src/os/unix/survey_unix.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD 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, version 2.
|
||||
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file survey_unix.cpp Unix implementation of OS-specific survey information. */
|
||||
|
||||
#ifdef WITH_NLOHMANN_JSON
|
||||
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
void SurveyOS(nlohmann::json &json)
|
||||
{
|
||||
struct utsname name;
|
||||
if (uname(&name) < 0) {
|
||||
json["os"] = "Unix";
|
||||
return;
|
||||
}
|
||||
|
||||
json["os"] = name.sysname;
|
||||
json["release"] = name.release;
|
||||
json["machine"] = name.machine;
|
||||
json["version"] = name.version;
|
||||
|
||||
long pages = sysconf(_SC_PHYS_PAGES);
|
||||
long page_size = sysconf(_SC_PAGE_SIZE);
|
||||
json["memory"] = pages * page_size;
|
||||
}
|
||||
|
||||
#endif /* WITH_NLOHMANN_JSON */
|
@@ -4,6 +4,7 @@ add_files(
|
||||
font_win32.h
|
||||
string_uniscribe.cpp
|
||||
string_uniscribe.h
|
||||
survey_win.cpp
|
||||
win32.cpp
|
||||
win32.h
|
||||
CONDITION WIN32
|
||||
|
37
src/os/windows/survey_win.cpp
Normal file
37
src/os/windows/survey_win.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD 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, version 2.
|
||||
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file survey_win.cpp Windows implementation of OS-specific survey information. */
|
||||
|
||||
#ifdef WITH_NLOHMANN_JSON
|
||||
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#include "../../3rdparty/fmt/format.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
void SurveyOS(nlohmann::json &json)
|
||||
{
|
||||
_OSVERSIONINFOA os;
|
||||
os.dwOSVersionInfoSize = sizeof(os);
|
||||
GetVersionExA(&os);
|
||||
|
||||
json["os"] = "Windows";
|
||||
json["release"] = fmt::format("{}.{}.{} ({})", os.dwMajorVersion, os.dwMinorVersion, os.dwBuildNumber, os.szCSDVersion);
|
||||
|
||||
MEMORYSTATUSEX status;
|
||||
status.dwLength = sizeof(status);
|
||||
GlobalMemoryStatusEx(&status);
|
||||
|
||||
json["memory"] = status.ullTotalPhys;
|
||||
}
|
||||
|
||||
#endif /* WITH_NLOHMANN_JSON */
|
Reference in New Issue
Block a user