forked from mirror/OpenTTD
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
@@ -41,6 +41,9 @@
|
||||
#include "music/music_driver.hpp"
|
||||
#include "gui.h"
|
||||
#include "mixer.h"
|
||||
#include "network/core/config.h"
|
||||
#include "network/network_gui.h"
|
||||
#include "network/network_survey.h"
|
||||
|
||||
|
||||
#include "safeguards.h"
|
||||
@@ -190,6 +193,8 @@ struct GameOptionsWindow : Window {
|
||||
this->OnInvalidateData(0);
|
||||
|
||||
this->SetTab(WID_GO_TAB_GENERAL);
|
||||
|
||||
if constexpr (!NetworkSurveyHandler::IsSurveyPossible()) this->GetWidget<NWidgetStacked>(WID_GO_SURVEY_SEL)->SetDisplayedPlane(SZSP_NONE);
|
||||
}
|
||||
|
||||
void Close() override
|
||||
@@ -464,19 +469,19 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
void OnClick(Point pt, int widget, int click_count) override
|
||||
{
|
||||
if (widget >= WID_GO_BASE_GRF_TEXTFILE && widget < WID_GO_BASE_GRF_TEXTFILE + TFT_END) {
|
||||
if (widget >= WID_GO_BASE_GRF_TEXTFILE && widget < WID_GO_BASE_GRF_TEXTFILE + TFT_CONTENT_END) {
|
||||
if (BaseGraphics::GetUsedSet() == nullptr) return;
|
||||
|
||||
ShowBaseSetTextfileWindow((TextfileType)(widget - WID_GO_BASE_GRF_TEXTFILE), BaseGraphics::GetUsedSet(), STR_CONTENT_TYPE_BASE_GRAPHICS);
|
||||
return;
|
||||
}
|
||||
if (widget >= WID_GO_BASE_SFX_TEXTFILE && widget < WID_GO_BASE_SFX_TEXTFILE + TFT_END) {
|
||||
if (widget >= WID_GO_BASE_SFX_TEXTFILE && widget < WID_GO_BASE_SFX_TEXTFILE + TFT_CONTENT_END) {
|
||||
if (BaseSounds::GetUsedSet() == nullptr) return;
|
||||
|
||||
ShowBaseSetTextfileWindow((TextfileType)(widget - WID_GO_BASE_SFX_TEXTFILE), BaseSounds::GetUsedSet(), STR_CONTENT_TYPE_BASE_SOUNDS);
|
||||
return;
|
||||
}
|
||||
if (widget >= WID_GO_BASE_MUSIC_TEXTFILE && widget < WID_GO_BASE_MUSIC_TEXTFILE + TFT_END) {
|
||||
if (widget >= WID_GO_BASE_MUSIC_TEXTFILE && widget < WID_GO_BASE_MUSIC_TEXTFILE + TFT_CONTENT_END) {
|
||||
if (BaseMusic::GetUsedSet() == nullptr) return;
|
||||
|
||||
ShowBaseSetTextfileWindow((TextfileType)(widget - WID_GO_BASE_MUSIC_TEXTFILE), BaseMusic::GetUsedSet(), STR_CONTENT_TYPE_BASE_MUSIC);
|
||||
@@ -489,6 +494,30 @@ struct GameOptionsWindow : Window {
|
||||
this->SetTab(widget);
|
||||
break;
|
||||
|
||||
case WID_GO_SURVEY_PARTICIPATE_BUTTON:
|
||||
switch (_settings_client.network.participate_survey) {
|
||||
case PS_ASK:
|
||||
case PS_NO:
|
||||
_settings_client.network.participate_survey = PS_YES;
|
||||
break;
|
||||
|
||||
case PS_YES:
|
||||
_settings_client.network.participate_survey = PS_NO;
|
||||
break;
|
||||
}
|
||||
|
||||
this->SetWidgetLoweredState(WID_GO_SURVEY_PARTICIPATE_BUTTON, _settings_client.network.participate_survey == PS_YES);
|
||||
this->SetWidgetDirty(WID_GO_SURVEY_PARTICIPATE_BUTTON);
|
||||
break;
|
||||
|
||||
case WID_GO_SURVEY_LINK_BUTTON:
|
||||
OpenBrowser(NETWORK_SURVEY_DETAILS_LINK.c_str());
|
||||
break;
|
||||
|
||||
case WID_GO_SURVEY_PREVIEW_BUTTON:
|
||||
ShowSurveyResultTextfileWindow();
|
||||
break;
|
||||
|
||||
case WID_GO_FULLSCREEN_BUTTON: // Click fullscreen on/off
|
||||
/* try to toggle full-screen on/off */
|
||||
if (!ToggleFullScreen(!_fullscreen)) {
|
||||
@@ -686,6 +715,7 @@ struct GameOptionsWindow : Window {
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
this->SetWidgetLoweredState(WID_GO_SURVEY_PARTICIPATE_BUTTON, _settings_client.network.participate_survey == PS_YES);
|
||||
this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
|
||||
this->SetWidgetLoweredState(WID_GO_VIDEO_ACCEL_BUTTON, _video_hw_accel);
|
||||
this->SetWidgetDisabledState(WID_GO_REFRESH_RATE_DROPDOWN, _video_vsync);
|
||||
@@ -701,7 +731,7 @@ struct GameOptionsWindow : Window {
|
||||
bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0;
|
||||
this->GetWidget<NWidgetCore>(WID_GO_BASE_GRF_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_GRF_STATUS, STR_NULL);
|
||||
|
||||
for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
|
||||
for (TextfileType tft = TFT_CONTENT_BEGIN; tft < TFT_CONTENT_END; tft++) {
|
||||
this->SetWidgetDisabledState(WID_GO_BASE_GRF_TEXTFILE + tft, BaseGraphics::GetUsedSet() == nullptr || !BaseGraphics::GetUsedSet()->GetTextfile(tft).has_value());
|
||||
this->SetWidgetDisabledState(WID_GO_BASE_SFX_TEXTFILE + tft, BaseSounds::GetUsedSet() == nullptr || !BaseSounds::GetUsedSet()->GetTextfile(tft).has_value());
|
||||
this->SetWidgetDisabledState(WID_GO_BASE_MUSIC_TEXTFILE + tft, BaseMusic::GetUsedSet() == nullptr || !BaseMusic::GetUsedSet()->GetTextfile(tft).has_value());
|
||||
@@ -739,6 +769,20 @@ static const NWidgetPart _nested_game_options_widgets[] = {
|
||||
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME, STR_NULL),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_CURRENCY_DROPDOWN), SetMinimalSize(100, 12), SetDataTip(STR_JUST_STRING, STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GO_SURVEY_SEL),
|
||||
NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_PARTICIPATE_SURVEY_FRAME, STR_NULL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_PARTICIPATE_SURVEY, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_SURVEY_PARTICIPATE_BUTTON), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_PARTICIPATE_SURVEY_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_SURVEY_PREVIEW_BUTTON), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_GAME_OPTIONS_PARTICIPATE_SURVEY_PREVIEW, STR_GAME_OPTIONS_PARTICIPATE_SURVEY_PREVIEW_TOOLTIP),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_SURVEY_LINK_BUTTON), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK, STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
|
||||
/* Graphics tab */
|
||||
|
Reference in New Issue
Block a user